ntp: Initial PB and role to set up ntpd

jenkins-master
Dustin 2018-04-22 11:19:22 -05:00
parent 20507d4e13
commit 424275fc57
6 changed files with 92 additions and 0 deletions

2
hosts
View File

@ -58,3 +58,5 @@ smtp0.pyrocufflink.blue
[smtp-relay:children]
zabbix-server
[ntpd]

3
ntp.yml Normal file
View File

@ -0,0 +1,3 @@
- hosts: ntpd
roles:
- ntpd

View File

@ -0,0 +1,2 @@
- name: save firewalld configuration
command: firewall-cmd --runtime-to-permanent

34
roles/ntpd/tasks/main.yml Normal file
View File

@ -0,0 +1,34 @@
- name: load distribution-specific values
include_vars: '{{ item }}'
with_first_found:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- defaults.yml
- name: ensure ntpd is installed
package:
name={{ ntpd_required_packages|join(',') }}
state=present
tags:
- install
- name: ensure ntpd starts at boot
service:
name={{ ntpd_svc }}
enabled=yes
- meta: flush_handlers
- name: ensure ntpd is running
service:
name={{ ntpd_svc }}
state=started
- name: ensure ntpd is allowed in the firewall
firewalld:
service=ntp
state=enabled
permanent=no
immediate=yes
notify: save firewalld configuration
tags:
- firewalld

View File

@ -0,0 +1,48 @@
# For more information about this file, see the ntp.conf(5) man page.
# Record the frequency of the system clock.
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noepeer noquery
# Permit association with pool servers.
restrict source nomodify notrap noepeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
pool 2.fedora.pool.ntp.org iburst
# Reduce the maximum number of servers used from the pool.
tos maxclock 5
# Enable public key cryptography.
#crypto
includefile /etc/ntp/crypto/pw
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats

View File

@ -0,0 +1,3 @@
ntpd_required_packages:
- ntp
ntpd_svc: ntpd