-
Notifications
You must be signed in to change notification settings - Fork 0
/
maintenance-full.yml
39 lines (31 loc) · 992 Bytes
/
maintenance-full.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
---
- hosts: all
become: true
gather_facts: true
serial: "{{ SERIAL_COUNT | default('100%') }}"
roles:
- { role: maintenance,
maintenance: {
upgrade_type: "full",
allow_reboot: false
}
}
- hosts: all
become: true
serial: "{{ SERIAL_COUNT | default('100%') }}"
tasks:
- block:
- stat: path=/var/run/reboot-required
register: reboot_required
check_mode: no
- name: "Restart Server"
reboot:
msg: "Reboot Ansible-Playbook after update"
reboot_timeout: 3600
register: result
when: reboot_required.stat.exists
- name: "Info if Reboot was sucessful"
debug:
msg: "{{ inventory_hostname }} has rebooted: {{ result.rebooted }}, it has taken: {{ result.elapsed }} seconds"
when: reboot_required.stat.exists
when: allow_reboot is not defined or (allow_reboot is defined and allow_reboot == true)