2
0
Files
Ansible/Maintenance/maint-reboot-required.yaml
2024-06-06 22:23:10 +02:00

23 lines
504 B
YAML

---
- name: Check if system reboot is required
hosts: all
become: yes
become_user: root
tasks:
- name: Check if a reboot is required
register: reboot
stat: path=/var/run/reboot-required
- name: Reboot machine
command: /sbin/reboot now
async: 1
poll: 0
when: reboot.stat.exists == true
- name: Pause for 15 seconds
ansible.builtin.pause:
seconds: 15
- name: Wait for systems to become reachable
wait_for_connection: