|
275 | 275 | check_domain_level_is_supported, errors, ScriptError, setup_logging,
|
276 | 276 | logger, check_dns_resolution, service, find_providing_server, ca, kra,
|
277 | 277 | dns, no_matching_interface_for_ip_address_warning, adtrust,
|
278 |
| - constants, api, redirect_stdout, replica_conn_check, tasks |
| 278 | + constants, api, redirect_stdout, replica_conn_check, tasks, |
| 279 | + is_ipa_client_configured, install_ca_cert, |
279 | 280 | )
|
280 | 281 | from ansible.module_utils import six
|
281 | 282 |
|
@@ -601,10 +602,20 @@ def main():
|
601 | 602 | ansible_log.debug("-- CA_CRT --")
|
602 | 603 |
|
603 | 604 | cafile = paths.IPA_CA_CRT
|
604 |
| - if not os.path.isfile(cafile): |
605 |
| - ansible_module.fail_json( |
606 |
| - msg="CA cert file is not available! Please reinstall" |
607 |
| - "the client and try again.") |
| 605 | + if install_ca_cert is not None: |
| 606 | + if not os.path.isfile(cafile): |
| 607 | + ansible_module.fail_json( |
| 608 | + msg="CA cert file is not available! Please reinstall" |
| 609 | + "the client and try again.") |
| 610 | + else: |
| 611 | + if is_ipa_client_configured(on_master=True): |
| 612 | + # host was already an IPA client, refresh client cert stores to |
| 613 | + # ensure we have up to date CA certs. |
| 614 | + try: |
| 615 | + ipautil.run([paths.IPA_CERTUPDATE]) |
| 616 | + except ipautil.CalledProcessError: |
| 617 | + ansible_module.fail_json( |
| 618 | + msg="ipa-certupdate failed to refresh certs.") |
608 | 619 |
|
609 | 620 | ansible_log.debug("-- REMOTE_API --")
|
610 | 621 |
|
|
0 commit comments