diff --git a/changelogs/fragments/6905-ipa_dnszone-key-error-fix.yml b/changelogs/fragments/6905-ipa_dnszone-key-error-fix.yml new file mode 100644 index 0000000000..d7ce19d8b9 --- /dev/null +++ b/changelogs/fragments/6905-ipa_dnszone-key-error-fix.yml @@ -0,0 +1,2 @@ +bugfixes: + - ipa_dnszone - fix 'idnsallowsyncptr' key error for reverse zone (https://github.com/ansible-collections/community.general/pull/6906, https://github.com/ansible-collections/community.general/issues/6905). diff --git a/plugins/modules/ipa_dnszone.py b/plugins/modules/ipa_dnszone.py index 06c93841ea..6699b0525b 100644 --- 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})