
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2016 01:45 PM - edited 02-21-2020 10:31 AM
Anyone have any luck or experience sending REST commands to ACI? I am running ACI version 1.2(3c) and having no luck using two specific Ansible modules to send REST code to the APIC. Wanted to know if anyone has any advice or suggestions on the best way to accomplish this.
Solved! Go to Solution.
- Labels:
-
Other NAC
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2018 09:17 AM
The aci_rest module is the way to go. if you use the API inspector to get the post payload, you can convert it from json to YAML and put it in line, like so
aci_rest:
hostname: "{{ apic_address }}"
username: "{{ apic_user }}"
password: "{{ apic_password }}"
validate_certs: no
method: post
path: /api/node/mo/uni/infra/accportprof-{{device.0.name}}.json
content:
infraAccPortP:
attributes:
dn: uni/infra/accportprof-{{device.0.name}}
name: "{{device.0.name}}"
rn: accportprof-{{device.0.name}}
children:
- infraHPortS:
attributes:
dn: uni/infra/accportprof-{{device.0.name}}/hports-eth{{device.1}}-typ-range
name: eth{{device.1}}
rn: hports-eth{{device.1}}-typ-range
children:
- infraPortBlk:
attributes:
fromPort: "{{device.1}}"
toPort: "{{device.1}}"
name: block2
children: []
- infraRsAccBaseGrp:
attributes:
tDn: uni/infra/funcprof/accbundle-{{device.0.name}}
children: []
with_subelements:
- "{{ devices }}"
- interfaces
loop_control:
loop_var: device
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2018 09:17 AM
The aci_rest module is the way to go. if you use the API inspector to get the post payload, you can convert it from json to YAML and put it in line, like so
aci_rest:
hostname: "{{ apic_address }}"
username: "{{ apic_user }}"
password: "{{ apic_password }}"
validate_certs: no
method: post
path: /api/node/mo/uni/infra/accportprof-{{device.0.name}}.json
content:
infraAccPortP:
attributes:
dn: uni/infra/accportprof-{{device.0.name}}
name: "{{device.0.name}}"
rn: accportprof-{{device.0.name}}
children:
- infraHPortS:
attributes:
dn: uni/infra/accportprof-{{device.0.name}}/hports-eth{{device.1}}-typ-range
name: eth{{device.1}}
rn: hports-eth{{device.1}}-typ-range
children:
- infraPortBlk:
attributes:
fromPort: "{{device.1}}"
toPort: "{{device.1}}"
name: block2
children: []
- infraRsAccBaseGrp:
attributes:
tDn: uni/infra/funcprof/accbundle-{{device.0.name}}
children: []
with_subelements:
- "{{ devices }}"
- interfaces
loop_control:
loop_var: device
