From df7f9eb615cf94cb6ba0163c361fc4bdb7956f72 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Fri, 17 Jul 2015 21:20:31 -0500 Subject: Fixed documentation and linux distro information. --- tasks/main.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'tasks') diff --git a/tasks/main.yml b/tasks/main.yml index b71ac16..2844315 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,7 +3,11 @@ include_vars: "{{ ansible_os_family }}.yml" - name: Set the correct timezone. - file: src=/usr/share/zoneinfo/{{ ntp_timezone }} dest=/etc/localtime state=link force=yes + file: + src: "/usr/share/zoneinfo/{{ ntp_timezone }}" + dest: /etc/localtime + state: link + force: yes - name: Install NTP (RedHat). yum: name=ntp state=installed @@ -18,15 +22,15 @@ when: ansible_os_family == 'FreeBSD' - name: Ensure NTP is running and enabled at system start. - service: > - name={{ ntp_daemon }} - state=started - enabled=yes + service: + name: "{{ ntp_daemon }}" + state: started + enabled: yes when: ntp_enabled - name: Ensure NTP is stopped and disabled at system start. - service: > - name={{ ntp_daemon }} - state=stopped - enabled=no + service: + name: "{{ ntp_daemon }}" + state: stopped + enabled: no when: not ntp_enabled -- cgit v1.2.3 From 567078d7c3ac7190d6748f0cfcd535e82912a12b Mon Sep 17 00:00:00 2001 From: kadecole Date: Thu, 18 Jun 2015 00:23:06 -0500 Subject: Add a managed ntp.conf template. --- tasks/main.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tasks') 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 -- cgit v1.2.3 From 9c0a3ce4ff0c8bc00dbb8497193c2fc5f015c5aa Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 3 Mar 2016 22:45:52 -0600 Subject: NTP configuration cleanup and add documentation for new vars. --- tasks/main.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'tasks') diff --git a/tasks/main.yml b/tasks/main.yml index b6213ba..6a58382 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,28 +8,27 @@ dest: /etc/localtime state: link force: yes - when: ntp_enabled - name: Install NTP (RedHat). yum: name=ntp state=installed - when: ansible_os_family == 'RedHat' and ntp_enabled + when: ansible_os_family == 'RedHat' - name: Install NTP (Debian). apt: name=ntp state=installed - when: ansible_os_family == 'Debian' and ntp_enabled + when: ansible_os_family == 'Debian' - name: Install NTP (FreeBSD). pkgng: name=ntp state=present - when: ansible_os_family == 'FreeBSD' and ntp_enabled + when: ansible_os_family == 'FreeBSD' -- name: Ensure NTP is running and enabled at system start. +- name: Ensure NTP is running and enabled as configured. service: name: "{{ ntp_daemon }}" state: started enabled: yes when: ntp_enabled -- name: Ensure NTP is stopped and disabled at system start. +- name: Ensure NTP is stopped and disabled as configured. service: name: "{{ ntp_daemon }}" state: stopped @@ -39,4 +38,4 @@ - name: Generate ntp.conf file template: src=ntp.conf.j2 dest=/etc/ntp.conf notify: restart ntp - when: ntp_enabled + when: ntp_manage_config -- cgit v1.2.3