diff --git a/tasks/RedHat-register.yml b/tasks/RedHat-register.yml index 3e8a37a..4b0d0c8 100644 --- a/tasks/RedHat-register.yml +++ b/tasks/RedHat-register.yml @@ -19,8 +19,26 @@ package_facts: manager: "auto" tags: cmk_register + + - name: Check if dnf package manager is installed + command: which dnf + register: dnf_check + ignore_errors: yes - - name: Ensure check_mk_agent installed (again) + - name: Ensure check_mk_agent installed (again) with dnf + package: + name: /tmp/check-mk-agent.rpm + state: latest + disable_gpg_check: true + notify: + - restart xinetd + - ensure firewall open + when: + - "'check-mk-agent' not in ansible_facts.packages" + - dnf_check.rc == 0 + tags: cmk_register + + - name: Ensure check_mk_agent installed (again) with yum package: name: /tmp/check-mk-agent.rpm state: latest @@ -28,7 +46,9 @@ notify: - restart xinetd - ensure firewall open - when: "'check-mk-agent' not in ansible_facts.packages" + when: + - "'check-mk-agent' not in ansible_facts.packages" + - dnf_check.rc != 0 tags: cmk_register - name: Gather facts of packages (again)