Skip to content

Commit d0ea8f2

Browse files
Use explicit conditions in booleans inside role 'monitoring_plugins'
* Refactor conditionals to ensure proper evaluation of package lists in Debian, RedHat, and Suse installation tasks --------- Co-authored-by: Donien <88634789+Donien@users.noreply.github.com>
1 parent 8c0ce40 commit d0ea8f2

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- "Use explicit booleans in conditions inside of role :code:`monitoring_plugins` for compatibility with :code:`ansible-core >= 2.19`. Thanks @gianmarco-mameli"

roles/monitoring_plugins/tasks/install_on_Debian.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
changed_when: apt_result.stdout is defined
1111
when:
1212
- needed_packages is defined
13-
- needed_packages
13+
- needed_packages | length > 0
1414

1515
- name: Apt - remove non-requested packages
1616
become: yes
@@ -20,4 +20,4 @@
2020
autoremove: "{{ icinga_monitoring_plugins_autoremove }}"
2121
when:
2222
- icinga_monitoring_plugins_remove
23-
- unwanted_packages
23+
- unwanted_packages | length > 0

roles/monitoring_plugins/tasks/install_on_RedHat.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
when:
1515
- ansible_distribution_major_version < "8"
1616
- needed_packages is defined
17-
- needed_packages
17+
- needed_packages | length > 0
1818

1919
- name: Dnf - install requested packages
2020
become: yes
@@ -26,7 +26,7 @@
2626
when:
2727
- ansible_distribution_major_version >= "8"
2828
- needed_packages is defined
29-
- needed_packages
29+
- needed_packages | length > 0
3030

3131
- name: Yum - remove non-requested packages
3232
become: yes
@@ -36,4 +36,4 @@
3636
autoremove: "{{ icinga_monitoring_plugins_autoremove }}"
3737
when:
3838
- icinga_monitoring_plugins_remove
39-
- unwanted_packages
39+
- unwanted_packages | length > 0

roles/monitoring_plugins/tasks/install_on_Suse.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
changed_when: zypper_result.stdout is defined
1111
when:
1212
- needed_packages is defined
13-
- needed_packages
13+
- needed_packages | length > 0
1414

1515
- name: Zypper - remove non-requested packages
1616
become: yes
@@ -20,4 +20,4 @@
2020
clean_deps: "{{ icinga_monitoring_plugins_autoremove }}"
2121
when:
2222
- icinga_monitoring_plugins_remove
23-
- unwanted_packages
23+
- unwanted_packages | length > 0

0 commit comments

Comments
 (0)