Use flatten filter to install packages

This commit is contained in:
Jeremy Gardais 2023-01-24 09:33:17 +01:00
parent 19fc82668b
commit c0f4da8a73
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
3 changed files with 6 additions and 4 deletions

View File

@ -1,3 +1,7 @@
## v1.0.2
### Fix
* Use flatten to manage packages list.
## v1.0.1 ## v1.0.1

View File

@ -11,7 +11,7 @@
# #
# List of base packages to install. # List of base packages to install.
deb_sec__required_packages: deb_sec__required_packages:
- 'debsecan' - debsecan
# ]]] # ]]]
# .. envvar:: deb_sec__deploy_state [[[ # .. envvar:: deb_sec__deploy_state [[[
# #

View File

@ -6,12 +6,10 @@
# Manage required system packages [[[1 # Manage required system packages [[[1
- name: Ensure required packages are in there desired state - name: Ensure required packages are in there desired state
package: package:
name: '{{ item }}' name: '{{ (deb_sec__required_packages | flatten) }}'
state: '{{ "present" if (deb_sec__deploy_state == "present") state: '{{ "present" if (deb_sec__deploy_state == "present")
else "absent" }}' else "absent" }}'
install_recommends: False install_recommends: False
with_flattened:
- '{{ deb_sec__required_packages | to_nice_json }}'
register: pkg_result register: pkg_result
until: pkg_result is success until: pkg_result is success