diff --git a/changelogs/fragments/229-handle-host-rename-without-dns.yml b/changelogs/fragments/229-handle-host-rename-without-dns.yml new file mode 100644 index 00000000..bf540a20 --- /dev/null +++ b/changelogs/fragments/229-handle-host-rename-without-dns.yml @@ -0,0 +1,4 @@ +--- +bugfixes: + - nios_host_record - rename logic included DNS view in filter critera, even when DNS had been bypassed. Omits DNS view from filter critera when renaming a host object and DNS is bypassed. (https://github.com/infobloxopen/infoblox-ansible/issues/230) +... diff --git a/plugins/module_utils/api.py b/plugins/module_utils/api.py index 51d47d33..9e8ff037 100644 --- a/plugins/module_utils/api.py +++ b/plugins/module_utils/api.py @@ -695,7 +695,11 @@ def get_object_ref(self, module, ib_obj_type, obj_filter, ib_spec): if old_name and new_name: if (ib_obj_type == NIOS_HOST_RECORD): - test_obj_filter = dict([('name', old_name), ('view', obj_filter['view'])]) + # to check only by old_name if dns bypassing is set + if not obj_filter['configure_for_dns']: + test_obj_filter = dict([('name', old_name)]) + else: + test_obj_filter = dict([('name', old_name), ('view', obj_filter['view'])]) # if there are multiple records with same name and different ip elif (ib_obj_type == NIOS_A_RECORD): test_obj_filter = dict([('name', old_name), ('ipv4addr', obj_filter['ipv4addr'])])