cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1102
Views
0
Helpful
1
Replies

Setting leaf port descriptions for a range of interfaces - Ansible

johnwbaxter2
Level 1
Level 1

Hoping to get help on this.  I've got the aci module for interface descriptions from the github

 

 

- name: Set Interface Description
  cisco.aci.aci_interface_description:
    host: "{{ inventory_hostname }}"
    username: "{{ username }}"
    password: "{{ password }}"
    validate_certs: no
    pod_id: 1
    node_id: 105
    node_type: leaf
    interface: 1/49
    description: foobar
    state: present
  delegate_to: localhost

The issue is, I want to be able to do this for a range of interfaces, or even multiple, non-consecutive, interfaces.  I don't see an option in the module for this.  Wondering if maybe anyone has made a loop using dict2items (I haven't made one work properly yet) with this module, or even the rest module.

 

 

I'm aware that this can kind of be done with the aci_access_port_block_to_access_port module.  However, this doesn't quite work if an interface in the block already has some other description.  It seems ACI prioritizes individually set descriptions over a port block description.

1 Reply 1

jiarchen
Cisco Employee
Cisco Employee

HI, John

 

Here's the API Inspector information which recorded during interface description added. 

If you want to add for multple times, you'll need to write a task for each of it when adding it for the first time. 

 

-Creates it under the access policies

method: POST

url: https://xx.xx.xx.xx/api/node/mo/uni/infra/accportprof-101/hports-N5596-A-p48-typ-range/portblk-block2.json

payload{"infraPortBlk":{"attributes":{"dn":"uni/infra/accportprof-101/hports-N5596-A-p48-typ-range/portblk-block2","descr":"TEST"},"children":[]}}

 

-Creates it under the inventory tab 

method: POST

url: https://xx.xx.xx.xx/api/node/mo/uni/infra/hpaths-101_eth1_48.json

payload"{\"infraHPathS\":{\"attributes\":{\"descr\":\"ABCD123\",\"status\":\"created,modified\"}}}"

 

-note if you use the string TEST it wont show in the payload of the API call as seen below.

url: https://XX.XX.XX.XX/api/node/mo/uni/infra/hpaths-101_eth1_48.json

payload"{\"infraHPathS\":{\"attributes\":{\"status\":\"created,modified\"}}}"

 

Hope this will help. If you still got ansible adding description failure, you could also raise a TAC case for further investigation. 

Review Cisco Networking for a $25 gift card

Save 25% on Day-2 Operations Add-On License