Closed Nuttymoon closed 2 years ago
Force pushed to add legacy: authconfig
and modern: authselect
It would be better if you check only if the package firewalld
is installed instead of listing all installed packages but I don't know if this is possible and keep it simple.
It would be better if you check only if the package
firewalld
is installed instead of listing all installed packages but I don't know if this is possible and keep it simple.
I think using module package
with state: present
in check mode should do the trick:
- name: "Check if listed package is installed"
package:
name: "{{ item }}"
state: present
check_mode: true
loop: "{{ package_names }}"
register: package_check
- name: "Print execution results"
debug:
msg: "Package is installed"
when: package_check is succeeded
Source: https://techviewleo.com/ansible-check-if-software-package-is-installed/
If the package is not installed, it will display changed
which is bad.
If the package is not installed, it will display
changed
which is bad.
We just need to use state: absent
, and check if the check succeeded or if it changed no ?
I find it way harder to understand the logic based on the changed
status of:
- name: Check if firewalld is installed
yum:
name: firewalld
state: absent
check_mode: yes
register: yum_firewalld
than just checking if firewalld
is in the list of installed packages.
Which issue(s) this PR fixes:
Fixes #29
Additional comments:
To make clear that you license your contribution under the Apache License Version 2.0, January 2004 and that you give permission to TOSIT, you have to acknowledge this by using the following check-box.
[x] I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
[x] I hereby agree to grant TOSIT a copyright license to use my contributions.