From b4e8ccb77ff652298b2b3189240e1bc3062f5617 Mon Sep 17 00:00:00 2001 From: Sandwich Date: Wed, 18 Feb 2026 19:36:37 +0100 Subject: [PATCH] fix: re-gather facts after reboot to detect target OS package manager The live ISO (Arch) caches ansible_pkg_mgr=pacman. After rebooting into the target OS (e.g. Debian), package module fails because pacman is not available. Re-gather minimal facts including pkg_mgr. --- main.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.yml b/main.yml index 1fcbc1c..d12b213 100644 --- a/main.yml +++ b/main.yml @@ -154,6 +154,15 @@ ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" ansible_python_interpreter: /usr/bin/python3 + - name: Re-gather facts for target OS after reboot + when: + - post_reboot_can_connect | bool + ansible.builtin.setup: + gather_subset: + - "!all" + - min + - pkg_mgr + - name: Install post-reboot packages when: - post_reboot_can_connect | bool