Small improvemnts, distribution independent
This commit is contained in:
parent
89c7381ef2
commit
6ea3305c93
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: Restart NTP
|
- name: Restart NTP
|
||||||
service:
|
service:
|
||||||
name: ntp
|
name: '{{ ntp_service_name }}'
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
---
|
---
|
||||||
|
- name: Check selected timesync daemon
|
||||||
|
fail:
|
||||||
|
fail_msg: "{{ timesync_daemon|default('No daemon') }} not supported"
|
||||||
|
when: timesync_daemon not in [ "ntp", "timesyncd" ]
|
||||||
|
|
||||||
|
|
||||||
- name: Include each network variables if there is no host variable
|
- name: Include each network variables if there is no host variable
|
||||||
include_vars: "vars/timesync_{{ ansible_default_ipv4.network }}.yml"
|
include_vars: "vars/timesync_{{ ansible_default_ipv4.network }}.yml"
|
||||||
when: ansible_default_ipv4 and timesync_servers is not defined
|
when: ansible_default_ipv4 and timesync_servers is not defined
|
||||||
|
@ -10,11 +16,13 @@
|
||||||
when: timesync_servers is not defined
|
when: timesync_servers is not defined
|
||||||
|
|
||||||
|
|
||||||
- include_tasks: timesync_timesyncd.yml
|
- name: Include OS dependent variables
|
||||||
when: timesync_daemon == "timesyncd"
|
include_vars: "{{ item }}"
|
||||||
|
with_first_found:
|
||||||
|
- "os_{{ (ansible_os_family|lower).split(' ')[0] }}.yml"
|
||||||
|
- "os_defaut.yml"
|
||||||
|
|
||||||
|
|
||||||
- include_tasks: timesync_ntp.yml
|
- include_tasks: "timesync_{{ timesync_daemon }}.yml"
|
||||||
when: timesync_daemon not in ["timesyncd", ]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ filegen peerstats file peerstats type day enable
|
||||||
filegen clockstats file clockstats type day enable
|
filegen clockstats file clockstats type day enable
|
||||||
|
|
||||||
# NTP server pool
|
# NTP server pool
|
||||||
{% for server in timesync_servers %}server {{ server }} iburst
|
{% for server in timesync_servers|default(["pool.ntp.org"]) %}server {{ server }} iburst
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
# See timesyncd.conf(5) for details.
|
# See timesyncd.conf(5) for details.
|
||||||
|
|
||||||
[Time]
|
[Time]
|
||||||
NTP={% for server in timesync_servers %}{{ server }} {% endfor %}
|
NTP={{ timesync_servers|default([])|join(' ') }}
|
||||||
{% if timesync_servers_fallback|default([]) %}FallbackNTP={% for server in timesync_servers_fallback %}{{ server }} {% endfor %}
|
{% if timesync_servers_fallback|default([]) %}FallbackNTP={{ timesync_servers_fallback|join(' ') }}
|
||||||
{% else %}#FallbackNTP=
|
{% else %}#FallbackNTP=
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
3
roles/timesync-enabled/vars/os_debian.yml
Normal file
3
roles/timesync-enabled/vars/os_debian.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
ntp_service_name: ntp
|
||||||
|
|
3
roles/timesync-enabled/vars/os_default.yml
Normal file
3
roles/timesync-enabled/vars/os_default.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
ntp_service_name: ntpd
|
||||||
|
|
1
roles/timesync-enabled/vars/os_devuan.yml
Symbolic link
1
roles/timesync-enabled/vars/os_devuan.yml
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
os_debian.yml
|
Loading…
Reference in a new issue