Repository: ansible-collections/community.general

Issue:
Feature Request:  community.general.ipa_dnszone support for automatic record PTR synchronization
The CLI equivalent for this support would be `ipa dnszone-mod $ZONE --allow-sync-ptr=true` 

This could be a simple boolean (i.e. 0 or 1) or (true/false). 


Discussion:
Files identified in the description:
None

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
@ahambrick: Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:
- component name

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE/bug_report.md

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: issue_missing_data --->
##### SUMMARY
**community.general.ipa_dnszone** should add support for automatic record PTR synchronization. 
##### ISSUE TYPE
Feature Request
##### COMPONENT NAME
community.general.ipa.dnszone
##### ADDITIONAL INFORMATION
The CLI equivalent for this support would be `ipa dnszone-mod $ZONE --allow-sync-ptr=true`


Resolving patch:
diff --git a/plugins/modules/identity/ipa/ipa_dnszone.py b/plugins/modules/identity/ipa/ipa_dnszone.py
--- a/plugins/modules/identity/ipa/ipa_dnszone.py
+++ b/plugins/modules/identity/ipa/ipa_dnszone.py
@@ -27,11 +27,14 @@
     choices: ["absent", "present"]
     type: str
   dynamicupdate:
-    description: Apply dynamic update to zone
-    required: false
-    default: "false"
-    choices: ["false", "true"]
-    type: str
+    description: Apply dynamic update to zone.
+    default: false
+    type: bool
+  allowsyncptr:
+    description: Allow synchronization of forward and reverse records in the zone.
+    default: false
+    type: bool
+    version_added: 4.3.0
 extends_documentation_fragment:
 - community.general.ipa.documentation
 
@@ -60,6 +63,14 @@
     ipa_user: admin
     ipa_pass: topsecret
     state: absent
+
+- name: Ensure dns zone is present and is allowing sync
+  community.general.ipa_dnszone:
+    ipa_host: spider.example.com
+    ipa_pass: Passw0rd!
+    state: present
+    zone_name: example.com
+    allowsyncptr: true
 '''
 
 RETURN = r'''
@@ -79,25 +90,37 @@ def __init__(self, module, host, port, protocol):
         super(DNSZoneIPAClient, self).__init__(module, host, port, protocol)
 
     def dnszone_find(self, zone_name, details=None):
-        itens = {'idnsname': zone_name}
+        items = {'all': 'true',
+                 'idnsname': zone_name, }
         if details is not None:
-            itens.update(details)
+            items.update(details)
 
         return self._post_json(
             method='dnszone_find',
             name=zone_name,
-            item=itens
+            item=items
         )
 
     def dnszone_add(self, zone_name=None, details=None):
-        itens = {}
+        items = {}
         if details is not None:
-            itens.update(details)
+            items.update(details)
 
         return self._post_json(
             method='dnszone_add',
             name=zone_name,
-            item=itens
+            item=items
+        )
+
+    def dnszone_mod(self, zone_name=None, details=None):
+        items = {}
+        if details is not None:
+            items.update(details)
+
+        return self._post_json(
+            method='dnszone_mod',
+            name=zone_name,
+            item=items
         )
 
     def dnszone_del(self, zone_name=None, record_name=None, details=None):
@@ -109,18 +132,29 @@ def ensure(module, client):
     zone_name = module.params['zone_name']
     state = module.params['state']
     dynamicupdate = module.params['dynamicupdate']
+    allowsyncptr = module.params['allowsyncptr']
+
+    changed = False
 
+    # does zone exist
     ipa_dnszone = client.dnszone_find(zone_name)
 
-    changed = False
     if state == 'present':
         if not ipa_dnszone:
+
             changed = True
             if not module.check_mode:
-                client.dnszone_add(zone_name=zone_name, details={'idnsallowdynupdate': dynamicupdate})
+                client.dnszone_add(zone_name=zone_name, details={'idnsallowdynupdate': dynamicupdate, 'idnsallowsyncptr': allowsyncptr})
+        elif ipa_dnszone['idnsallowdynupdate'][0] != str(dynamicupdate).upper() or ipa_dnszone['idnsallowsyncptr'][0] != str(allowsyncptr).upper():
+            changed = True
+            if not module.check_mode:
+                client.dnszone_mod(zone_name=zone_name, details={'idnsallowdynupdate': dynamicupdate, 'idnsallowsyncptr': allowsyncptr})
         else:
             changed = False
+
+    # state is absent
     else:
+        # check for generic zone existence
         if ipa_dnszone:
             changed = True
             if not module.check_mode:
@@ -133,7 +167,8 @@ def main():
     argument_spec = ipa_argument_spec()
     argument_spec.update(zone_name=dict(type='str', required=True),
                          state=dict(type='str', default='present', choices=['present', 'absent']),
-                         dynamicupdate=dict(type='str', required=False, default='false', choices=['true', 'false']),
+                         dynamicupdate=dict(type='bool', required=False, default=False),
+                         allowsyncptr=dict(type='bool', required=False, default=False),
                          )
 
     module = AnsibleModule(argument_spec=argument_spec,


Test patch: