Created
June 10, 2021 05:50
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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