diff options
Diffstat (limited to 'ansible_collections/cisco/dnac/playbooks')
32 files changed, 1320 insertions, 0 deletions
diff --git a/ansible_collections/cisco/dnac/playbooks/application_set_info.yml b/ansible_collections/cisco/dnac/playbooks/application_set_info.yml new file mode 100644 index 000000000..4cd4da0fc --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/application_set_info.yml @@ -0,0 +1,20 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Get application sets local-services + cisco.dnac.application_sets_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + name: local-services + # limit: 3 + # offset: 2 + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/dnac/playbooks/application_sets.yml b/ansible_collections/cisco/dnac/playbooks/application_sets.yml new file mode 100644 index 000000000..ac489ece7 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/application_sets.yml @@ -0,0 +1,43 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Create an application set + cisco.dnac.application_sets: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + dnac_debug: "{{ dnac_debug }}" + state: present + payload: + - name: AppSet1 + register: application_set_result + + - name: Get task info + cisco.dnac.task_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + taskId: "{{ application_set_result.dnac_response.response.taskId }}" + when: + - application_set_result.dnac_response is defined + - application_set_result.dnac_response.response is defined + - application_set_result.dnac_response.response.taskId is defined + register: task_result + + - name: Show new application_set + ansible.builtin.debug: + msg: "{{ application_set_result }}" + when: + - application_set_result is defined + + - name: Show retrieved task + ansible.builtin.debug: + msg: "{{ task_result.dnac_response.response }}" + when: + - task_result is defined + - task_result.dnac_response is defined diff --git a/ansible_collections/cisco/dnac/playbooks/applications.yml b/ansible_collections/cisco/dnac/playbooks/applications.yml new file mode 100644 index 000000000..a8d752338 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/applications.yml @@ -0,0 +1,72 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Create an application + cisco.dnac.applications: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + dnac_debug: "{{ dnac_debug }}" + state: present + payload: + - name: itunes-video + networkApplications: + - id: d4658954-ef8e-4eb9-a663-d53e3f4de325 + appProtocol: tcp + applicationSubType: NONE + applicationType: DEFAULT + categoryId: edc1f53c-d89d-4e8d-a23b-6148e3857504 + displayName: "12608" + engineId: "13" + helpString: iTunes video streaming + longDescription: >- + iTunes is a media player and media library application developed by Apple Inc. It is used to play, download, and organize digital + audio and video on personal computers running the OS X and Microsoft Windows operating systems. Through the iTunes Store, users + can purchase and + download music, music videos, television shows, audiobooks, podcasts, movies, etc. on their MAC/ Win PC/ iDevices running iTunes. + iTunes-video refers to all video streaming media services generated by iTunes such as: play movies, TV shows, videocasts, video, etc. + name: itunes-video + popularity: "10" + rank: "65535" + selectorId: "572" + trafficClass: MULTIMEDIA_STREAMING + networkIdentity: + - id: 4babbfcf-c5b7-4105-8954-1ee3a6097753 + displayName: "1461196" + lowerPort: "0" + ports: "80" + protocol: TCP + upperPort: "0" + applicationSet: + idRef: d31b81a3-a599-4d0c-bb6d-42bbdd0e7889 + register: application_result + + - name: Get task info + cisco.dnac.task_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + taskId: "{{ application_result.dnac_response.response.taskId }}" + when: + - application_result.dnac_response is defined + - application_result.dnac_response.response is defined + - application_result.dnac_response.response.taskId is defined + register: task_result + + - name: Show new application_set + ansible.builtin.debug: + msg: "{{ application_result }}" + when: + - application_result is defined + + - name: Show retrieved task + ansible.builtin.debug: + msg: "{{ task_result.dnac_response.response }}" + when: + - task_result is defined + - task_result.dnac_response is defined diff --git a/ansible_collections/cisco/dnac/playbooks/authentication_import.yml b/ansible_collections/cisco/dnac/playbooks/authentication_import.yml new file mode 100644 index 000000000..23d889067 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/authentication_import.yml @@ -0,0 +1,20 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Import certificate file + cisco.dnac.authentication_import_certificate: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + dnac_debug: "{{ dnac_debug }}" + certFilePath: ./files/test.template + pkFilePath: ./files/test.template + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/dnac/playbooks/command_runner_run_command.yml b/ansible_collections/cisco/dnac/playbooks/command_runner_run_command.yml new file mode 100644 index 000000000..cf975ed68 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/command_runner_run_command.yml @@ -0,0 +1,41 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Run command + cisco.dnac.command_runner_run_command: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + commands: + - pwd + deviceUuids: + - a9b86e42-6573-4f5d-a0bf-a743e290f46a + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" + + - name: Get task info + cisco.dnac.task_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + taskId: "{{ result.dnac_response.response.taskId }}" + when: + - result.dnac_response is defined + - result.dnac_response.response is defined + - result.dnac_response.response.taskId is defined + register: task_result + + - name: Show retrieved task + ansible.builtin.debug: + msg: "{{ task_result.dnac_response.response }}" + when: + - task_result is defined + - task_result.dnac_response is defined diff --git a/ansible_collections/cisco/dnac/playbooks/configuration_template_version_create.yml b/ansible_collections/cisco/dnac/playbooks/configuration_template_version_create.yml new file mode 100644 index 000000000..6b90000fc --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/configuration_template_version_create.yml @@ -0,0 +1,44 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Create Configuration Template Version + cisco.dnac.configuration_template_version_create: + 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 }}" + # comments: string + templateId: 2121f1d7-d9ea-4eea-8f83-45af2941f5f9 + register: configuration_template_version_create_result + + - name: Get task info + cisco.dnac.task_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + taskId: "{{ configuration_template_version_create_result.dnac_response.response.taskId }}" + when: + - configuration_template_version_create_result.dnac_response is defined + - configuration_template_version_create_result.dnac_response.response is defined + - configuration_template_version_create_result.dnac_response.response.taskId is defined + register: task_result + + - name: Show new configuration_template_version + ansible.builtin.debug: + msg: "{{ configuration_template_version_create_result }}" + when: + - configuration_template_version_create_result is defined + + - name: Show retrieved task + ansible.builtin.debug: + msg: "{{ task_result.dnac_response.response }}" + when: + - task_result is defined + - task_result.dnac_response is defined diff --git a/ansible_collections/cisco/dnac/playbooks/credentials.template b/ansible_collections/cisco/dnac/playbooks/credentials.template new file mode 100644 index 000000000..e621bdaa5 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/credentials.template @@ -0,0 +1,8 @@ +--- +dnac_host: <A.B.C.D> +dnac_port: 443 +dnac_username: <username> +dnac_password: <password> +dnac_version: 2.3.5.3 +dnac_verify: False +dnac_debug: False
\ No newline at end of file diff --git a/ansible_collections/cisco/dnac/playbooks/credentials.yml b/ansible_collections/cisco/dnac/playbooks/credentials.yml new file mode 100644 index 000000000..5413d0e8f --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/credentials.yml @@ -0,0 +1,8 @@ +--- +dnac_host: 192.168.196.2 +dnac_port: 443 +dnac_username: admin +dnac_password: Maglev123 +dnac_version: 2.2.2.3 +dnac_verify: False +dnac_debug: True diff --git a/ansible_collections/cisco/dnac/playbooks/device_details.yml b/ansible_collections/cisco/dnac/playbooks/device_details.yml new file mode 100644 index 000000000..0c9dfdfef --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/device_details.yml @@ -0,0 +1,54 @@ +template_details: + - proj_name: "Onboarding Configuration" + device_config: "hostname cat9k-1\n" + language: "velocity" + family: "Switches and Hubs" + type: "IOS-XE" + variant: "XE" + temp_name: "temp_cat9k-1" + description: "Test Template 1" + - proj_name: "Onboarding Configuration" + device_config: "hostname cat9k-2\n" + language: "velocity" + family: "Switches and Hubs" + type: "IOS-XE" + variant: "XE" + temp_name: "temp_cat9k-2" + description: "Test Template 2" + - proj_name: "Onboarding Configuration" + device_config: "hostname cat9k-3\n" + language: "velocity" + family: "Switches and Hubs" + type: "IOS-XE" + variant: "XE" + temp_name: "temp_cat9k-3" + description: "Test Template 3" + +device_details: + - site_name: "Global/Chennai/Trill" + image_name: "cat9k_iosxe.17.04.01.SPA.bin" + proj_name: "Onboarding Configuration" + temp_name: "temp_cat9k-1" + device_version: "2" + device_number: "AB2425L8M7" + device_name: "Cat9k-1" + device_state: "Unclaimed" + device_id: "C9300-25UX" + - site_name: "Global/Chennai/Trill" + image_name: "cat9k_iosxe.17.04.01.SPA.bin" + proj_name: "Onboarding Configuration" + temp_name: "temp_cat9k-2" + device_version: "2" + device_number: "CD2425L8M7" + device_name: "Cat9k-2" + device_state: "Unclaimed" + device_id: "C9300-25UX" + - site_name: "Global/Chennai/Trill" + image_name: "cat9k_iosxe.17.04.01.SPA.bin" + proj_name: "Onboarding Configuration" + temp_name: "temp_cat9k-3" + device_version: "2" + device_number: "EF2425L8M7" + device_name: "Cat9k-3" + device_state: "Unclaimed" + device_id: "C9300-25UX" diff --git a/ansible_collections/cisco/dnac/playbooks/discovery.yml b/ansible_collections/cisco/dnac/playbooks/discovery.yml new file mode 100644 index 000000000..d05d201a3 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/discovery.yml @@ -0,0 +1,128 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Find discovery + cisco.dnac.discovery_range_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + dnac_debug: "{{ dnac_debug }}" + startIndex: 1 + recordsToReturn: 500 + register: discovery_range_result + + - name: Set fact of filtered discoveries + ansible.builtin.set_fact: + discoveries_filtered: "{{ discovery_range_result.dnac_response.response | selectattr('name', 'equalto', 'start_discovery_test2')}}" + when: + - discovery_range_result is defined + - discovery_range_result.dnac_response is defined + - discovery_range_result.dnac_response.response is defined + register: discovery_filtered_results + + - name: Set fact of filtered discovery + ansible.builtin.set_fact: + discovery_filtered: "{{ discovery_filtered_results.ansible_facts.discoveries_filtered|first }}" + when: + - discovery_filtered_results is defined + - discovery_filtered_results.ansible_facts is defined + - discovery_filtered_results.ansible_facts.discoveries_filtered is defined + - discovery_filtered_results.ansible_facts.discoveries_filtered|length > 0 + register: discovery_filtered_result + + - name: Set fact of filtered discovery id + ansible.builtin.set_fact: + discovery_filtered_id: "{{ discovery_filtered_result.ansible_facts.discovery_filtered.id }}" + when: + - discovery_filtered_result is defined + - discovery_filtered_result.ansible_facts is defined + - discovery_filtered_result.ansible_facts.discovery_filtered is defined + register: discovery_filtered_result_id + + - name: Create a discovery + cisco.dnac.discovery: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + dnac_debug: "{{ dnac_debug }}" + validate_response_schema: false + state: present + cdpLevel: 16 + discoveryType: CDP + globalCredentialIdList: + - 90acbab8-03d5-4726-9c19-e1e51a40b3cd + - f979d842-f6fd-456a-8137-2cb5113cd2e8 + ipAddressList: 10.10.22.22 + name: start_discovery_test2 + protocolOrder: ssh + # id: "67" + # enablePasswordList: [""] + # userNameList: [""] + # passwordList: [""] + # ipFilterList: [""] + # httpReadCredential: + # port: 0 + # secure: false + # deviceIds: " " + # discoveryCondition: "In Progress" + # discoveryStatus: "Active" + # isAutoCdp: true + # preferredMgmtIPMethod: "None" + # retry: 3 + # timeout: 5 + # httpWriteCredential: + # port: 0 + # secure: false + register: discovery_result + when: + - discovery_filtered_result_id is not defined + + - name: Update a discovery + cisco.dnac.discovery: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + dnac_debug: "{{ dnac_debug }}" + validate_response_schema: false + state: present + cdpLevel: 16 + discoveryType: CDP + globalCredentialIdList: + - 90acbab8-03d5-4726-9c19-e1e51a40b3cd, + - f979d842-f6fd-456a-8137-2cb5113cd2e8, + ipAddressList: 10.10.22.22 + name: start_discovery_test2 + protocolOrder: ssh + id: "{{ discovery_filtered_result_id.ansible_facts.discovery_filtered_id }}" + # enablePasswordList: [""] + # userNameList: [""] + # passwordList: [""] + # ipFilterList: [""] + # httpReadCredential: + # port: 0 + # secure: false + # deviceIds: " " + # discoveryCondition: "In Progress" + # discoveryStatus: "Active" + # isAutoCdp: true + # preferredMgmtIPMethod: "None" + # retry: 3 + # timeout: 5 + # httpWriteCredential: + # port: 0 + # secure: false + register: discovery_result + when: + - discovery_filtered_result_id is defined + + - name: Show discovery result + ansible.builtin.debug: + msg: "{{ discovery_result }}" + when: + - discovery_result is defined diff --git a/ansible_collections/cisco/dnac/playbooks/download_device_cmd_runner_output.yml b/ansible_collections/cisco/dnac/playbooks/download_device_cmd_runner_output.yml new file mode 100644 index 000000000..60643436f --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/download_device_cmd_runner_output.yml @@ -0,0 +1,78 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + 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 }}" + gather_facts: false + tasks: + - name: Get Network Devices - Switches and Hubs + cisco.dnac.network_device_info: + <<: *dnac_login + family: Switches and Hubs + register: network_devices_result + + - name: Get device list ids + ansible.builtin.set_fact: + device_id_list: "{{ device_id_list | default([]) }} + ['{{ item.id }}']" + with_items: "{{ network_devices_result.dnac_response.response }}" + when: + - network_devices_result.dnac_response is defined + - network_devices_result.dnac_response.response is defined + + - name: Run show run command on device + cisco.dnac.command_runner_run_command: + <<: *dnac_login + commands: + - show run + deviceUuids: "{{ device_id_list }}" + when: + - device_id_list | length > 0 + register: command_result + + - name: Get task info + cisco.dnac.task_info: + <<: *dnac_login + taskId: "{{ command_result.dnac_response.response.taskId }}" + when: + - command_result is defined + - command_result.dnac_response is defined + - command_result.dnac_response.response is defined + - command_result.dnac_response.response.taskId is defined + register: task_result + until: task_result.dnac_response.response.progress != "CLI Runner request creation" + retries: 10 + delay: 1 + + - name: Get file id + ansible.builtin.set_fact: + file_response: "{{ task_result.dnac_response.response.progress | from_json }}" + when: "'fileId' in task_result.dnac_response.response.progress" + + - name: Download the file + cisco.dnac.file_info: + <<: *dnac_login + saveFile: true + fileId: "{{ file_response.fileId }}" + dirPath: /tmp/devices + when: + - file_response is defined + - file_response.fileId is defined + register: download_file + + - name: Show extract of data + ansible.builtin.debug: + msg: >- + Filename: {{ download_file.dnac_response.filename }} + Filepath: {{ download_file.dnac_response.path }} + Data extract: {{ download_file.dnac_response.data[:50]}}" + when: + - download_file is defined + - download_file.dnac_response is defined diff --git a/ansible_collections/cisco/dnac/playbooks/files/test.template b/ansible_collections/cisco/dnac/playbooks/files/test.template new file mode 100644 index 000000000..cb5641702 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/files/test.template @@ -0,0 +1,35 @@ +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. +Dummy text. diff --git a/ansible_collections/cisco/dnac/playbooks/global_credentials.yml b/ansible_collections/cisco/dnac/playbooks/global_credentials.yml new file mode 100644 index 000000000..c485e5d20 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/global_credentials.yml @@ -0,0 +1,36 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Create CLI Credential + cisco.dnac.cli_credential: + 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 }}" + state: present + validate_response_schema: false + enablePassword: C2sco456! + username: Test2 + password: C2sco456! + description: Test2 + + - name: Create SNMPV3 Credential + cisco.dnac.snmpv3_credential: + 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 }}" + state: present + validate_response_schema: false + username: user2 + snmpMode: NOAUTHNOPRIV + description: user2 cred diff --git a/ansible_collections/cisco/dnac/playbooks/global_credentials_info.yml b/ansible_collections/cisco/dnac/playbooks/global_credentials_info.yml new file mode 100644 index 000000000..d8ba864c6 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/global_credentials_info.yml @@ -0,0 +1,40 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Get all Global Credential by SubType + cisco.dnac.global_credential_info: + 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 }}" + credentialSubType: HTTP_READ + # sortBy: + # order: + register: global_credentials_result + + - name: Show global_credentials + ansible.builtin.debug: + msg: "{{ global_credentials_result }}" + + - name: Get Global Credential by id + cisco.dnac.global_credential_info: + 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 }}" + id: babc42b9-0bdd-49ef-912e-66f533fb5d59 + credentialSubType: HTTP_READ + register: global_credential_result + + - name: Show global_credential + ansible.builtin.debug: + msg: "{{ global_credential_result }}" diff --git a/ansible_collections/cisco/dnac/playbooks/global_pool.yml b/ansible_collections/cisco/dnac/playbooks/global_pool.yml new file mode 100644 index 000000000..27aa62605 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/global_pool.yml @@ -0,0 +1,26 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Find discovery + cisco.dnac.global_pool: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + dnac_version: "{{ dnac_version }}" + dnac_debug: "{{ dnac_debug }}" + state: present + # id: 1bf5ecf3-be14-48fb-b724-df801bc61172 + settings: + ippool: + - IpAddressSpace: string + dhcpServerIps: [] + dnsServerIps: [] + gateway: "" + ipPoolCidr: 30.0.0.0/8 + ipPoolName: v4pool-test2 + type: Generic + register: discovery_range_result diff --git a/ansible_collections/cisco/dnac/playbooks/hosts b/ansible_collections/cisco/dnac/playbooks/hosts new file mode 100644 index 000000000..53af82def --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/hosts @@ -0,0 +1,2 @@ +[dnac_servers] +dnac_server
\ No newline at end of file diff --git a/ansible_collections/cisco/dnac/playbooks/image_details.yml b/ansible_collections/cisco/dnac/playbooks/image_details.yml new file mode 100644 index 000000000..4d787aded --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/image_details.yml @@ -0,0 +1,11 @@ +image_details: + - import_type: "url" + url_source: "http://10.104.118.10/swim/17.9/cat9k_iosxe.BLD_V179_THROTTLE_LATEST_20220429_033422.SSA.bin" + device_role: "ALL" + device_family_name: "Cisco Catalyst 9606R Switch-Cisco Catalyst 9600 Series Supervisor Engine 1" + device_serial_number: "FXS2325Q01C" + - import_type: "url" + url_source: "http://10.104.118.10/swim/17.9/cat9k_iosxe.BLD_V179_THROTTLE_LATEST_20220429_033422.SSA.bin" + device_role: "ALL" + device_family_name: "Cisco Catalyst 9606R Switch-Cisco Catalyst 9600 Series Supervisor Engine 1" + device_serial_number: "FXS5632Q01C" diff --git a/ansible_collections/cisco/dnac/playbooks/import_image_file.yml b/ansible_collections/cisco/dnac/playbooks/import_image_file.yml new file mode 100644 index 000000000..3ec66e09e --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/import_image_file.yml @@ -0,0 +1,22 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Import image file + cisco.dnac.swim_import_local: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + filePath: fullpath/playbooks/files/test.template # string + isThirdParty: true # boolean + thirdPartyApplicationType: SomeValue # string + thirdPartyImageFamily: SomeValue # string + thirdPartyVendor: SomeValue # string + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/dnac/playbooks/network_device_custom_prompt_info.yml b/ansible_collections/cisco/dnac/playbooks/network_device_custom_prompt_info.yml new file mode 100644 index 000000000..2207bc05c --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/network_device_custom_prompt_info.yml @@ -0,0 +1,20 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Get all Network Device Custom Prompt + cisco.dnac.network_device_custom_prompt_info: + 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}}" + register: network_device_custom_prompt_result + + - name: Show all network_device_custom_prompt + ansible.builtin.debug: + msg: "{{ network_device_custom_prompt_result }}"
\ No newline at end of file diff --git a/ansible_collections/cisco/dnac/playbooks/network_device_info.yml b/ansible_collections/cisco/dnac/playbooks/network_device_info.yml new file mode 100644 index 000000000..d9e84b6a9 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/network_device_info.yml @@ -0,0 +1,36 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Get Network Devices + cisco.dnac.network_device_info: + 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 }}" + register: network_devices_result + + - name: Show all network_devices + ansible.builtin.debug: + msg: "{{ network_devices_result }}" + + - name: Get Network Device by id + cisco.dnac.network_device_info: + 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 }}" + id: 0c4c83f7-1fce-46fe-a0a2-ac4b2e7dfbab + register: network_device_result + + - name: Show network_device + ansible.builtin.debug: + msg: "{{ network_device_result }}" diff --git a/ansible_collections/cisco/dnac/playbooks/network_device_update_role.yml b/ansible_collections/cisco/dnac/playbooks/network_device_update_role.yml new file mode 100644 index 000000000..6b9cb52f5 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/network_device_update_role.yml @@ -0,0 +1,45 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Update Network Device Role + cisco.dnac.network_device_update_role: + 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 }}" + id: 0c4c83f7-1fce-46fe-a0a2-ac4b2e7dfbab + role: UNKNOWN + roleSource: AUTO + register: network_device_update_role_result + + - name: Get task info + cisco.dnac.task_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + taskId: "{{ network_device_update_role_result.dnac_response.response.taskId }}" + when: + - network_device_update_role_result.dnac_response is defined + - network_device_update_role_result.dnac_response.response is defined + - network_device_update_role_result.dnac_response.response.taskId is defined + register: task_result + + - name: Show updated network_device_update_role + ansible.builtin.debug: + msg: "{{ network_device_update_role_result }}" + when: + - network_device_update_role_result is defined + + - name: Show retrieved task + ansible.builtin.debug: + msg: "{{ task_result.dnac_response.response }}" + when: + - task_result is defined + - task_result.dnac_response is defined diff --git a/ansible_collections/cisco/dnac/playbooks/pnp_device.yml b/ansible_collections/cisco/dnac/playbooks/pnp_device.yml new file mode 100644 index 000000000..cfd8bc418 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/pnp_device.yml @@ -0,0 +1,79 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + # - name: Delete by id + # cisco.dnac.pnp_device: + # 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 }}" + # state: absent + # id: 5f96f83854ee220008a9c456 + # register: pnp_device_delete_result + + # - name: Show deleted pnp_device + # debug: + # msg: "{{ pnp_device_delete_result }}" + # when: + # - pnp_device_delete_result is defined + + - name: Adds or Updates a device to the PnP database + cisco.dnac.pnp_device: + 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 }}" + state: present + version: 2 + deviceInfo: + serialNumber: FOCTEST2 + name: FOCTEST2 + state: Unclaimed + # onbState: Not Contacted + # cmState: Not Contacted + location: {} + source: User + reloadRequested: false + aaaCredentials: + username: "" + password: "" + populateInventory: false + poeSupported: false + capwapBackOff: false + redirectionState: NONE + dayN: false + dayNClaimOperation: NO_OP + tlsState: NO_OP + reProvision: false + authOperation: AUTHORIZATION_NOT_REQUIRED + stack: false + sudiRequired: false + validActions: + editSUDI: true + editWfParams: true + delete: true + claim: true + unclaim: true + reset: false + authorize: false + resetMsg: This device is not in Error state. Only Error devices may be Reset. + authorizeMsg: This Device is not in PendingAuthorization state. + workflowParameters: {} + tenantId: 5cdc6c45a8405f00c80c6ba3 + id: 610ab95c07a77b0fbec39f22 + register: pnp_device_result + + - name: Show new pnp_device + ansible.builtin.debug: + msg: "{{ pnp_device_result }}" + when: + - pnp_device_result is defined diff --git a/ansible_collections/cisco/dnac/playbooks/reports_executions_info.yml b/ansible_collections/cisco/dnac/playbooks/reports_executions_info.yml new file mode 100644 index 000000000..4174b4ea9 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/reports_executions_info.yml @@ -0,0 +1,22 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Download report content + cisco.dnac.reports_executions_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + dnac_debug: "{{ dnac_debug }}" + reportId: be9d6d76-0bff-4c49-84a1-16adf58431c6 + executionId: 586da15e-5f50-4f65-8f3d-303f88dfdf18 + dirPath: /Users/wilhelm32/Downloads/dna + saveFile: true + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result.dnac_response }}" diff --git a/ansible_collections/cisco/dnac/playbooks/reserve_ip_subpool.yml b/ansible_collections/cisco/dnac/playbooks/reserve_ip_subpool.yml new file mode 100644 index 000000000..267ad6760 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/reserve_ip_subpool.yml @@ -0,0 +1,48 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + vars: + site: bb25cdaf-3f5a-45b9-bdd6-0f63fdf6c83e + + tasks: + - name: Create reservation + cisco.dnac.reserve_ip_subpool: + 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 }}" + state: present + ipv4DhcpServers: + - 55.66.55.55 + ipv4DnsServers: + - 33.33.33.3 + ipv4GateWay: 10.0.10.1 + ipv4GlobalPool: 10.0.0.0/8 + ipv4Prefix: true + ipv4PrefixLength: 24 + ipv4Subnet: 10.0.10.0/24 + name: IP Pool 1 + siteId: "{{ site }}" + slaacSupport: true + type: LAN + + - name: Get Reservations + cisco.dnac.reserve_ip_subpool_info: + 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 }}" + siteId: "{{ site }}" + register: ip_pool + + - name: Print Reservations + ansible.builtin.debug: + var: ip_pool diff --git a/ansible_collections/cisco/dnac/playbooks/sda_fabric.yml b/ansible_collections/cisco/dnac/playbooks/sda_fabric.yml new file mode 100644 index 000000000..e53df2743 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/sda_fabric.yml @@ -0,0 +1,22 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Create an sda_fabric + cisco.dnac.sda_fabric: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + dnac_debug: "{{ dnac_debug }}" + state: present + fabricName: MyFabricName3 + register: sda_fabric_result + + - name: Show new sda_fabric + ansible.builtin.debug: + msg: "{{ sda_fabric_result }}" + when: + - sda_fabric_result is defined diff --git a/ansible_collections/cisco/dnac/playbooks/sda_fabric_site.yml b/ansible_collections/cisco/dnac/playbooks/sda_fabric_site.yml new file mode 100644 index 000000000..2f24f6e0e --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/sda_fabric_site.yml @@ -0,0 +1,37 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Create + cisco.dnac.sda_fabric_site: + 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 }}" + state: present + fabricName: DNAC_Guide_Fabric + siteNameHierarchy: Global/San Francisco + + # - name: Delete all + # cisco.dnac.sda_fabric_site: + # 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 }}" + # state: absent + # siteNameHierarchy: Global/San Francisco + # register: result + + # - name: Show result + # debug: + # msg: "{{ result }}" + # when: + # - result is defined diff --git a/ansible_collections/cisco/dnac/playbooks/sda_virtual_network_v2.yml b/ansible_collections/cisco/dnac/playbooks/sda_virtual_network_v2.yml new file mode 100644 index 000000000..84914b57c --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/sda_virtual_network_v2.yml @@ -0,0 +1,33 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Create + cisco.dnac.sda_virtual_network_v2: + 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 }}" + state: present + isGuestVirtualNetwork: false + scalableGroupNames: + - Auditors + virtualNetworkName: GUEST_VN + virtualNetworkType: GUEST + + # - name: Delete all + # cisco.dnac.sda_virtual_network_v2: + # 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 }}" + # state: absent + # virtualNetworkName: GUEST_VN diff --git a/ansible_collections/cisco/dnac/playbooks/tag.yml b/ansible_collections/cisco/dnac/playbooks/tag.yml new file mode 100644 index 000000000..0e7ac8dc9 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/tag.yml @@ -0,0 +1,131 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Create tag with name "MyNewTag" + cisco.dnac.tag: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + state: present + description: My Tag + name: MyNewTag + register: result + + - name: Show result + ansible.builtin.debug: + msg: "{{ result }}" + + - name: Get task status + cisco.dnac.task_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + taskId: "{{ result.dnac_response.response.taskId }}" + when: + - result.dnac_response is defined + - result.dnac_response.response is defined + - result.dnac_response.response.taskId is defined + register: task_result + + - name: Show status of create tag operation + ansible.builtin.debug: + msg: "{{ task_result.dnac_response.response }}" + when: + - task_result is defined + - task_result.dnac_response is defined + + - name: Create the same tag + cisco.dnac.tag: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + state: present + description: My Tag 1 + name: MyNewTag + register: result + + - name: Get task status + cisco.dnac.task_tree_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + taskId: "{{ result.dnac_response.response.taskId }}" + when: + - result.dnac_response is defined + - result.dnac_response.response is defined + - result.dnac_response.response.taskId is defined + register: task_tree_result + + - name: Show status of update tag operation + ansible.builtin.debug: + msg: "{{ task_tree_result.dnac_response.response }}" + when: + - task_tree_result is defined + - task_tree_result.dnac_response is defined + + - name: Get tag with name "MyNewTag" + cisco.dnac.tag_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + name: MyNewTag + register: result + + - name: Show tags with name "MyNewTag" + ansible.builtin.debug: + msg: "{{ result }}" + + - name: Delete tag + cisco.dnac.tag: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + state: absent + name: MyNewTag + register: result + + - name: Show deleted tags with name "MyNewTag" + ansible.builtin.debug: + msg: "{{ result }}" + + # - name: Get task status + # cisco.dnac.task_info: + # dnac_host: "{{ dnac_host }}" + # dnac_username: "{{ dnac_username }}" + # dnac_password: "{{ dnac_password }}" + # dnac_verify: "{{ dnac_verify }}" + # taskId: "{{ result.dnac_response.response.taskId }}" + # when: + # - result.dnac_response is defined + # - result.dnac_response.response is defined + # - result.dnac_response.response.taskId is defined + # register: task_tree_result + + # - name: Show status of delete tag operation + # debug: + # msg: "{{ task_tree_result.dnac_response.response }}" + # when: + # - task_tree_result is defined + # - task_tree_result.dnac_response is defined + + - name: Get tag with name "MyNewTag" + cisco.dnac.tag_info: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + name: MyNewTag + register: result + + - name: Show tags with name "MyNewTag" + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/ansible_collections/cisco/dnac/playbooks/template.yml b/ansible_collections/cisco/dnac/playbooks/template.yml new file mode 100644 index 000000000..6aa9b27bf --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/template.yml @@ -0,0 +1,22 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Create an configuration_template_project + cisco.dnac.configuration_template_project: + dnac_host: "{{ dnac_host }}" + dnac_username: "{{ dnac_username }}" + dnac_password: "{{ dnac_password }}" + dnac_verify: "{{ dnac_verify }}" + dnac_debug: "{{ dnac_debug }}" + state: present + name: Cloud Test Template 5 + register: configuration_template_project_result + + - name: Show new configuration_template_project + ansible.builtin.debug: + msg: "{{ configuration_template_project_result }}" + when: + - configuration_template_project_result is defined diff --git a/ansible_collections/cisco/dnac/playbooks/template_pnp_intent.yml b/ansible_collections/cisco/dnac/playbooks/template_pnp_intent.yml new file mode 100644 index 000000000..4ce25e16d --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/template_pnp_intent.yml @@ -0,0 +1,61 @@ +- hosts: dnac_servers + vars_files: + - credentials.yml + - device_details.yml + gather_facts: false + connection: local + tasks: +# +# Project Info Section +# + - name: Test project template + cisco.dnac.template_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" + #ignore_errors: true #Enable this to continue execution even the task fails + config: + - projectName: "{{ item.proj_name }}" + templateContent: "{{ item.device_config }}" + language: "{{ item.language }}" + deviceTypes: + - productFamily: "{{ item.family }}" + softwareType: "{{ item.type }}" + softwareVariant: "{{ item.variant }}" + templateName: "{{ item.temp_name }}" + versionDescription: "{{ item.description }}" + register: template_result + with_items: '{{ template_details }}' + tags: + - template + + + - name: Create pnp + cisco.dnac.pnp_intent: + dnac_host: "{{dnac_host}}" + dnac_username: "{{dnac_username}}" + dnac_password: "{{dnac_password}}" + dnac_verify: "{{dnac_verify}}" + dnac_port: "{{dnac_port}}" + dnac_debug: "{{dnac_debug}}" + dnac_log: true + config: + - site_name: "{{ item.site_name }}" + project_name: "{{ item.proj_name }}" + template_name: "{{ item.temp_name }}" + image_name: "{{ item.image_name }}" + device_version: "{{ item.device_version }}" + deviceInfo: + serialNumber: "{{ item.device_number }}" + hostname: "{{ item.device_name}}" + state: "{{ item.device_state }}" + pid: "{{ item.device_id }}" + register: pnp_result + with_items: '{{ device_details }}' + tags: + - pnp diff --git a/ansible_collections/cisco/dnac/playbooks/test_swim_module.yml b/ansible_collections/cisco/dnac/playbooks/test_swim_module.yml new file mode 100644 index 000000000..0fbbc2045 --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/test_swim_module.yml @@ -0,0 +1,41 @@ +- hosts: dnac_servers + vars_files: + - credentials_245.yml + - image_details.yml #Contains image and device details + gather_facts: false + connection: local + tasks: +# +# Project Info Section +# + + - name: Import an image, tag it as golden and load it on device + cisco.dnac.swim_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 + config: + - importImageDetails: + type: "{{ item.import_type }}" + urlDetails: + payload: + - sourceURL: "{{ item.url_source }}" + isThirdParty: false + 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 diff --git a/ansible_collections/cisco/dnac/playbooks/wireless_enterprise_ssid.yml b/ansible_collections/cisco/dnac/playbooks/wireless_enterprise_ssid.yml new file mode 100644 index 000000000..0d6efaaae --- /dev/null +++ b/ansible_collections/cisco/dnac/playbooks/wireless_enterprise_ssid.yml @@ -0,0 +1,35 @@ +--- +- hosts: dnac_servers + vars_files: + - credentials.yml + gather_facts: false + tasks: + - name: Create Wirelesss Enterprise SSID + cisco.dnac.wireless_enterprise_ssid: + 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 }}" + state: present + validate_response_schema: false + basicServiceSetClientIdleTimeout: 00 + clientExclusionTimeout: 00 + enableBasicServiceSetMaxIdle: true + enableBroadcastSSID: true + enableClientExclusion: true + enableDirectedMulticastService: true + enableFastLane: true + enableMACFiltering: true + enableNeighborList: true + enableSessionTimeOut: true + fastTransition: Adaptive + mfpClientProtection: Optional + name: Test + passphrase: "" + radioPolicy: Dual band operation (2.4GHz and 5GHz) + securityLevel: WPA2_ENTERPRISE + sessionTimeOut: 00 + trafficType: voicedata |