mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix ios_l3_interface configure ipv4 address issue (#34222)
Adding a new interface and it's ipv4/ipv6 address results in failure. Add a check to validate if interface address is already configured or not.
This commit is contained in:
parent
89670133c1
commit
98f3424ed0
1 changed files with 2 additions and 2 deletions
|
@ -185,14 +185,14 @@ def map_obj_to_commands(updates, module):
|
|||
|
||||
elif state == 'present':
|
||||
if ipv4:
|
||||
if obj_in_have is None or ipv4 != obj_in_have['ipv4']:
|
||||
if obj_in_have is None or obj_in_have.get('ipv4') is None or ipv4 != obj_in_have['ipv4']:
|
||||
address = ipv4.split('/')
|
||||
if len(address) == 2:
|
||||
ipv4 = '{0} {1}'.format(address[0], to_netmask(address[1]))
|
||||
commands.append('ip address {}'.format(ipv4))
|
||||
|
||||
if ipv6:
|
||||
if obj_in_have is None or obj_in_have['ipv6'] is None or ipv6.lower() != obj_in_have['ipv6'].lower():
|
||||
if obj_in_have is None or obj_in_have.get('ipv6') is None or ipv6.lower() != obj_in_have['ipv6'].lower():
|
||||
commands.append('ipv6 address {}'.format(ipv6))
|
||||
|
||||
if commands[-1] == interface:
|
||||
|
|
Loading…
Reference in a new issue