Small improvemnts, distribution independent
This commit is contained in:
parent
89c7381ef2
commit
6ea3305c93
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
- name: Restart NTP
|
||||
service:
|
||||
name: ntp
|
||||
name: '{{ ntp_service_name }}'
|
||||
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
|
||||
include_vars: "vars/timesync_{{ ansible_default_ipv4.network }}.yml"
|
||||
when: ansible_default_ipv4 and timesync_servers is not defined
|
||||
|
@ -10,11 +16,13 @@
|
|||
when: timesync_servers is not defined
|
||||
|
||||
|
||||
- include_tasks: timesync_timesyncd.yml
|
||||
when: timesync_daemon == "timesyncd"
|
||||
- name: Include OS dependent variables
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "os_{{ (ansible_os_family|lower).split(' ')[0] }}.yml"
|
||||
- "os_defaut.yml"
|
||||
|
||||
|
||||
- include_tasks: timesync_ntp.yml
|
||||
when: timesync_daemon not in ["timesyncd", ]
|
||||
- include_tasks: "timesync_{{ timesync_daemon }}.yml"
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ filegen peerstats file peerstats type day enable
|
|||
filegen clockstats file clockstats type day enable
|
||||
|
||||
# NTP server pool
|
||||
{% for server in timesync_servers %}server {{ server }} iburst
|
||||
{% for server in timesync_servers|default(["pool.ntp.org"]) %}server {{ server }} iburst
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
# See timesyncd.conf(5) for details.
|
||||
|
||||
[Time]
|
||||
NTP={% for server in timesync_servers %}{{ server }} {% endfor %}
|
||||
{% if timesync_servers_fallback|default([]) %}FallbackNTP={% for server in timesync_servers_fallback %}{{ server }} {% endfor %}
|
||||
NTP={{ timesync_servers|default([])|join(' ') }}
|
||||
{% if timesync_servers_fallback|default([]) %}FallbackNTP={{ timesync_servers_fallback|join(' ') }}
|
||||
{% else %}#FallbackNTP=
|
||||
{% 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