christianlempa-boilerplates/ansible/maintenance/maint-reboot-required.yaml

17 lines
416 B
YAML
Raw Normal View History

2023-05-25 13:48:38 +02:00
---
- name: Check if system reboot is required
hosts: "{{ my_hosts | d([]) }}"
become: true
2023-05-25 13:48:38 +02:00
tasks:
- name: Check if system reboot is required
2023-05-25 13:48:38 +02:00
become: true
ansible.builtin.stat:
2023-05-25 13:48:38 +02:00
path: /var/run/reboot-required
register: reboot_required
- name: Report if reboot is required
ansible.builtin.debug:
2023-05-25 13:48:38 +02:00
msg: "Reboot is required"
when: reboot_required.stat.exists