Add support for ntpsec (#11665)
* Add support for ntpsec * fixup: set default ntp_driftfile based on ntp_package * fixup: docsmaster
parent
faeb114c31
commit
9d6344aac7
|
@ -48,3 +48,9 @@ Force sync time immediately by NTP after the ntp installed, which is useful in n
|
||||||
```ShellSession
|
```ShellSession
|
||||||
ntp_force_sync_immediately: true
|
ntp_force_sync_immediately: true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When using Ubuntu 24.04 or a distribution that already has `systemd-timesyncd` installed, use the `ntpsec` package.
|
||||||
|
|
||||||
|
```ShellSession
|
||||||
|
ntp_package: ntpsec
|
||||||
|
```
|
||||||
|
|
|
@ -64,7 +64,7 @@ ping_access_ip: true
|
||||||
ntp_enabled: false
|
ntp_enabled: false
|
||||||
# The package to install which provides NTP functionality.
|
# The package to install which provides NTP functionality.
|
||||||
# The default is ntp for most platforms, or chrony on RHEL/CentOS 7 and later.
|
# The default is ntp for most platforms, or chrony on RHEL/CentOS 7 and later.
|
||||||
# The ntp_package can be one of ['ntp', 'chrony']
|
# The ntp_package can be one of ['ntp', 'ntpsec', 'chrony']
|
||||||
ntp_package: >-
|
ntp_package: >-
|
||||||
{% if ansible_os_family == "RedHat" -%}
|
{% if ansible_os_family == "RedHat" -%}
|
||||||
chrony
|
chrony
|
||||||
|
@ -95,8 +95,13 @@ ntp_filter_interface: false
|
||||||
# - listen xxx
|
# - listen xxx
|
||||||
# The NTP driftfile path
|
# The NTP driftfile path
|
||||||
# Only takes effect when ntp_manage_config is true.
|
# Only takes effect when ntp_manage_config is true.
|
||||||
ntp_driftfile: /var/lib/ntp/ntp.drift
|
# Default value is `/var/lib/ntp/ntp.drift`, for ntpsec use '/var/lib/ntpsec/ntp.drift'
|
||||||
# Enable tinker panic is useful when running NTP in a VM environment.
|
ntp_driftfile: >-
|
||||||
|
{% if ntp_package == "ntpsec" -%}
|
||||||
|
/var/lib/ntpsec/ntp.drift
|
||||||
|
{%- else -%}
|
||||||
|
/var/lib/ntp/ntp.drift
|
||||||
|
{%- endif -%}
|
||||||
# Only takes effect when ntp_manage_config is true.
|
# Only takes effect when ntp_manage_config is true.
|
||||||
ntp_tinker_panic: false
|
ntp_tinker_panic: false
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
ntp_config_file: >-
|
ntp_config_file: >-
|
||||||
{% if ntp_package == "ntp" -%}
|
{% if ntp_package == "ntp" -%}
|
||||||
/etc/ntp.conf
|
/etc/ntp.conf
|
||||||
|
{%- elif ntp_package == "ntpsec" -%}
|
||||||
|
/etc/ntpsec/ntp.conf
|
||||||
{%- elif ansible_os_family in ['RedHat', 'Suse'] -%}
|
{%- elif ansible_os_family in ['RedHat', 'Suse'] -%}
|
||||||
/etc/chrony.conf
|
/etc/chrony.conf
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
|
@ -56,10 +58,10 @@
|
||||||
# noqa: jinja[spacing]
|
# noqa: jinja[spacing]
|
||||||
command: >-
|
command: >-
|
||||||
timeout -k 60s 60s
|
timeout -k 60s 60s
|
||||||
{% if ntp_package == "ntp" -%}
|
{% if ntp_package == "chrony" -%}
|
||||||
ntpd -gq
|
|
||||||
{%- else -%}
|
|
||||||
chronyd -q
|
chronyd -q
|
||||||
|
{%- else -%}
|
||||||
|
ntpd -gq
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
when:
|
when:
|
||||||
- ntp_force_sync_immediately
|
- ntp_force_sync_immediately
|
||||||
|
|
Loading…
Reference in New Issue