Skip to content
Snippets Groups Projects
Commit 986ac80a authored by Thomas Woerner's avatar Thomas Woerner
Browse files

ipaserver: End play if server is already configured or client is configured

parent 4e2b6877
No related branches found
No related tags found
No related merge requests found
...@@ -254,7 +254,13 @@ def main(): ...@@ -254,7 +254,13 @@ def main():
# domain_name # domain_name
if (options.setup_dns and not options.allow_zone_overlap): if (options.setup_dns and not options.allow_zone_overlap):
check_zone_overlap(options.domain_name, False) try:
check_zone_overlap(options.domain_name, False)
except ValueError as e:
if "already exists in DNS" in str(e):
ansible_module.log(str(e))
ansible_module.exit_json(changed=False, dns_zone_exists=True)
raise
# dm_password # dm_password
with redirect_stdout(ansible_log): with redirect_stdout(ansible_log):
...@@ -425,16 +431,20 @@ def main(): ...@@ -425,16 +431,20 @@ def main():
if not options.external_ca and len(options.external_cert_files) < 1 and \ if not options.external_ca and len(options.external_cert_files) < 1 and \
is_ipa_configured(): is_ipa_configured():
options._installation_cleanup = False options._installation_cleanup = False
ansible_module.fail_json(msg= ansible_module.log(
"IPA server is already configured on this system. If you want " "IPA server is already configured on this system. If you want "
"to reinstall the IPA server, please uninstall it first.") "to reinstall the IPA server, please uninstall it first.")
ansible_module.exit_json(changed=False,
server_already_configured=True)
client_fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE) client_fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
if client_fstore.has_files(): if client_fstore.has_files():
options._installation_cleanup = False options._installation_cleanup = False
ansible_module.fail_json( ansible_module.log(
msg="IPA client is already configured on this system. " "IPA client is already configured on this system. "
"Please uninstall it before configuring the IPA server.") "Please uninstall it before configuring the IPA server.")
ansible_module.exit_json(changed=False,
client_already_configured=True)
# validate reverse_zones # validate reverse_zones
if not options.allow_zone_overlap: if not options.allow_zone_overlap:
......
...@@ -91,6 +91,8 @@ ...@@ -91,6 +91,8 @@
### additional ### ### additional ###
register: result_ipaserver_test register: result_ipaserver_test
- meta: end_play
when: not result_ipaserver_test.changed and (result_ipaserver_test.dns_zone_exists is defined or result_ipaserver_test.client_already_configured is defined or result_ipaserver_test.server_already_configured is defined)
- block: - block:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment