Files
ansible/reboot.yml

20 lines
524 B
YAML

- name: Determine if a reboot is necessary
ansible.builtin.command:
cmd: ~/bin/needs_reboot
register: needs_reboot
- name: Stop mollyguard if active
become: true
ansible.builtin.script: stop_mollyguard
register: mg
- name: Print mg dict
ansible.builtin.debug:
var: mg
when: needs_reboot.stdout == "yes"
- name: Conditionally reboot
become: true
ansible.builtin.reboot:
when:
- inventory_hostname not in groups['control']
- mg.failed is false
- needs_reboot.stdout == "yes"