diff --git a/lib/ansible/modules/network/ios/ios_system.py b/lib/ansible/modules/network/ios/ios_system.py index 0255c91b31..a5e1a2b250 100644 --- a/lib/ansible/modules/network/ios/ios_system.py +++ b/lib/ansible/modules/network/ios/ios_system.py @@ -146,7 +146,7 @@ def map_obj_to_commands(want, have, module): commands = list() state = module.params['state'] - needs_update = lambda x: want.get(x) and (want.get(x) != have.get(x)) + needs_update = lambda x: want.get(x) is not None and (want.get(x) != have.get(x)) if state == 'absent': if have['hostname'] != 'Router': diff --git a/test/integration/targets/ios_system/tests/cli/set_lookup_source.yaml b/test/integration/targets/ios_system/tests/cli/set_lookup_source.yaml index beed27a2e9..188d441a3e 100644 --- a/test/integration/targets/ios_system/tests/cli/set_lookup_source.yaml +++ b/test/integration/targets/ios_system/tests/cli/set_lookup_source.yaml @@ -33,6 +33,30 @@ that: - result.changed == false +- name: Disable lookup_source + ios_system: + lookup_enabled: False + provider: "{{ cli }}" + authorize: yes + register: result + +- assert: + that: + - result.changed == true + - "'no ip domain lookup' in result.commands" + +- name: Disable lookup_source + ios_system: + lookup_enabled: True + provider: "{{ cli }}" + authorize: yes + register: result + +- assert: + that: + - result.changed == true + - "'ip domain lookup' in result.commands" + #- name: change to vrf # ios_system: # lookup_source: