Refactor to be a bit more modular

This commit is contained in:
2026-03-11 14:15:40 -04:00
parent 601954fe7c
commit f5c6d28095
2 changed files with 47 additions and 15 deletions

View File

@@ -1,13 +1,19 @@
- name: Stop mollyguard if active
ansible.builtin.script: stop_mollyguard
register: mg
- 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 group['controller']
- mgc succeeded
- needs_reboot succeeded
- inventory_hostname not in groups['control']
- mg.failed is false
- needs_reboot.stdout == "yes"