# ios\_config IP assignment issues

**URL:** <https://forum.ansible.com/t/ios-config-ip-assignment-issues/24005>\
**Category:** Ansible Project\
**Created:** [March 18, 2017, 1:06pm UTC](https://forum.ansible.com/t/ios-config-ip-assignment-issues/24005 "2017-03-18T13:06:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Coulson](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@David\_Coulson](https://forum.ansible.com/u/David_Coulson)\
**Post date:** [March 18, 2017, 1:06pm UTC](https://forum.ansible.com/t/ios-config-ip-assignment-issues/24005/1 "2017-03-18T13:06:57Z")

</div>

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
