-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdateSudo.yml
172 lines (146 loc) · 4.75 KB
/
UpdateSudo.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
---
- hosts: all
name: UpdateSudo
become: yes
become_method: sudo
gather_facts: yes
tasks:
- name: Get sudo version
package_facts:
manager: auto
- name: Set sudo version
set_fact:
sudo_version: "{{ ansible_facts.packages.sudo[0].version }}-{{ ansible_facts.packages.sudo[0].release }}"
- name: Output sudo version
debug:
msg: "{{ sudo_version }}"
- name: Install rsync if needed
yum:
name: rsync
state: present
- name: Sync the file to the Oracle 6 HOST
synchronize:
checksum: yes
src: sudo-1.8.6p3-29.0.2_oracle_.el6_10.3.x86_64.rpm
dest: /tmp/sudo-1.8.6p3-29.0.2_oracle_.el6_10.3.x86_64.rpm
owner: yes
group: yes
when:
- ansible_facts['distribution'] == "Oracle"
- ansible_facts['distribution_major_version'] == "6"
- sudo_version != '1.8.6p3-29.0.2.el6_10.3'
notify:
- oel6install
- oel6cleanup
- name: Sync the file to the Oracle 7 HOST
synchronize:
checksum: yes
src: sudo-1.8.23-10_oracle_.el7_9.1.x86_64.rpm
dest: /tmp/sudo-1.8.23-10_oracle_.el7_9.1.x86_64.rpm
owner: yes
group: yes
when:
- ansible_facts['distribution'] == "Oracle"
- ansible_facts['distribution_major_version'] == "7"
- sudo_version != '1.8.23-10.el7'
notify:
- oel7install
- oel7cleanup
- name: Sync the file to the CentOS HOST
synchronize:
checksum: yes
src: sudo-1.8.23-10.el7_9.1_centos_.x86_64.rpm
dest: /tmp/sudo-1.8.23-10.el7_9.1_centos_.x86_64.rpm
owner: yes
group: yes
when:
- ansible_facts['distribution'] == "CentOS"
- ansible_facts['distribution_major_version'] == "7"
- sudo_version != '1.8.23-10.el7_9.1'
notify:
- cent7install
- cent7cleanup
- name: Sync the file to the el7 HOST
synchronize:
checksum: yes
src: sudo-1.8.23-10.el7_9.1.x86_64.rpm
dest: /tmp/sudo-1.8.23-10.el7_9.1.x86_64.rpm
owner: yes
group: yes
when:
- ansible_facts['distribution'] != "CentOS"
- ansible_facts['distribution_major_version'] == "7"
- sudo_version != '1.8.23-10.el7_9.1'
notify:
- el7install
- el7cleanup
- name: Sync the file to the el6 HOST
synchronize:
checksum: yes
src: sudo-1.8.6p3-29.el6_10.4.x86_64.rpm
dest: /tmp/sudo-1.8.6p3-29.el6_10.4.x86_64.rpm
owner: yes
group: yes
when:
- ansible_facts['distribution'] != "CentOS"
- ansible_facts['distribution_major_version'] == "6"
- sudo_version != '1.8.6p3-29.el6_10.4'
notify:
- el6install
- el6cleanup
handlers:
- name: Install on OEL6
yum:
name: /tmp/sudo-1.8.6p3-29.0.2_oracle_.el6_10.3.x86_64.rpm
state: present
allow_downgrade: yes
listen: oel6install
- name: Install on OEL7
yum:
name: /tmp/sudo-1.8.23-10_oracle_.el7_9.1.x86_64.rpm
state: present
allow_downgrade: yes
listen: oel7install
- name: Install on CentOS 7
yum:
name: /tmp/sudo-1.8.23-10.el7_9.1_centos_.x86_64.rpm
state: present
allow_downgrade: yes
listen: cent7install
- name: Install on EL6
yum:
name: /tmp/sudo-1.8.6p3-29.el6_10.4.x86_64.rpm
state: present
allow_downgrade: yes
listen: el6install
- name: Install on EL7
yum:
name: /tmp/sudo-1.8.23-10.el7_9.1.x86_64.rpm
state: present
allow_downgrade: yes
listen: el7install
- name: Cleanup Sudo Package
file:
path: "/tmp/sudo-1.8.6p3-29.el6_10.4.x86_64.rpm"
state: absent
listen: el6cleanup
- name: Cleanup Sudo Package
file:
path: "/tmp/sudo-1.8.23-10.el7_9.1.x86_64.rpm"
state: absent
listen: el7cleanup
- name: Cleanup Sudo Package
file:
path: "/tmp/sudo-1.8.23-10.el7_9.1_centos_.x86_64.rpm"
state: absent
listen: cent7cleanup
- name: Cleanup Sudo Package
file:
path: "/tmp/sudo-1.8.6p3-29.0.2_oracle_.el6_10.3.x86_64.rpm"
state: absent
listen: oel6cleanup
- name: Cleanup Sudo Package
file:
path: "/tmp/sudo-1.8.23-10_oracle_.el7_9.1.x86_64.rpm"
state: absent
listen: oel7cleanup