From e1a7097a3d5aa3d0032499bb17dfcdeb24e715dd Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 1 Aug 2024 14:11:20 +0200 Subject: [PATCH] Fix the install check of the EL related tasks. --- tasks/ntp-el.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tasks/ntp-el.yml b/tasks/ntp-el.yml index 502932a..e2320fe 100644 --- a/tasks/ntp-el.yml +++ b/tasks/ntp-el.yml @@ -1,5 +1,9 @@ --- - name: ntp-el | Manage the NTP service in the EL distributions + when: + - ansible_distribution_major_version is version_compare('7', '<=') + - ntp_service_enabled + tags: [ 'packages', 'ntp' ] block: - name: ntp-el | Install the ntpd server on CentOS <= 7 yum: pkg=ntp state=present @@ -23,19 +27,14 @@ when: firewalld_enabled tags: [ 'packages', 'ntp', 'firewall', 'iptables_rules' ] - when: - - ansible_distribution_major_version is version_compare('7', '<=') - - ntp_service_install - tags: [ 'packages', 'ntp' ] - - name: ntp-el | Manage the NTP service in the EL distributions + when: + - ansible_distribution_major_version is version_compare('8', '>=') + - ntp_service_enabled + tags: [ 'packages', 'ntp' ] block: - name: ntp-el |Install the Chrony server on CentOS >= 8 ansible.builtin.dnf: pkg: chrony state: present - when: - - ansible_distribution_major_version is version_compare('8', '>=') - - ntp_service_install - tags: [ 'packages', 'ntp' ]