-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from madhansansel/main
Adding new intent modules for inventory, discovery and device credentials
- Loading branch information
Showing
22 changed files
with
4,631 additions
and
786 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
- name: Manage operations - Add, claim, and delete devices of Onboarding Configuration (PnP) | ||
hosts: localhost | ||
connection: local | ||
gather_facts: no | ||
|
||
vars_files: | ||
- "{{ CLUSTERFILE }}" | ||
|
||
vars: | ||
dnac_login: &dnac_login | ||
dnac_host: "{{ dnac_host }}" | ||
dnac_username: "{{ dnac_username }}" | ||
dnac_password: "{{ dnac_password }}" | ||
dnac_verify: "{{ dnac_verify }}" | ||
dnac_port: "{{ dnac_port }}" | ||
dnac_version: "{{ dnac_version }}" | ||
dnac_debug: "{{ dnac_debug }}" | ||
|
||
tasks: | ||
|
||
- name: Add a new device only | ||
cisco.dnac.pnp_intent: | ||
<<: *dnac_login | ||
dnac_log: True | ||
state: merged | ||
config: | ||
- deviceInfo: | ||
add_device_method: Single | ||
serialNumber: FJC2330E0IK | ||
hostname: Test-9300-6 | ||
state: Unclaimed | ||
pid: c9300-24P | ||
isSudiRequired: True | ||
|
||
- name: Add a new device and claim it | ||
cisco.dnac.pnp_intent: | ||
<<: *dnac_login | ||
dnac_log: True | ||
state: merged | ||
config: | ||
- site_name: Global/USA/San Francisco/BGL_18 | ||
deviceInfo: | ||
add_device_method: Single | ||
serialNumber: FJC2330E0IK | ||
hostname: Test-9300-6 | ||
state: Unclaimed | ||
pid: c9300-24P | ||
isSudiRequired: True | ||
|
||
- name: Claim an added Switch with template and image upgrade to a site only | ||
cisco.dnac.pnp_intent: | ||
<<: *dnac_login | ||
dnac_log: True | ||
state: merged | ||
config: | ||
- site_name: Global/USA/San Francisco/BGL_18 | ||
template_name: "Ansible_PNP_Switch" | ||
image_name: cat9k_iosxe_npe.17.03.07.SPA.bin | ||
project_name: Onboarding Configuration | ||
deviceInfo: | ||
serialNumber: FJC271924EQ | ||
hostname: Switch | ||
state: Unclaimed | ||
pid: C9300-48UXM | ||
|
||
- name: Claim an added Wireless Controller with template and image upgrade to a site only | ||
cisco.dnac.pnp_intent: | ||
<<: *dnac_login | ||
dnac_log: True | ||
state: merged | ||
config: | ||
- site_name: Global/USA/San Francisco/BGL_18 | ||
pnp_type: CatalystWLC | ||
template_name: "Ansible_PNP_WLC" | ||
image_name: C9800-40-universalk9_wlc.17.12.01.SPA.bin | ||
deviceInfo: | ||
serialNumber: FOX2639PAY7 | ||
hostname: WLC | ||
state: Unclaimed | ||
pid: C9800-CL-K9 | ||
gateway: 204.192.101.1 | ||
ipInterfaceName: TenGigabitEthernet0/0/0 | ||
staticIP: 204.192.101.10 | ||
subnetMask: 255.255.255.0 | ||
vlanId: 1101 | ||
|
||
- name: Delete an added device from the Pnp dashboard | ||
cisco.dnac.pnp_intent: | ||
<<: *dnac_login | ||
dnac_log: True | ||
state: deleted | ||
config: | ||
- deviceInfo: | ||
serialNumber: FJC2330E0IK |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
- hosts: dnac_servers | ||
vars_files: | ||
- credentials_245.yml | ||
gather_facts: no | ||
connection: local | ||
tasks: | ||
# | ||
# Project Info Section | ||
# | ||
|
||
- name: Create Credentials and assign it to a site. | ||
cisco.dnac.device_credential_intent: | ||
dnac_host: "{{ dnac_host }}" | ||
dnac_port: "{{ dnac_port }}" | ||
dnac_username: "{{ dnac_username }}" | ||
dnac_password: "{{ dnac_password }}" | ||
dnac_verify: "{{ dnac_verify }}" | ||
dnac_debug: "{{ dnac_debug }}" | ||
dnac_log: True | ||
state: merged | ||
config: | ||
- GlobalCredentialDetails: | ||
cliCredential: | ||
- description: CLI | ||
username: cli | ||
password: "12345" | ||
enablePassword: "12345" | ||
# old_description: | ||
# old_username: | ||
# id: e448ea13-4de0-406b-bc6e-f72b57ed6746 # Use this for updation or deletion | ||
snmpV2cRead: | ||
- description: SNMPv2c Read # use this for deletion | ||
readCommunity: "12345" | ||
# old_description: # use this for updating the description | ||
# id: 0ee7d677-8804-43f2-8b6c-599c5f18348f # Use this for updation or deletion | ||
snmpV2cWrite: | ||
- description: SNMPv2c Write # use this for deletion | ||
writeCommunity: "12345" | ||
# old_description: # use this for updating the description | ||
# id: a96abc1b-1fd6-41f1-8a6d-a5569c17262d # Use this for updation or deletion | ||
snmpV3: | ||
- authPassword: "12345678" # Atleast 8 characters | ||
authType: SHA # [SHA, MD5] (SHA is recommended) | ||
snmpMode: AUTHPRIV # [AUTHPRIV, AUTHNOPRIV, NOAUTHNOPRIV] | ||
privacyPassword: "12345678" # Atleast 8 characters | ||
privacyType: AES128 # [AE128, AE192, AE256] | ||
username: snmpV3 | ||
description: snmpV3 | ||
# old_description: | ||
# id: d8974823-250a-41b0-8c9b-b27b2ae01472 # Use this for updation or deletion | ||
httpsRead: | ||
- description: HTTP Read | ||
username: HTTP_Read | ||
password: "12345" | ||
port: 443 | ||
# old_description: | ||
# old_username: | ||
# id: a7ef9995-e404-4240-94ca-b5f37f65c19d # Use this for updation or deletion | ||
httpsWrite: | ||
- description: HTTP Write | ||
username: HTTP_Write | ||
password: "12345" | ||
port: 443 | ||
# old_description: | ||
# old_username: | ||
# id: bec9818e-30cd-468b-bf75-292beefc2e20 # Use this for updation or deletion | ||
AssignCredentialsToSite: | ||
# cliDescription: | ||
# cliUsername: | ||
cliId: e448ea13-4de0-406b-bc6e-f72b57ed6746 | ||
# snmpV2ReadDescription: | ||
snmpV2ReadId: 0ee7d677-8804-43f2-8b6c-599c5f18348f | ||
# snmpV2WriteDescription: | ||
snmpV2WriteId: a96abc1b-1fd6-41f1-8a6d-a5569c17262d | ||
# snmpV3Description: | ||
snmpV3Id: d8974823-250a-41b0-8c9b-b27b2ae01472 | ||
# httpReadDescription: | ||
# httpReadUsername: | ||
httpRead: d5d7af00-5a38-4ac1-9f55-03338d00c415 | ||
# httpWriteDescription: | ||
# httpWriteUsername: | ||
httpWrite: bec9818e-30cd-468b-bf75-292beefc2e20 | ||
siteName: | ||
- Global/Chennai/Trill | ||
- Global/Chennai/Tidel |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
- name: Configure device credentials on Cisco DNA Center | ||
hosts: localhost | ||
connection: local | ||
gather_facts: no | ||
vars_files: | ||
- "input_inventory.yml" | ||
- "credentials.yml" | ||
tasks: | ||
- name: Add/Update/Resync/Delete the devices in DNAC Inventory. | ||
cisco.dnac.inventory_intent: | ||
dnac_host: "{{dnac_host}}" | ||
dnac_username: "{{dnac_username}}" | ||
dnac_password: "{{dnac_password}}" | ||
dnac_verify: "{{dnac_verify}}" | ||
dnac_port: "{{dnac_port}}" | ||
dnac_version: "{{dnac_version}}" | ||
dnac_debug: "{{dnac_debug}}" | ||
dnac_log: true | ||
state: merged | ||
config: | ||
- enablePassword: "{{item.enablePassword}}" | ||
password: "{{item.password}}" | ||
ipAddress: "{{item.ipAddress}}" | ||
snmpAuthPassphrase: "{{item.snmpAuthPassphrase}}" | ||
snmpAuthProtocol: "{{item.snmpAuthProtocol}}" | ||
snmpMode: "{{item.snmpMode}}" | ||
snmpPrivPassphrase: "{{item.snmpPrivPassphrase}}" | ||
snmpPrivProtocol: "{{item.snmpPrivProtocol}}" | ||
snmpROCommunity: "{{item.snmpROCommunity}}" | ||
snmpRWCommunity: "{{item.snmpRWCommunity}}" | ||
snmpRetry: "{{item.snmpRetry}}" | ||
snmpTimeout: "{{item.snmpTimeout}}" | ||
snmpUserName: "{{item.snmpUserName}}" | ||
userName: "{{item.userName}}" | ||
device_resync: "{{item.resync}}" | ||
|
||
with_items: "{{ device_details }}" | ||
tags: | ||
- inventory_device |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
- name: Configure device credentials on Cisco DNA Center | ||
hosts: localhost | ||
connection: local | ||
gather_facts: no | ||
vars_files: | ||
- "input_swim.yml" | ||
- "credentials.yml" | ||
tasks: | ||
- name: Import an image, tag it as golden and load it on device {{ item.device_serial_number }} | ||
cisco.dnac.swim_intent: | ||
dnac_host: "{{dnac_host}}" | ||
dnac_username: "{{dnac_username}}" | ||
dnac_password: "{{dnac_password}}" | ||
dnac_verify: "{{dnac_verify}}" | ||
dnac_port: "{{dnac_port}}" | ||
dnac_version: "{{dnac_version}}" | ||
dnac_debug: "{{dnac_debug}}" | ||
dnac_log: true | ||
config: | ||
- importImageDetails: | ||
type: "{{ item.type }}" | ||
urlDetails: | ||
payload: "{{ item.urlDetails.payload }}" | ||
taggingDetails: | ||
deviceRole: "{{ item.device_role }}" | ||
deviceFamilyName: "{{ item.device_family_name }}" | ||
tagging: true | ||
imageDistributionDetails: | ||
deviceSerialNumber: "{{ item.device_serial_number }}" | ||
imageActivationDetails: | ||
scehduleValidate: false | ||
activateLowerImageVersion: true | ||
deviceSerialNumber: "{{ item.device_serial_number }}" | ||
distributeIfNeeded: true | ||
with_items: "{{ image_details }}" | ||
tags: | ||
- swim |
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
Oops, something went wrong.