Fix post-reboot extra packages task
This commit is contained in:
34
main.yml
34
main.yml
@@ -80,25 +80,23 @@
|
|||||||
ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
- name: Install post-reboot extra packages
|
- 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:
|
when:
|
||||||
- post_reboot_can_connect | bool
|
- post_reboot_can_connect | bool
|
||||||
- extra_packages is defined
|
- extra_packages is defined
|
||||||
- extra_packages | length > 0
|
- extra_packages | length > 0
|
||||||
block:
|
- post_install_extra_packages | length > 0
|
||||||
- name: Install extra packages
|
ansible.builtin.package:
|
||||||
vars:
|
name: "{{ post_install_extra_packages }}"
|
||||||
post_install_extra_packages: >-
|
state: present
|
||||||
{{
|
|
||||||
(
|
|
||||||
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user