This repository has been archived by the owner on Jul 7, 2021. It is now read-only.
forked from bennojoy/ntp
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rene Moser
committed
Jan 9, 2014
1 parent
08fd372
commit e3c7930
Showing
9 changed files
with
78 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
--- | ||
npt_pkg_state: installed | ||
ntp_service_state: started | ||
ntp_service_enabled: yes | ||
|
||
ntp_driftfile: /var/lib/ntp/drift | ||
ntp_server: [0.ubuntu.pool.ntp.org, 1.ubuntu.pool.ntp.org] | ||
ntp_restrict: | ||
- "restrict -4 default kod notrap nomodify nopeer noquery" | ||
- "restrict -6 default kod notrap nomodify nopeer noquery" | ||
- "restrict 127.0.0.1" | ||
ntp_config_server: [0.pool.ntp.org, 1.pool.ntp.org, 2.pool.ntp.org, 3.pool.ntp.org] | ||
ntp_config_restrict: | ||
- "-4 default kod notrap nomodify nopeer noquery" | ||
- "-6 default kod notrap nomodify nopeer noquery" | ||
- "127.0.0.1" | ||
|
||
ntp_crypto: no | ||
ntp_includefile: no | ||
ntp_keys: no | ||
ntp_trustedkey: no | ||
ntp_requestkey: no | ||
ntp_controlkey: no | ||
ntp_statistics: no | ||
ntp_broadcast: no | ||
ntp_broadcastclient: no | ||
ntp_multicastclient: no | ||
ntp_config_filegen: | ||
- "loopstats file loopstats type day enable" | ||
- "peerstats file peerstats type day enable" | ||
- "clockstats file clockstats type day enable" | ||
|
||
ntp_config_statistics: "loopstats peerstats clockstats" | ||
|
||
ntp_config_crypto: no | ||
ntp_config_includefile: no | ||
ntp_config_keys: no | ||
ntp_config_trustedkey: no | ||
ntp_config_requestkey: no | ||
ntp_config_controlkey: no | ||
ntp_config_broadcast: no | ||
ntp_config_broadcastclient: no | ||
ntp_config_multicastclient: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
--- | ||
|
||
- name: restart ntp | ||
service: name={{ ntp_svc_name }} state=restarted enabled=yes | ||
|
||
service: name={{ ntp_service_name }} state=restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
--- | ||
|
||
- name: Add the OS specific varibles | ||
- name: Add the OS specific variables | ||
include_vars: "{{ ansible_os_family }}.yml" | ||
|
||
- name: Install the required packages in Redhat derivatives | ||
yum: name={{ item }} state=installed | ||
- name: Install the required packages in Redhat derivatives | ||
yum: name={{ item }} state={{ npt_pkg_state }} | ||
with_items: ntp_pkgs | ||
when: ansible_os_family == 'RedHat' | ||
|
||
- name: Install the required packages in Debian derivatives | ||
apt: name={{ item }} state=installed update_cache=yes | ||
apt: name={{ item }} state={{ npt_pkg_state }} update_cache=yes | ||
with_items: ntp_pkgs | ||
environment: env | ||
when: ansible_os_family == 'Debian' | ||
|
||
- name: Copy the ntp.conf template file | ||
template: src=ntp.conf.j2 dest=/etc/ntp.conf | ||
notify: | ||
- restart ntp | ||
- restart ntp | ||
|
||
|
||
- name: Start/stop ntp service | ||
service: name={{ ntp_service_name }} state={{ ntp_service_state }} enabled={{ ntp_service_enabled }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,55 @@ | ||
#{{ ansible_managed }} | ||
# {{ ansible_managed }} | ||
|
||
driftfile {{ ntp_driftfile }} | ||
{% for i in ntp_server %} | ||
server {{ i }} | ||
{% endfor %} | ||
driftfile {{ ntp_config_driftfile }} | ||
|
||
{% for i in ntp_restrict %} | ||
{{ i }} | ||
{% for server in ntp_config_server %} | ||
server {{ server }} | ||
{% endfor %} | ||
|
||
{% if ntp_crypto %} | ||
crypto | ||
{% if ntp_config_statistics %} | ||
statistics {{ ntp_config_statistics }} | ||
{% endif %} | ||
|
||
{% if ntp_includefile %} | ||
includefile {{ ntp_includefile }} | ||
{% for filegen in ntp_config_filegen %} | ||
filegen {{ filegen }} | ||
{% endfor %} | ||
|
||
{% for restrict in ntp_config_restrict %} | ||
restrict {{ restrict }} | ||
{% endfor %} | ||
|
||
{% if ntp_config_crypto %} | ||
crypto | ||
{% endif %} | ||
|
||
{% if ntp_keys %} | ||
keys {{ ntp_keys }} | ||
{% if ntp_config_includefile %} | ||
includefile {{ ntp_config_includefile }} | ||
{% endif %} | ||
|
||
{% if ntp_trustedkey %} | ||
trustedkey {{ ntp_trustedkey }} | ||
{% if ntp_config_keys %} | ||
keys {{ ntp_config_keys }} | ||
{% endif %} | ||
|
||
{% if ntp_requestkey %} | ||
requestkey {{ ntp_requestkey }} | ||
{% if ntp_config_trustedkey %} | ||
trustedkey {{ ntp_config_trustedkey }} | ||
{% endif %} | ||
|
||
{% if ntp_controlkey %} | ||
controlkey {{ ntp_controlkey }} | ||
{% if ntp_config_requestkey %} | ||
requestkey {{ ntp_config_requestkey }} | ||
{% endif %} | ||
|
||
{% if ntp_statistics %} | ||
statistics {{ ntp_statistics }} | ||
{% if ntp_config_controlkey %} | ||
controlkey {{ ntp_config_controlkey }} | ||
{% endif %} | ||
|
||
{% if ntp_broadcast %} | ||
broadcast {{ ntp_broadcast }} | ||
{% if ntp_config_broadcast %} | ||
broadcast {{ ntp_config_broadcast }} | ||
{% endif %} | ||
|
||
{% if ntp_broadcastclient %} | ||
{% if ntp_config_broadcastclient %} | ||
broadcastclient | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% if ntp_multicastclient %} | ||
multicastclient {{ ntp_multicastclient }} | ||
{% endif %} | ||
{% if ntp_config_multicastclient %} | ||
multicastclient {{ ntp_config_multicastclient }} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
ntp_pkgs: | ||
- python-selinux | ||
- ntp | ||
- ntp | ||
|
||
ntp_service_name: ntp | ||
ntp_config_driftfile: /var/lib/ntp/ntp.drift | ||
|
||
ntp_svc_name: ntp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
ntp_pkgs: | ||
- libselinux-python | ||
- ntp | ||
- ntp | ||
|
||
ntp_svc_name: ntpd | ||
ntp_service_name: ntpd | ||
ntp_config_driftfile: /var/lib/ntp/drift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
--- | ||
env: | ||
RUNLEVEL: 1 | ||
|