Use flatten to manage packages list

This commit is contained in:
Jeremy Gardais 2023-01-24 10:35:16 +01:00
parent c515e9ceec
commit dbe4d60806
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
2 changed files with 10 additions and 12 deletions

View File

@ -1,3 +1,9 @@
## v1.4.1
### Fix
* Use flatten to manage packages list.
## v1.4.0 ## v1.4.0
### Fix ### Fix

View File

@ -47,11 +47,9 @@
## Manage depencies packages ## Manage depencies packages
- name: Ensure dependencies are present - name: Ensure dependencies are present
package: package:
name: '{{ item }}' name: '{{ openmanage__dep_packages | flatten }}'
state: "present" state: "present"
install_recommends: '{{ openmanage__install_recommends | bool }}' install_recommends: '{{ openmanage__install_recommends | bool }}'
with_flattened:
- '{{ openmanage__dep_packages | to_nice_json }}'
register: pkg_dep_result register: pkg_dep_result
until: pkg_dep_result is success until: pkg_dep_result is success
when: (openmanage__deploy_state == "present") when: (openmanage__deploy_state == "present")
@ -59,11 +57,9 @@
## Manage Debian Stretch (or Ubuntu Xenial) specific packages ## Manage Debian Stretch (or Ubuntu Xenial) specific packages
- name: "Ensure 910 specific packages (Stretch|Xenial) are in there desired state" - name: "Ensure 910 specific packages (Stretch|Xenial) are in there desired state"
package: package:
name: '{{ item }}' name: '{{ openmanage__stretch_packages | flatten }}'
state: "present" state: "present"
install_recommends: '{{ openmanage__install_recommends | bool }}' install_recommends: '{{ openmanage__install_recommends | bool }}'
with_flattened:
- '{{ openmanage__stretch_packages | to_nice_json }}'
register: pkg_stretch_result register: pkg_stretch_result
until: pkg_stretch_result is success until: pkg_stretch_result is success
when: (openmanage__deploy_state == "present" and when: (openmanage__deploy_state == "present" and
@ -73,24 +69,20 @@
## Manage base system packages ## Manage base system packages
- name: Ensure base packages are in there desired state - name: Ensure base packages are in there desired state
package: package:
name: '{{ item }}' name: '{{ openmanage__base_packages | flatten }}'
state: '{{ "present" if (openmanage__deploy_state == "present") else "absent" }}' state: '{{ "present" if (openmanage__deploy_state == "present") else "absent" }}'
install_recommends: '{{ openmanage__install_recommends | bool }}' install_recommends: '{{ openmanage__install_recommends | bool }}'
with_flattened:
- '{{ openmanage__base_packages | to_nice_json }}'
register: pkg_base_result register: pkg_base_result
until: pkg_base_result is success until: pkg_base_result is success
## Manage OMSA webgui packages ## Manage OMSA webgui packages
- name: Ensure OMSA-webgui packages are in there desired state - name: Ensure OMSA-webgui packages are in there desired state
package: package:
name: '{{ item }}' name: '{{ openmanage__webgui_packages | flatten }}'
state: '{{ "present" if (openmanage__deploy_state == "present") and state: '{{ "present" if (openmanage__deploy_state == "present") and
(openmanage__webgui_state == "present") (openmanage__webgui_state == "present")
else "absent" }}' else "absent" }}'
install_recommends: '{{ openmanage__install_recommends | bool }}' install_recommends: '{{ openmanage__install_recommends | bool }}'
with_flattened:
- '{{ openmanage__webgui_packages | to_nice_json }}'
register: pkg_webgui_result register: pkg_webgui_result
until: pkg_webgui_result is success until: pkg_webgui_result is success
notify: ['restart webgui service'] notify: ['restart webgui service']