From 0a76e07b39c7d54f6c574e72e5362cb768e48063 Mon Sep 17 00:00:00 2001 From: Sandwich Date: Fri, 2 Jan 2026 15:55:27 +0100 Subject: [PATCH] Fix post-reboot extra packages task --- main.yml | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/main.yml b/main.yml index 8f047dc..100f27c 100644 --- a/main.yml +++ b/main.yml @@ -80,25 +80,23 @@ ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" - name: Install post-reboot extra packages + vars: + post_install_extra_packages: >- + {{ + ( + extra_packages + if (extra_packages is iterable and extra_packages is not string) + else (extra_packages | string).split(',') + ) + | map('trim') + | reject('equalto', '') + | list + }} when: - post_reboot_can_connect | bool - extra_packages is defined - extra_packages | length > 0 - block: - - name: Install extra packages - vars: - post_install_extra_packages: >- - {{ - ( - extra_packages - if (extra_packages is iterable and extra_packages is not string) - else (extra_packages | string).split(',') - ) - | map('trim') - | reject('equalto', '') - | list - }} - when: post_install_extra_packages | length > 0 - ansible.builtin.package: - name: "{{ post_install_extra_packages }}" - state: present + - post_install_extra_packages | length > 0 + ansible.builtin.package: + name: "{{ post_install_extra_packages }}" + state: present