mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-06-23 09:14:43 +00:00
ipaclient: Support sync_time changes of 4.8.0
sync_time is not using options anymore, but has two new arguments. These are ntp_servers and ntp_pool. The options argument is not used anymore. This requires to use inspect on sync_time to be able to detect if the old or the new function is available. The call for get_time_source has been added, but is documented out as the call is only useful in interactive mode. ipaclient_test now returns ntp_servers and ntp_pool, which are then used for ipaclient_setup_ntp.
This commit is contained in:
@@ -124,6 +124,11 @@ def main():
|
|||||||
if sync_time is not None:
|
if sync_time is not None:
|
||||||
if options.conf_ntp:
|
if options.conf_ntp:
|
||||||
# Attempt to configure and sync time with NTP server (chrony).
|
# Attempt to configure and sync time with NTP server (chrony).
|
||||||
|
argspec = inspect.getargspec(sync_time)
|
||||||
|
if "options" not in argspec.args:
|
||||||
|
synced_ntp = sync_time(options.ntp_servers, options.ntp_pool,
|
||||||
|
fstore, statestore)
|
||||||
|
else:
|
||||||
synced_ntp = sync_time(options, fstore, statestore)
|
synced_ntp = sync_time(options, fstore, statestore)
|
||||||
elif options.on_master:
|
elif options.on_master:
|
||||||
# If we're on master skipping the time sync here because it was done
|
# If we're on master skipping the time sync here because it was done
|
||||||
|
|||||||
@@ -492,9 +492,10 @@ def main():
|
|||||||
try:
|
try:
|
||||||
timeconf.check_timedate_services()
|
timeconf.check_timedate_services()
|
||||||
except timeconf.NTPConflictingService as e:
|
except timeconf.NTPConflictingService as e:
|
||||||
logger.info("WARNING: conflicting time&date synchronization service '{}'"
|
logger.info(
|
||||||
" will be disabled".format(e.conflicting_service))
|
"WARNING: conflicting time&date synchronization service "
|
||||||
logger.info("in favor of chronyd")
|
"'%s' will be disabled in favor of chronyd" % \
|
||||||
|
e.conflicting_service)
|
||||||
logger.info("")
|
logger.info("")
|
||||||
except timeconf.NTPConfigurationError:
|
except timeconf.NTPConfigurationError:
|
||||||
pass
|
pass
|
||||||
@@ -800,6 +801,13 @@ def main():
|
|||||||
# "Proceed with fixed values and no DNS discovery?", False):
|
# "Proceed with fixed values and no DNS discovery?", False):
|
||||||
# raise ScriptError(rval=CLIENT_INSTALL_ERROR)
|
# raise ScriptError(rval=CLIENT_INSTALL_ERROR)
|
||||||
|
|
||||||
|
# Do not ask for time source
|
||||||
|
#if options.conf_ntp:
|
||||||
|
# if not options.on_master and not options.unattended and not (
|
||||||
|
# options.ntp_servers or options.ntp_pool):
|
||||||
|
# options.ntp_servers, options.ntp_pool = \
|
||||||
|
# timeconf.get_time_source()
|
||||||
|
|
||||||
cli_realm = ds.realm
|
cli_realm = ds.realm
|
||||||
cli_realm_source = ds.realm_source
|
cli_realm_source = ds.realm_source
|
||||||
logger.debug("will use discovered realm: %s", cli_realm)
|
logger.debug("will use discovered realm: %s", cli_realm)
|
||||||
@@ -829,6 +837,14 @@ def main():
|
|||||||
logger.info("BaseDN: %s", cli_basedn)
|
logger.info("BaseDN: %s", cli_basedn)
|
||||||
logger.debug("BaseDN source: %s", cli_basedn_source)
|
logger.debug("BaseDN source: %s", cli_basedn_source)
|
||||||
|
|
||||||
|
if not options.on_master:
|
||||||
|
if options.ntp_servers:
|
||||||
|
for server in options.ntp_servers:
|
||||||
|
logger.info("NTP server: %s", server)
|
||||||
|
|
||||||
|
if options.ntp_pool:
|
||||||
|
logger.info("NTP pool: %s", options.ntp_pool)
|
||||||
|
|
||||||
# ipa-join would fail with IP address instead of a FQDN
|
# ipa-join would fail with IP address instead of a FQDN
|
||||||
for srv in cli_server:
|
for srv in cli_server:
|
||||||
try:
|
try:
|
||||||
@@ -894,6 +910,8 @@ def main():
|
|||||||
client_domain=client_domain,
|
client_domain=client_domain,
|
||||||
dnsok=dnsok,
|
dnsok=dnsok,
|
||||||
sssd=options.sssd,
|
sssd=options.sssd,
|
||||||
|
ntp_servers=options.ntp_servers,
|
||||||
|
ntp_pool=options.ntp_pool,
|
||||||
client_already_configured=client_already_configured,
|
client_already_configured=client_already_configured,
|
||||||
ipa_python_version=IPA_PYTHON_VERSION)
|
ipa_python_version=IPA_PYTHON_VERSION)
|
||||||
|
|
||||||
|
|||||||
@@ -63,8 +63,8 @@
|
|||||||
- name: Install - Configure NTP
|
- name: Install - Configure NTP
|
||||||
ipaclient_setup_ntp:
|
ipaclient_setup_ntp:
|
||||||
### basic ###
|
### basic ###
|
||||||
ntp_servers: "{{ ipaclient_ntp_servers | default(omit) }}"
|
ntp_servers: "{{ result_ipaclient_test.ntp_servers | default(omit) }}"
|
||||||
ntp_pool: "{{ ipaclient_ntp_pool | default(omit) }}"
|
ntp_pool: "{{ result_ipaclient_test.ntp_pool | default(omit) }}"
|
||||||
no_ntp: "{{ ipaclient_no_ntp }}"
|
no_ntp: "{{ ipaclient_no_ntp }}"
|
||||||
# force_ntpd: "{{ ipaclient_force_ntpd }}"
|
# force_ntpd: "{{ ipaclient_force_ntpd }}"
|
||||||
on_master: "{{ ipaclient_on_master }}"
|
on_master: "{{ ipaclient_on_master }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user