diff --git a/plugins/modules/ipahost.py b/plugins/modules/ipahost.py index f0a42317f331d4b18ee3ae9d89dc8d84303447eb..7a981f16d8746a5b755900d2101d69bf312460df 100644 --- a/plugins/modules/ipahost.py +++ b/plugins/modules/ipahost.py @@ -452,7 +452,7 @@ def find_dnsrecord(module, name): _args) except ipalib_errors.NotFound as e: msg = str(e) - if "record not found" in msg: + if "record not found" in msg or "zone not found" in msg: return None module.fail_json(msg="dnsrecord_show failed: %s" % msg) diff --git a/tests/host/test_host_no_zone.yml b/tests/host/test_host_no_zone.yml new file mode 100644 index 0000000000000000000000000000000000000000..be6fe21807e2fe621ced885c95c4a70fed0605f0 --- /dev/null +++ b/tests/host/test_host_no_zone.yml @@ -0,0 +1,12 @@ +--- +- name: Test host + hosts: ipaserver + become: yes + + tasks: + - name: Ensure host with inexistent zone is absent. + ipahost: + name: host01.absentzone.test + state: absent + register: result + failed_when: result.failed or result.changed