2020-10-23 19:03:23 +02:00
|
|
|
|
---
|
|
|
|
|
- name: Install OpenNTPD
|
|
|
|
|
package:
|
|
|
|
|
name: openntpd
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Add /var/log/openntpd to fstab
|
|
|
|
|
mount:
|
|
|
|
|
path: /var/log/openntpd
|
|
|
|
|
src: tmpfs
|
|
|
|
|
fstype: tmpfs
|
|
|
|
|
opts: 'rw,size={{ openntpd_log_size }},mode={{ openntpd_log_mode }},uid={{ openntpd_log_uid }},gid={{ openntpd_log_gid }},late'
|
|
|
|
|
state: mounted
|
|
|
|
|
|
|
|
|
|
- name: Create OpenNTPD service directories
|
|
|
|
|
file:
|
2022-07-04 02:49:53 +02:00
|
|
|
|
path: '{{ s6_etc_dir }}/service/{{ item }}'
|
2020-10-23 19:03:23 +02:00
|
|
|
|
state: directory
|
|
|
|
|
owner: root
|
|
|
|
|
group: wheel
|
|
|
|
|
mode: 0755
|
|
|
|
|
with_items: '{{ openntpd_service_dirs }}'
|
|
|
|
|
notify:
|
|
|
|
|
- Reload s6-rc
|
|
|
|
|
- Restart OpenNTPD log
|
|
|
|
|
- Restart OpenNTPD
|
|
|
|
|
|
|
|
|
|
- name: Generate OpenNTPD service scripts
|
|
|
|
|
template:
|
2022-07-04 02:49:53 +02:00
|
|
|
|
dest: '{{ s6_etc_dir }}/service/{{ item }}'
|
2020-10-23 19:03:23 +02:00
|
|
|
|
src: '{{ item }}.j2'
|
|
|
|
|
mode: 0555
|
|
|
|
|
owner: root
|
|
|
|
|
group: wheel
|
|
|
|
|
with_items: '{{ openntpd_service_scripts }}'
|
|
|
|
|
notify:
|
|
|
|
|
- Reload s6-rc
|
|
|
|
|
- Restart OpenNTPD log
|
|
|
|
|
- Restart OpenNTPD
|
|
|
|
|
|
|
|
|
|
- name: Generate OpenNTPD service configuration
|
|
|
|
|
copy:
|
2022-07-04 02:49:53 +02:00
|
|
|
|
dest: '{{ s6_etc_dir }}/service/{{ item.name }}'
|
2020-10-23 19:03:23 +02:00
|
|
|
|
content: '{{ item.content }}'
|
|
|
|
|
mode: 0444
|
|
|
|
|
owner: root
|
|
|
|
|
group: wheel
|
|
|
|
|
loop_control:
|
|
|
|
|
label: '{{ item.name }} = {{ item.content }}'
|
|
|
|
|
notify:
|
|
|
|
|
- Reload s6-rc
|
|
|
|
|
- Restart OpenNTPD log
|
|
|
|
|
- Restart OpenNTPD
|
|
|
|
|
with_items: '{{ openntpd_service_config }}'
|
|
|
|
|
|
|
|
|
|
- name: Configure OpenNTPD
|
|
|
|
|
template:
|
|
|
|
|
dest: /usr/local/etc/ntpd.conf
|
|
|
|
|
src: ntpd.conf.j2
|
|
|
|
|
mode: 0444
|
|
|
|
|
owner: root
|
|
|
|
|
group: wheel
|
|
|
|
|
notify:
|
|
|
|
|
- Restart OpenNTPD
|
|
|
|
|
|
|
|
|
|
- name: Flush handlers
|
|
|
|
|
meta: flush_handlers
|
|
|
|
|
|
|
|
|
|
- name: Start OpenNTPD
|
2022-07-04 02:49:53 +02:00
|
|
|
|
command: fdmove -c 2 1 s6-rc -l {{ s6_live_dir }} -u -v 2 -t 15000 change openntpd
|
2020-10-23 19:03:23 +02:00
|
|
|
|
register: change
|
|
|
|
|
changed_when: change.stdout | length > 0
|
|
|
|
|
|
|
|
|
|
- name: Enable OpenNTPD
|
|
|
|
|
lineinfile:
|
2022-07-04 02:49:53 +02:00
|
|
|
|
path: '{{ s6_etc_dir }}/service/enabled/contents'
|
2020-10-23 19:03:23 +02:00
|
|
|
|
regexp: "^openntpd$"
|
|
|
|
|
line: openntpd
|
|
|
|
|
state: present
|
|
|
|
|
notify:
|
|
|
|
|
- Reload s6-rc
|
|
|
|
|
|
|
|
|
|
- name: Flush handlers (again)
|
|
|
|
|
meta: flush_handlers
|