zen_ntp/tasks/main.yml
Chris Hammer 13bc52079c 0.1.51-DEV-20221007-1
---------------------
  * ADD:
    - support for centos 9 added
2022-10-07 14:20:28 -04:00

40 lines
832 B
YAML

---
# tasks file for zen_ntp
- name: set service name for debian if required
set_fact:
ntp_service: ntp
when: ansible_distribution == "Debian"
- name: set package and service for centos 8/9
set_fact:
ntp_pkg : chrony
ntp_service : chronyd
when:
- (ansible_distribution_major_version == "8" or
ansible_distribution_major_version == "9")
- name: install ntp if not present
package:
name : "{{ ntp_pkg | default('ntp') }}"
state : present
- name: deploy {{ ntp_conf_file }}
template:
src: templates/ntp_conf.j2
dest: "{{ ntp_conf_file }}"
mode: 0644
owner: root
group: root
notify: restart ntpd
- name: enable/start ntpd or chrony
service:
name: "{{ ntp_service }}"
enabled: yes
state: started
when: ansible_virtualization_type != "docker"