diff --git a/changelogs/fragments/fix_broken_conditionals.yml b/changelogs/fragments/fix_broken_conditionals.yml new file mode 100644 index 00000000..072905d9 --- /dev/null +++ b/changelogs/fragments/fix_broken_conditionals.yml @@ -0,0 +1,2 @@ +bugfixes: + - "Use explicit booleans in conditions inside of role :code:`monitoring_plugins` for compatibility with :code:`ansible-core >= 2.19`. Thanks @gianmarco-mameli" \ No newline at end of file diff --git a/roles/monitoring_plugins/tasks/install_on_Debian.yml b/roles/monitoring_plugins/tasks/install_on_Debian.yml index c3bf10fb..54d676dc 100644 --- a/roles/monitoring_plugins/tasks/install_on_Debian.yml +++ b/roles/monitoring_plugins/tasks/install_on_Debian.yml @@ -10,7 +10,7 @@ changed_when: apt_result.stdout is defined when: - needed_packages is defined - - needed_packages + - needed_packages | length > 0 - name: Apt - remove non-requested packages become: yes @@ -20,4 +20,4 @@ autoremove: "{{ icinga_monitoring_plugins_autoremove }}" when: - icinga_monitoring_plugins_remove - - unwanted_packages + - unwanted_packages | length > 0 diff --git a/roles/monitoring_plugins/tasks/install_on_RedHat.yml b/roles/monitoring_plugins/tasks/install_on_RedHat.yml index 95a6b9d9..f6baf6f5 100644 --- a/roles/monitoring_plugins/tasks/install_on_RedHat.yml +++ b/roles/monitoring_plugins/tasks/install_on_RedHat.yml @@ -14,7 +14,7 @@ when: - ansible_distribution_major_version < "8" - needed_packages is defined - - needed_packages + - needed_packages | length > 0 - name: Dnf - install requested packages become: yes @@ -26,7 +26,7 @@ when: - ansible_distribution_major_version >= "8" - needed_packages is defined - - needed_packages + - needed_packages | length > 0 - name: Yum - remove non-requested packages become: yes @@ -36,4 +36,4 @@ autoremove: "{{ icinga_monitoring_plugins_autoremove }}" when: - icinga_monitoring_plugins_remove - - unwanted_packages + - unwanted_packages | length > 0 diff --git a/roles/monitoring_plugins/tasks/install_on_Suse.yml b/roles/monitoring_plugins/tasks/install_on_Suse.yml index 56d9d3aa..c7290924 100644 --- a/roles/monitoring_plugins/tasks/install_on_Suse.yml +++ b/roles/monitoring_plugins/tasks/install_on_Suse.yml @@ -10,7 +10,7 @@ changed_when: zypper_result.stdout is defined when: - needed_packages is defined - - needed_packages + - needed_packages | length > 0 - name: Zypper - remove non-requested packages become: yes @@ -20,4 +20,4 @@ clean_deps: "{{ icinga_monitoring_plugins_autoremove }}" when: - icinga_monitoring_plugins_remove - - unwanted_packages + - unwanted_packages | length > 0