EL >= 8 uses chrony and not ntp.

This commit is contained in:
Andrea Dell'Amico 2021-12-03 12:57:58 +01:00
parent 6ca0e0df06
commit f8e0d513ab
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
2 changed files with 22 additions and 4 deletions

View File

@ -1,5 +1,6 @@
--- ---
ntp_service_enabled: True ntp_service_install: True
ntp_service_enabled: '{{ ntp_service_install }}'
ntp_statistics_enabled: False ntp_statistics_enabled: False
ntp_allow_external_clients: False ntp_allow_external_clients: False

View File

@ -15,11 +15,13 @@
service: name=ntp state=stopped enabled=no service: name=ntp state=stopped enabled=no
when: not ntp_service_enabled | bool when: not ntp_service_enabled | bool
when: ansible_distribution_file_variety == "Debian" when:
- ansible_distribution_file_variety == "Debian"
- ntp_service_install
tags: [ 'packages', 'ntp' ] tags: [ 'packages', 'ntp' ]
- block: - block:
- name: Install the ntpd server - name: Install the ntpd server on CentOS <= 7
yum: pkg=ntp state=present yum: pkg=ntp state=present
- name: Install the ntp configuration. - name: Install the ntp configuration.
@ -39,5 +41,20 @@
when: firewalld_enabled | bool when: firewalld_enabled | bool
tags: [ 'packages', 'ntp', 'firewall', 'iptables_rules' ] tags: [ 'packages', 'ntp', 'firewall', 'iptables_rules' ]
when: ansible_distribution_file_variety == "RedHat" when:
- ansible_distribution_file_variety == "RedHat"
- ansible_distribution_major_version <= 7
- ntp_service_install
tags: [ 'packages', 'ntp' ]
- block:
- name: Install the ntpd server on CentOS >= 8
ansible.builtin.dnf:
pkg: chrony
state: present
when:
- ansible_distribution_file_variety == "RedHat"
- ansible_distribution_major_version >= 8
- ntp_service_install
tags: [ 'packages', 'ntp' ] tags: [ 'packages', 'ntp' ]