-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.yml
70 lines (58 loc) · 1.43 KB
/
update.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
- hosts: rspi4
vars:
ansible_ssh_timeout: 30
tasks:
- name: Update System Package Cache
become: yes
become_user: root
apt: update_cache=yes
- name: Upgrade System Packages
become: yes
become_user: root
apt: upgrade=full
- name: Rebooting if needed...
command: sudo shutdown -r now removes=/var/run/reboot-required
async: 0
poll: 0
ignore_errors: true
register: restarted
- name: Waiting for reboot...
local_action: wait_for host=localhost port=22 delay=60 state=started
when: restarted.changed
- hosts: hiveos
vars:
ansible_ssh_timeout: 30
tasks:
- name: Selfupgrade
become: yes
command: "selfupgrade"
- name: Reboot
become: yes
command: "sreboot"
async: 1
poll: 0
ignore_errors: true
- hosts: hiveos
gather_facts: no
tasks:
- name: Wait for the host to come back
local_action:
module: wait_for
host: "{{ inventory_hostname }}"
port: 22
delay: 60
timeout: 300
state: started
delegate_to: localhost
- hosts: openwrt
vars:
ansible_ssh_timeout: 30
tasks:
- name: Upgrade System Packages
shell: |
opkg update
opkg list-upgradable | cut -f 1 -d ' ' | xargs -r opkg upgrade
- name: Reboot
command: reboot
- name: Waiting for reboot...
local_action: wait_for host=localhost port=22 delay=60 state=started