-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathqe_get_tendrl_ansible.yml
59 lines (55 loc) · 1.93 KB
/
qe_get_tendrl_ansible.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
#
# Get content of tendrl-ansible package
#
- hosts: usm_server
remote_user: root
vars:
tendrl_ansible_dir: "./tendrl-ansible-tmp/"
roles:
- role: qe-tendrl-repo
when: ansible_distribution == 'CentOS'
tasks:
# install tendrl-ansible
- name: Install tendrl-ansible package
yum: name=tendrl-ansible state=latest
# prepare local directory for tendrl-ansible
- name: Remove old '{{ tendrl_ansible_dir }}' directory for tendrl-ansible
local_action:
module: file
state: absent
path: "{{ tendrl_ansible_dir }}"
run_once: True
- name: Create directory for tendrl-ansible
local_action:
module: file
state: directory
path: "{{ tendrl_ansible_dir }}"
run_once: True
# Download tendrl-ansible package on the remote host
- name: Download tendrl-ansible package
shell: yumdownloader --destdir /tmp/downloaded-tendrl-ansible-rpm/ tendrl-ansible
- name: Get name of the downloaded package
shell: ls /tmp/downloaded-tendrl-ansible-rpm/
register: tendrl_ansible_rpm_name
# Fetch tendrl-ansible package from remote host to local host
- name: Fetch tendrl-ansible packge to local machine
fetch:
src: "/tmp/downloaded-tendrl-ansible-rpm/{{ tendrl_ansible_rpm_name.stdout }}"
dest: "{{ tendrl_ansible_dir }}{{ tendrl_ansible_rpm_name.stdout }}"
flat: yes
# Unpack the package on local host
- name: Unpack the downloaded package
local_action:
module: shell rpm2cpio {{ tendrl_ansible_rpm_name.stdout }} | cpio -idmv --no-absolute-filenames
chdir: "{{ tendrl_ansible_dir }}"
run_once: True
# remove qe tendrl repos
- name: remove qe tendrl repos (added by qe-tendrl-repo role
yum_repository:
name: "{{ item }}"
state: absent
with_items:
- "tendrl"
- "tendrl-dependencies"
when: ansible_distribution == 'CentOS'