summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/dnac/playbooks/discovery_intent.yml
blob: 9f004802f7e494c5a03ea874f32a1d0c1d0f2c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
---
- name: Discover devices using multiple discovery specific credentials and delete all the discoveries
  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: True
      dnac_log_level: DEBUG

  tasks:

    - name: Execute discovery devices using MULTI RANGE with various global credentials
      cisco.dnac.discovery_intent:
        <<: *dnac_login
        state: merged
        config_verify: True
        config:
          - discovery_name: Multi_global
            discovery_type: MULTI RANGE
            ip_address_list:
            - 204.1.2.1-204.1.2.5
            - 204.192.3.40
            - 204.192.4.200
            - 204.1.2.6
            - 204.1.2.7
            - 204.1.2.8
            - 204.1.2.9
            - 204.1.2.10
            - 204.1.2.11
            global_credentials:
              cli_credentials_list:
                - description: ISE
                  username: cisco
                - description: CLI1234 #Incorrect name passed
                  username: cli
              http_read_credential_list:
                - description: HTTP Read
                  username: HTTP_Read
              snmp_v3_credential_list:
                - description: snmpV3
                  username: snmpV3
            protocol_order: ssh

    - name: Execute discovery of single device using various discovery specific credentials and all the global credentials
      cisco.dnac.discovery_intent:
        <<: *dnac_login
        state: merged
        config_verify: True
        config:
          - discovery_name: Single IP Discovery
            discovery_type: "SINGLE"
            ip_address_list:
              - 204.1.2.5
            discovery_specific_credentials:
              cli_credentials_list:
              - username: cisco
                password: Cisco#123
                enable_password: Cisco#123
              http_read_credential:
                username: string
                password: Lablab#123
                port: 443
                secure: True
              snmp_v2_read_credential:
                desc: string
                community: string
              snmp_v2_write_credential:
                desc: string
                community: string
              snmp_v3_credential:
                username: v3Public2
                snmp_mode: AUTHPRIV
                auth_type: SHA
                auth_password: Lablab#1234
                privacy_type: AES256
                privacy_password: Lablab#1234
            protocol_order: ssh

    - name: Execute discovery of single device using various discovery specific credentials only
      cisco.dnac.discovery_intent:
        <<: *dnac_login
        state: merged
        config_verify: True
        config:
          - discovery_name: Single without Global Credentials
            discovery_type: "SINGLE"
            ip_address_list:
              - 204.1.2.5
            use_global_credentials: False
            discovery_specific_credentials:
              cli_credentials_list:
              - username: cisco
                password: Cisco#123
                enable_password: Cisco#123
              http_read_credential:
                username: string
                password: Lablab#123
                port: 443
                secure: True
              snmp_v2_read_credential:
                desc: string
                community: string
              snmp_v2_write_credential:
                desc: string
                community: string
              snmp_v3_credential:
                username: v3Public2
                snmp_mode: AUTHPRIV
                auth_type: SHA
                auth_password: Lablab#1234
                privacy_type: AES256
                privacy_password: Lablab#1234
            protocol_order: ssh

    - name: Execute discovery devices using MULTI RANGE with various discovery specific credentials and all global credentials (max 5 allowed)
      cisco.dnac.discovery_intent:
        <<: *dnac_login
        state: merged
        config_verify: True
        config:
          - discovery_type: "MULTI RANGE"
            discovery_name: Multi_range
            ip_address_list:
              - 204.1.2.1-204.1.2.100 #It will be taken as 204.1.2.1 - 204.1.2.1
              - 205.2.1.1-205.2.1.10
            ip_filter_list:
              - 204.1.2.5 #Devie with IP 204.1.2.5 won't be discovered
            discovery_specific_credentials:
              cli_credentials_list:
                - username: admin
                  password: maglev123
                  enable_password: maglev123
              http_read_credential:
                username: admin
                password: maglev123
                port: 443
                secure: True
              snmp_v2_read_credential:
                desc: new
                community: password
              snmp_v3_credential:
                username: administrator
                snmp_mode: AUTHPRIV
                auth_password: admin123
                auth_type: SHA
                privacy_type: AES192
                privacy_password: cisco#123
            protocol_order: ssh
            start_index: 1
            records_to_return: 1000
            snmp_version: v2

    - name: Execute discovery devices using CDP/LLDP/CIDR leveraging discovery specific credentials and all the global credentials
      cisco.dnac.discovery_intent:
        <<: *dnac_login
        state: merged
        config_verify: True
        config:
          - discovery_name: CDP_Test_1
            discovery_type: "CDP" #Can be LLDP and CIDR
            ip_address_list:   #List length should be one
              - 204.1.2.1
            cdp_level: 2 #Instead use lldp_level for LLDP and prefix length for CIDR
            discovery_specific_credentials:
              cli_credentials_list:
                - username: admin
                  password: maglev123
                  enable_password: maglev123
            protocol_order: ssh

    - name: Execute deletion of single discovery from the dashboard
      cisco.dnac.discovery_intent:
        <<: *dnac_login
        state: deleted
        config_verify: True
        config:
          - discovery_name: CDP_Test_1

    - name: Execute deletion of all the discoveries from the dashboard
      cisco.dnac.discovery_intent:
        <<: *dnac_login
        state: deleted
        config_verify: True
        config:
          - delete_all: True