cisco.ios help

Hi,

I am writing a ansible pb to demonstrate the power of ansible to our NetOps team.

I know enough about ansible and cisco switches to get around, but I am stuck on something probably really simple.

I am trying to create a vlan and populate it with some interfaces, but I

`

  • name: create vlan 10
    ios_vlan:
    name: Vlan_10
    vlan_id: 10
    state: present

`

and I get

`
“msg”: “configure terminal\r\n ^\r\n% Invalid input detected at ‘^’ marker.\r\n\r\nterrapin-2960-bu>”,

`

and from the looks of the terrapin-2960-bu> prompt it is not at enable mode which would be why it is invalid input…

I guess I don’t know how to get to enable mode in ansible cisco.ios and I can’t seem to find any reference that enlightens.

Regards
BIll

Most likely the error is due to missing privilege escalation.
Refer https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html#using-cli-in-ansible for adding
ansible_become and ansible_become_password settings.

Also, FYI ios_vlan module is deprecated, instead use ios_vlans resource module (available in Ansible 2.9 version)

Thanks Ganesh, I just found the privilege escalation once I formed my search correctly…

I am using the deprecated version for now as it seems there is an issue with creating vlans using ios_vlans that I found on github which is not present in ios_vlan - I plan to move code to ios_vlans when that issue is resolved.

Thanks for your advice, appreciate it.