Skip to content

Instantly share code, notes, and snippets.

@NWMichl
Created June 10, 2021 05:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NWMichl/a3b8f9598cb415678484d33c9dc055c9 to your computer and use it in GitHub Desktop.
Save NWMichl/a3b8f9598cb415678484d33c9dc055c9 to your computer and use it in GitHub Desktop.
REST-Call to provision new device with Cisco ISE for TACACS access via Ansible
# REST-Call to provision new device with Cisco ISE for TACACS access
#
# The 'NetworkDeviceGroupList' in the request body needs to be adapted to your environment, or substituted with variables.
---
- name: ISE
hosts: test_switch
gather_facts: false
connection: network_cli
vars:
ise_user: <username>
ise_password: <password>
tacacs_secret: <secret>
tasks:
- name: Provision new device with Cisco ISE for TACACS access
uri:
url: https://10.10.10.10:9060/ers/config/networkdevice
user: "{{ ise_user }}"
password: "{{ ise_password }}"
headers:
Accept: application/json
content-type: application/json
ers-media-type: network.networkdevice.1.1
status_code: 201
method: POST
body_format: json
body: '{"NetworkDevice":{"name": "{{ inventory_hostname }}","description":"nx-os","tacacsSettings":{"sharedSecret":"{{ tacacs_secret }}","connectModeOptions":"ON_LEGACY"},"NetworkDeviceIPList":[{"ipaddress": "{{ ansible_host }}","mask":32}],"NetworkDeviceGroupList":["Location#All Locations#LAN","Device Type#All Device Types#InternalNet"]}}'
validate_certs: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment