From 6604cd71aa1ec21f06de4ba088224250140c1ad3 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Tue, 8 Feb 2022 09:46:33 -0300 Subject: [PATCH] dnsforwardzone: add support for delete_continue. Add support for attribute 'delete_continue' in ipadnsforwardzone.. --- README-dnsforwardzone.md | 1 + plugins/modules/ipadnsforwardzone.py | 5 ++++- tests/dnsforwardzone/test_dnsforwardzone.yml | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README-dnsforwardzone.md b/README-dnsforwardzone.md index 9274698448..f2390f79ab 100644 --- a/README-dnsforwardzone.md +++ b/README-dnsforwardzone.md @@ -113,6 +113,7 @@ Variable | Description | Required `forwardpolicy` \| `idnsforwardpolicy` | Per-zone conditional forwarding policy. Possible values are `only`, `first`, `none`. Set to "none" to disable forwarding to global forwarder for this zone. In that case, conditional zone forwarders are disregarded. | no `skip_overlap_check` | Force DNS zone creation even if it will overlap with an existing zone. Defaults to False. | no `permission` | Allow DNS Forward Zone to be managed. (bool) | no +`delete_continue` \| `continue` | Continuous mode: don't stop on errors. Valid only if `state` is `absent`. Default: `yes` (bool) | no `action` | Work on group or member level. It can be on of `member` or `dnsforwardzone` and defaults to `dnsforwardzone`. | no `state` | The state to ensure. It can be one of `present`, `absent`, `enabled` or `disabled`, default: `present`. | yes diff --git a/plugins/modules/ipadnsforwardzone.py b/plugins/modules/ipadnsforwardzone.py index f8d19933e9..ecd40575b5 100644 --- a/plugins/modules/ipadnsforwardzone.py +++ b/plugins/modules/ipadnsforwardzone.py @@ -39,6 +39,7 @@ - Add and delete an IPA DNS Forwarder Zones using IPA API extends_documentation_fragment: - ipamodule_base_docs + - ipamodule_arguments.delete_continue options: name: description: @@ -202,6 +203,7 @@ def main(): choices=['present', 'absent', 'enabled', 'disabled']), ), supports_check_mode=True, + ipa_arguments=["delete_continue"], ) ansible_module._ansible_debug = True @@ -214,6 +216,7 @@ def main(): forwardpolicy = ansible_module.params_get("forwardpolicy") skip_overlap_check = ansible_module.params_get("skip_overlap_check") permission = ansible_module.params_get("permission") + delete_continue = ansible_module.params_get("delete_continue") state = ansible_module.params_get("state") if state == 'present' and len(names) != 1: @@ -326,7 +329,7 @@ def main(): # exists but should be absent # set command command = "dnsforwardzone_del" - args = {} + args = {"continue": bool(delete_continue)} elif operation == "update": # exists and is updating diff --git a/tests/dnsforwardzone/test_dnsforwardzone.yml b/tests/dnsforwardzone/test_dnsforwardzone.yml index 260829ff57..1c7393a529 100644 --- a/tests/dnsforwardzone/test_dnsforwardzone.yml +++ b/tests/dnsforwardzone/test_dnsforwardzone.yml @@ -12,6 +12,7 @@ name: - example.com - newfailzone.com + continue: no state: absent - name: ensure forwardzone example.com is created