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

78 lines
1.7 KiB
YAML
Raw Normal View History

2020-08-26 10:10:36 +00:00
- name: install inetd
2020-10-14 22:20:05 +00:00
package:
2020-08-26 10:10:36 +00:00
name: inetutils-tools
state: present
- name: activate rdate
copy:
content: |
time stream tcp nowait root internal
dest: /etc/inetd.conf
owner: root
group: root
2020-10-14 22:20:05 +00:00
mode: u=rw,g=r,o=r
2020-08-26 10:10:36 +00:00
register: inetd_conf
2020-10-14 22:20:05 +00:00
- name: ensure inetd is started
service:
2020-10-14 22:20:05 +00:00
name: inetd
state: started
enabled: true
2020-08-26 10:10:36 +00:00
when: inetd_conf.changed
2020-10-14 22:20:05 +00:00
- name: ensure inetd is refreshed, when config changed
service:
name: inetd
state: restarted
when: inetd_conf.changed
2020-08-26 10:10:36 +00:00
- name: install ntp server
2020-10-14 22:20:05 +00:00
package:
2020-08-26 10:10:36 +00:00
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
2020-08-26 10:10:36 +00:00
- name: reload ntp config
2020-10-14 22:20:05 +00:00
service:
2020-08-26 10:10:36 +00:00
name: ntp
state: restarted
when: ntp_conf.changed