Add busybox' ntpd as timesync server (e.g. Alpine)
This commit is contained in:
parent
cb9f61ccf7
commit
6aa7cae716
|
@ -2,7 +2,7 @@
|
|||
- name: Check selected timesync daemon
|
||||
fail:
|
||||
fail_msg: "{{ timesync_daemon|default('No daemon') }} not supported"
|
||||
when: timesync_daemon not in [ "chrony", "ntp", "timesyncd" ]
|
||||
when: timesync_daemon not in [ "busybox-ntp", "chrony", "ntp", "timesyncd" ]
|
||||
|
||||
|
||||
- name: Include each network variables if there is no host variable
|
||||
|
|
25
roles/timesync-enabled/tasks/timesync_busybox-ntp.yml
Normal file
25
roles/timesync-enabled/tasks/timesync_busybox-ntp.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
- name: Template ntp.conf
|
||||
template:
|
||||
src: etc/busybox-ntp.conf.j2
|
||||
dest: /etc/ntp.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
backup: yes
|
||||
notify: Restart NTP
|
||||
|
||||
|
||||
- name: Remove server from command line
|
||||
replace:
|
||||
path: /etc/conf.d/ntpd
|
||||
regexp: '\s?-p\s*[^ "]+'
|
||||
replace: ''
|
||||
|
||||
|
||||
- name: Enable NTP daemon
|
||||
service:
|
||||
name: '{{ ntp_service_name }}'
|
||||
enabled: True
|
||||
|
||||
|
9
roles/timesync-enabled/templates/etc/busybox-ntp.conf.j2
Normal file
9
roles/timesync-enabled/templates/etc/busybox-ntp.conf.j2
Normal file
|
@ -0,0 +1,9 @@
|
|||
### {{ ansible_managed }}
|
||||
|
||||
# /etc/ntp.conf for Busybox ntpd
|
||||
|
||||
{% for server in timesync_pools|default([]) %}server {{ server }}
|
||||
{% endfor %}
|
||||
{% for server in timesync_servers|default([]) %}server {{ server }}
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in a new issue