diff options
Diffstat (limited to 'tasks/main.yml')
-rw-r--r-- | tasks/main.yml | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tasks/main.yml b/tasks/main.yml index 2844315..b6213ba 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,18 +8,19 @@ dest: /etc/localtime state: link force: yes + when: ntp_enabled - name: Install NTP (RedHat). yum: name=ntp state=installed - when: ansible_os_family == 'RedHat' + when: ansible_os_family == 'RedHat' and ntp_enabled - name: Install NTP (Debian). apt: name=ntp state=installed - when: ansible_os_family == 'Debian' + when: ansible_os_family == 'Debian' and ntp_enabled - name: Install NTP (FreeBSD). pkgng: name=ntp state=present - when: ansible_os_family == 'FreeBSD' + when: ansible_os_family == 'FreeBSD' and ntp_enabled - name: Ensure NTP is running and enabled at system start. service: @@ -34,3 +35,8 @@ state: stopped enabled: no when: not ntp_enabled + +- name: Generate ntp.conf file + template: src=ntp.conf.j2 dest=/etc/ntp.conf + notify: restart ntp + when: ntp_enabled |