Hi-
I have two different issues, although they are both related to IP address assignment via ios_config.
Issue 1 - Does not generate error when IP address inconsistent with netmask:
e.g.
- name: Create port-channel interface
ios_config:
provider: “{{ cli }}”
before: “default interface {{ item.interface }}”
lines: - description MPLS to {{ item.desc }}
- no switchport
- ip address {{ item.address }} 255.255.255.252
after: - no shutdown
parents: interface {{ item.interface }}
match: exact
with_items: - { desc : Test, interface : Port-channel3, address : 172.30.0.60 }
In this example, the task runs fine:
TASK [Create port-channel interface] ***************************************************************************************************
changed: [6840-vss] => (item={u’interface’: u’Port-channel3’, u’address’: u’172.30.0.60’, u’desc’: u’Test’})
But there is no IP address on the interface, and when I do it manually it fails (as expected)
6840-VSS#sh run int po3
Building configuration…
Current configuration : 98 bytes
!
interface Port-channel3
description Test
no switchport
no ip address
end
6840-VSS(config)#int po 3
6840-VSS(config-if)#ip addr 172.30.0.60 255.255.255.252
Bad mask /30 for address 172.30.0.60
Issue 2 - Assignment of /31 addresses fails, although it actually updates the config.
Task is identical to above except netmask is 255.255.255.254
TASK [Create port-channel interface] ***************************************************************************************************
failed: [6840-vss] (item={u’interface’: u’Port-channel3’, u’address’: u’172.30.0.60’, u’desc’: u’Test’}) => {“command”: “ip address 172.30.0.60 255.255.255.254”, “failed”: true, “item”: {“address”: “172.30.0.60”, “desc”: “Test”, “interface”: “Port-channel3”}, “msg”: “ip address 172.30.0.60 255.255.255.254\r\n% Warning: use /31 mask on non point-to-point interface cautiously\r\n6840-VSS(config-if)#”, “rc”: 1}
to retry, use: --limit @/home/david/roles/portchannel.retry
When i do this manually:
6840-VSS(config)#int po3
6840-VSS(config-if)# ip address 172.30.0.60 255.255.255.254
% Warning: use /31 mask on non point-to-point interface cautiously
Thoughts?
David