From 4fb938c882d38ce48c86b2519b0a10dc149721ed Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 5 Aug 2024 13:02:59 +0100 Subject: [PATCH 1/2] Prevent hanging before reboot on systems running molly-guard molly-guard can be used to prevent accidental reboots, prompting the user to input the system's hostname before allowing a reboot. This does not work well with automation, however. This change adds the internal reboot executable within molly-guard to the search path to avoid this issue. --- etc/kayobe/ansible/reboot.yml | 9 +++++++++ etc/kayobe/ansible/ubuntu-upgrade.yml | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/etc/kayobe/ansible/reboot.yml b/etc/kayobe/ansible/reboot.yml index 8810afd7f..d64bd83fa 100644 --- a/etc/kayobe/ansible/reboot.yml +++ b/etc/kayobe/ansible/reboot.yml @@ -8,3 +8,12 @@ - name: Reboot and wait become: true reboot: + search_paths: + # Systems running molly-guard hang waiting for confirmation before rebooting without this. + - "/lib/molly-guard" + # Default list: + - "/sbin" + - "/bin" + - "/usr/sbin" + - "/usr/bin" + - "/usr/local/sbin" diff --git a/etc/kayobe/ansible/ubuntu-upgrade.yml b/etc/kayobe/ansible/ubuntu-upgrade.yml index 66ed49643..b7cfe7338 100644 --- a/etc/kayobe/ansible/ubuntu-upgrade.yml +++ b/etc/kayobe/ansible/ubuntu-upgrade.yml @@ -40,6 +40,15 @@ reboot: reboot_timeout: "{{ reboot_timeout_s }}" connect_timeout: 600 + search_paths: + # Systems running molly-guard hang waiting for confirmation before rebooting without this. + - "/lib/molly-guard" + # Default list: + - "/sbin" + - "/bin" + - "/usr/sbin" + - "/usr/bin" + - "/usr/local/sbin" become: true when: file_status.stat.exists @@ -101,6 +110,15 @@ reboot: reboot_timeout: "{{ reboot_timeout_s }}" connect_timeout: 600 + search_paths: + # Systems running molly-guard hang waiting for confirmation before rebooting without this. + - "/lib/molly-guard" + # Default list: + - "/sbin" + - "/bin" + - "/usr/sbin" + - "/usr/bin" + - "/usr/local/sbin" become: true - name: Update distribution facts From 382f735872d53aa923294a1853dadfc31bbd29cb Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 5 Aug 2024 13:03:54 +0100 Subject: [PATCH 2/2] Add reboot timeout to reboot playbook --- etc/kayobe/ansible/reboot.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/kayobe/ansible/reboot.yml b/etc/kayobe/ansible/reboot.yml index d64bd83fa..a6deb536c 100644 --- a/etc/kayobe/ansible/reboot.yml +++ b/etc/kayobe/ansible/reboot.yml @@ -4,10 +4,13 @@ serial: "{{ lookup('env', 'ANSIBLE_SERIAL') | default(1, true) }}" tags: - reboot + vars: + reboot_timeout_s: "{{ 20 * 60 }}" tasks: - name: Reboot and wait become: true reboot: + reboot_timeout: "{{ reboot_timeout_s }}" search_paths: # Systems running molly-guard hang waiting for confirmation before rebooting without this. - "/lib/molly-guard"