ansible-install-server/roles/fai/tasks/time-server.yml

78 lines
1.6 KiB
YAML

- name: install inetd
apt:
name: inetutils-tools
state: present
tags:
- time
- rdate
- name: activate rdate
copy:
content: |
time stream tcp nowait root internal
dest: /etc/inetd.conf
owner: root
group: root
mode: 0644
register: inetd_conf
tags:
- time
- rdate
- name: ensure inetd started
service:
name: inetutils-inetd
state: restarted
enabled: true
when: inetd_conf.changed
- name: install ntp server
apt:
name: ntp
state: present
- name: configure ntp server
copy:
content: |
driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
pool 0.debian.pool.ntp.org iburst
pool 1.debian.pool.ntp.org iburst
pool 2.debian.pool.ntp.org iburst
pool 3.debian.pool.ntp.org iburst
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict {{server_net}}.0/24
restrict ::1
restrict source notrap nomodify noquery
dest: /etc/ntp.conf
mode: 0644
owner: root
group: root
register: ntp_conf
- name: ntp is running and enabled
service:
name: ntp
state: started
enabled: true
- name: reload ntp config
systemd:
name: ntp
state: restarted
when: ntp_conf.changed