mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-08-05 14:24:48 +00:00
Allow processing of multiple names for deleting dnsforwardzones.
This commit is contained in:
@@ -134,7 +134,7 @@ def main():
|
|||||||
# general
|
# general
|
||||||
ipaadmin_principal=dict(type="str", default="admin"),
|
ipaadmin_principal=dict(type="str", default="admin"),
|
||||||
ipaadmin_password=dict(type="str", required=False, no_log=True),
|
ipaadmin_password=dict(type="str", required=False, no_log=True),
|
||||||
name=dict(type="str", aliases=["cn"], default=None,
|
name=dict(type="list", aliases=["cn"], default=None,
|
||||||
required=True),
|
required=True),
|
||||||
forwarders=dict(type='list', aliases=["idnsforwarders"],
|
forwarders=dict(type='list', aliases=["idnsforwarders"],
|
||||||
required=False),
|
required=False),
|
||||||
@@ -158,7 +158,7 @@ def main():
|
|||||||
"ipaadmin_principal")
|
"ipaadmin_principal")
|
||||||
ipaadmin_password = module_params_get(ansible_module,
|
ipaadmin_password = module_params_get(ansible_module,
|
||||||
"ipaadmin_password")
|
"ipaadmin_password")
|
||||||
name = module_params_get(ansible_module, "name")
|
names = module_params_get(ansible_module, "name")
|
||||||
action = module_params_get(ansible_module, "action")
|
action = module_params_get(ansible_module, "action")
|
||||||
forwarders = module_params_get(ansible_module, "forwarders")
|
forwarders = module_params_get(ansible_module, "forwarders")
|
||||||
forwardpolicy = module_params_get(ansible_module, "forwardpolicy")
|
forwardpolicy = module_params_get(ansible_module, "forwardpolicy")
|
||||||
@@ -166,6 +166,12 @@ def main():
|
|||||||
"skip_overlap_check")
|
"skip_overlap_check")
|
||||||
state = module_params_get(ansible_module, "state")
|
state = module_params_get(ansible_module, "state")
|
||||||
|
|
||||||
|
if state == 'present' and len(names) != 1:
|
||||||
|
ansible_module.fail_json(
|
||||||
|
msg="Only one dnsforwardzone can be added at a time.")
|
||||||
|
if state == 'absent' and len(names) < 1:
|
||||||
|
ansible_module.fail_json(msg="No name given.")
|
||||||
|
|
||||||
# absent stae means delete if the action is NOT member but update if it is
|
# absent stae means delete if the action is NOT member but update if it is
|
||||||
# if action is member then update an exisiting resource
|
# if action is member then update an exisiting resource
|
||||||
# and if action is not member then create a resource
|
# and if action is not member then create a resource
|
||||||
@@ -207,6 +213,7 @@ def main():
|
|||||||
ipaadmin_password)
|
ipaadmin_password)
|
||||||
api_connect()
|
api_connect()
|
||||||
|
|
||||||
|
for name in names:
|
||||||
# Make sure forwardzone exists
|
# Make sure forwardzone exists
|
||||||
existing_resource = find_dnsforwardzone(ansible_module, name)
|
existing_resource = find_dnsforwardzone(ansible_module, name)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user