mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-30 19:34:45 +00:00
module templates: Add delete_commit code template.
This patch add the lines necessary to allow the use of the attribute `delete_continue`, as it is a commom attribute, and if newer commom attributes are added to IPAAnsibleModule in the future, the usage will be similar.
This commit is contained in:
@@ -36,6 +36,7 @@ short description: Manage FreeIPA $name
|
|||||||
description: Manage FreeIPA $name and $name members
|
description: Manage FreeIPA $name and $name members
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- ipamodule_base_docs
|
- ipamodule_base_docs
|
||||||
|
- ipamoudle_base_docs.delete_continue
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description: The list of $name name strings.
|
description: The list of $name name strings.
|
||||||
@@ -152,6 +153,7 @@ def main():
|
|||||||
choices=["present", "absent"]),
|
choices=["present", "absent"]),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
|
ipa_module_options=["delete_continue"]
|
||||||
)
|
)
|
||||||
|
|
||||||
ansible_module._ansible_debug = True
|
ansible_module._ansible_debug = True
|
||||||
@@ -169,6 +171,8 @@ def main():
|
|||||||
PARAMETER2 = ansible_module.params_get_lowercase("PARAMETER2")
|
PARAMETER2 = ansible_module.params_get_lowercase("PARAMETER2")
|
||||||
action = ansible_module.params_get("action")
|
action = ansible_module.params_get("action")
|
||||||
|
|
||||||
|
delete_continue = ansible_module.params_get("delete_continue")
|
||||||
|
|
||||||
# state
|
# state
|
||||||
state = ansible_module.params_get("state")
|
state = ansible_module.params_get("state")
|
||||||
|
|
||||||
@@ -249,7 +253,9 @@ def main():
|
|||||||
elif state == "absent":
|
elif state == "absent":
|
||||||
if action == "$name":
|
if action == "$name":
|
||||||
if res_find is not None:
|
if res_find is not None:
|
||||||
commands.append([name, "$name_del", {}])
|
commands.append(
|
||||||
|
[name, "$name_del", {"continue": delete_continue}]
|
||||||
|
)
|
||||||
|
|
||||||
elif action == "member":
|
elif action == "member":
|
||||||
if res_find is None:
|
if res_find is None:
|
||||||
@@ -275,10 +281,12 @@ def main():
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
# Remove members
|
# Remove members
|
||||||
|
|
||||||
if PARAMETER2_del:
|
if PARAMETER2_del:
|
||||||
commands.append([name, "$name_remove_member",
|
commands.append([name, "$name_remove_member",
|
||||||
{
|
{
|
||||||
"PARAMETER2": PARAMETER2_del,
|
"PARAMETER2": PARAMETER2_del,
|
||||||
|
"continue": delete_continue,
|
||||||
}])
|
}])
|
||||||
|
|
||||||
# Execute commands
|
# Execute commands
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ short description: Manage FreeIPA $name
|
|||||||
description: Manage FreeIPA $name
|
description: Manage FreeIPA $name
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- ipamodule_base_docs
|
- ipamodule_base_docs
|
||||||
|
- ipamodule_base_docs.delete_continue
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description: The list of $name name strings.
|
description: The list of $name name strings.
|
||||||
@@ -124,6 +125,7 @@ def main():
|
|||||||
choices=["present", "absent"]),
|
choices=["present", "absent"]),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
|
ipa_module_options=["delete_continue"],
|
||||||
)
|
)
|
||||||
|
|
||||||
ansible_module._ansible_debug = True
|
ansible_module._ansible_debug = True
|
||||||
@@ -140,6 +142,8 @@ def main():
|
|||||||
# these parameters, use IPAAnsibleModule.params_get_lowercase.
|
# these parameters, use IPAAnsibleModule.params_get_lowercase.
|
||||||
PARAMETER2 = ansible_module.params_get_lowercase("PARAMETER2")
|
PARAMETER2 = ansible_module.params_get_lowercase("PARAMETER2")
|
||||||
|
|
||||||
|
delete_continue = ansible_module.params_get("delete_continue")
|
||||||
|
|
||||||
# state
|
# state
|
||||||
state = ansible_module.params_get("state")
|
state = ansible_module.params_get("state")
|
||||||
|
|
||||||
@@ -191,7 +195,9 @@ def main():
|
|||||||
|
|
||||||
elif state == "absent":
|
elif state == "absent":
|
||||||
if res_find is not None:
|
if res_find is not None:
|
||||||
commands.append([name, "$name_del", {}])
|
commands.append(
|
||||||
|
[name, "$name_del", {"continue": delete_continue}]
|
||||||
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
ansible_module.fail_json(msg="Unkown state '%s'" % state)
|
ansible_module.fail_json(msg="Unkown state '%s'" % state)
|
||||||
|
|||||||
Reference in New Issue
Block a user