Repository: ansible-collections/community.general

Issue:
ipa_dnszone fails for reverse zone
### Summary

The following code fails:

```
  community.general.ipa_dnszone:
    ipa_host: "{{ freeipa_master }}"
    ipa_pass: "{{ freeipa_admin_password }}"
    state: present
    zone_name: "10.13.10.in-addr.arpa."
    dynamicupdate: true
    validate_certs: false
```

Error:

```
fatal: [dc02 -> dc01(10.13.19.33)]: FAILED! => changed=false 
  msg: '''idnsallowsyncptr''
```

Reason: this is dict key error. Freeipa response from dnszone_find method for reverse zone does not contain 'idnsallowsyncptr' field

### Issue Type

Bug Report

### Component Name

ipa_dnszone

### Ansible Version

```console (paste below)
$ ansible --version
ansible [core 2.15.0]
  config file = ~/ansible/ansible.cfg
  configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/8.0.0/libexec/lib/python3.11/site-packages/ansible
  ansible collection location = ~/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.4 (main, Jun  7 2023, 00:42:15) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/usr/local/Cellar/ansible/8.0.0/libexec/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True


```


### Community.general Version

```console (paste below)
$ ansible-galaxy collection list community.general
# ~.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 7.0.1  

# /usr/local/Cellar/ansible/8.0.0/libexec/lib/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 7.0.1  

```


### Configuration

```console (paste below)
$ ansible-config dump --only-changed
CONFIG_FILE() = ~/ansible/ansible.cfg
DEFAULT_HOST_LIST(~/ansible/ansible.cfg) = ['~/ansible/environments/dev/inventory']
DEFAULT_ROLES_PATH(~/ansible/ansible.cfg) = ['~/ansible/roles']
DEFAULT_STDOUT_CALLBACK(~/ansible/ansible.cfg) = yaml
INTERPRETER_PYTHON(~/ansible/ansible.cfg) = /usr/bin/python3
```


### OS / Environment

Darwin Kernel Version 22.5.0

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: Test IPA reverse zone 
  community.general.ipa_dnszone:
    ipa_host: "{{ freeipa_master }}"
    ipa_pass: "{{ freeipa_admin_password }}"
    state: present
    zone_name: "10.13.10.in-addr.arpa."
    dynamicupdate: true
    validate_certs: false
```


### Expected Results

Reverse zone is added 

### Actual Results

```console (paste below)
fatal: [dc02 -> dc01(10.13.19.33)]: FAILED! => changed=false 
  msg: '''idnsallowsyncptr''
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
* [`plugins/modules/ipa_dnszone.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/ipa_dnszone.py)

If these files are incorrect, 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/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @Akasurde @Nosmoht @fxfitz @justchris1
[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/plugins/modules/ipa_dnszone.py b/plugins/modules/ipa_dnszone.py
--- a/plugins/modules/ipa_dnszone.py
+++ b/plugins/modules/ipa_dnszone.py
@@ -152,7 +152,8 @@ def ensure(module, client):
             changed = True
             if not module.check_mode:
                 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():
+        elif ipa_dnszone['idnsallowdynupdate'][0] != str(dynamicupdate).upper() or \
+                ipa_dnszone.get('idnsallowsyncptr') and 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})


Test patch: