This repository has been archived on 2024-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
cpx-ansible/roles/os_config/tasks/reboot.yml

24 lines
583 B
YAML
Raw Normal View History

2023-04-20 21:34:25 +00:00
# vim: ft=yaml.ansible
---
- name: Check if a reboot is needed
ansible.builtin.stat:
path: /var/run/reboot-required
register: needs_reboot
- name: Include docker_services role for service shutdown
ansible.builtin.include_role:
name: docker_services
tasks_from: services.yml
apply:
ignore_errors: true
vars:
down: true
2023-04-20 21:34:25 +00:00
when: needs_reboot.stat.exists or
(do_reboot is defined and do_reboot)
2023-04-20 21:34:25 +00:00
- name: Reboot host
ansible.builtin.reboot:
when: needs_reboot.stat.exists or
(do_reboot is defined and do_reboot)
2023-04-20 21:34:25 +00:00
register: rebooted