diff --git a/plugins/module_utils/api.py b/plugins/module_utils/api.py index 41be3c33..018e9f15 100644 --- a/plugins/module_utils/api.py +++ b/plugins/module_utils/api.py @@ -297,7 +297,7 @@ def run(self, ib_obj_type, ib_spec): if each.get('ipv4addr') and each.get('ipv4addr') == proposed_object.get('ipv4addr'): current_object = each # To check for existing Host_record with same name with input Host_record by IP - elif each.get('ipv4addrs')[0].get('ipv4addr') and each.get('ipv4addrs')[0].get('ipv4addr')\ + elif each.get('ipv4addrs') and each.get('ipv4addrs')[0].get('ipv4addr')\ == proposed_object.get('ipv4addrs')[0].get('ipv4addr'): current_object = each # Else set the current_object with input value