--- - 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 }}" dnac_log_level: DEBUG tasks: - name: Import devices in bulk cisco.dnac.pnp_intent: <<: *dnac_login dnac_log: True state: merged config_verify: True config: - device_info: - serial_number: QD2425L8M7 state: Unclaimed pid: c9300-24P is_sudi_required: False - serial_number: QTC2320E0H9 state: Unclaimed pid: c9300-24P hostname: Test-123 - serial_number: ETC2320E0HB state: Unclaimed pid: c9300-24P - 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 device_info: - serial_number: FJC2330E0BB hostname: Test-9300-10 state: Unclaimed pid: c9300-24P is_sudi_required: True - name: Claim a pre-added switch, apply a template, and perform an image upgrade for a specific site 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 template_params: hostname: SJC-Switch-1 interface: TwoGigabitEthernet1/0/2 device_info: - serial_number: FJC271924EQ hostname: Switch state: Unclaimed pid: C9300-48UXM - name: Claim an existing Wireless Controller, apply a template, and upgrade its image for a specified site 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 template_params: hostname: IAC-EWLC-Claimed device_info: - serial_number: FOX2639PAY7 hostname: New_WLC state: Unclaimed pid: C9800-CL-K9 gateway: 204.192.101.1 ip_interface_name: TenGigabitEthernet0/0/0 static_ip: 204.192.101.10 subnet_mask: 255.255.255.0 vlan_id: 1101 - name: Remove multiple devices from the PnP dashboard safely (ignores non-existent devices) cisco.dnac.pnp_intent: <<: *dnac_login dnac_log: True state: deleted config_verify: True config: - device_info: - serial_number: QD2425L8M7 #Will get deleted - serial_number: FTC2320E0HA #Doesn't exist in the inventory - serial_number: FKC2310E0HB #Doesn't exist in the inventory