-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_awx.yml
71 lines (63 loc) · 1.59 KB
/
update_awx.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
---
- name: Update prepare
hosts: sandbox
gather_facts: no
vars:
additional_bridge: true
bridge_name: int_bridge
tasks:
- name: Check if {{ bridge_name }} is active
shell: nmcli connection show --active |grep int | awk '{print $1}'
register: nmcli_command_result
when: additional_bridge == true
- name: Start internal bridge
command:
cmd: nmcli con up int_bridge
when:
- additional_bridge == true
- bridge_name not in nmcli_command_result.stdout
- name: Ensure that vms are running
community.libvirt.virt:
name: "{{ item }}"
state: running
with_inventory_hostnames:
- infra
- name: Check if systems are up and running
hosts: all
gather_facts: no
tasks:
- name: Verify if hosts are up and running
wait_for_connection:
delay: 5
timeout: 300
- name: Sync /etc/hosts form sandbox
hosts: all
gather_facts: no
tasks:
- name: Sync /etc/hosts
synchronize:
src: /etc/hosts
dest: /etc/hosts
delegate_to: sandbox
- name: Update hosts
hosts: all
gather_facts: no
tasks:
- name: Upgrade all packages to latest version
dnf:
name: "*"
state: latest
register: update
ignore_errors: true
- name: Reboot and shutdown hosts
hosts: testhosts
gather_facts: no
tasks:
- name: Reboot updated hosts
reboot:
- name: Wait for host startup after reboot
wait_for_connection:
delay: 10
timeout: 300
- name: Shutdown
community.general.shutdown: