Server IP : 85.214.239.14 / Your IP : 18.216.92.5 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/self/root/lib/python3/dist-packages/ansible_collections/cisco/dnac/playbooks/ |
Upload File : |
--- - 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