Debian Codegraph @

ansible_collections/cisco/nxos/tests/integration/targets/nxos_telemetry/tasks/main.yaml

raw symbols SCIP
1 ---
2 - name: Set a fact for 'run_test'
3 ansible.builtin.set_fact:
4 run_test: true
5
6 - name: Set a fact for 'run_test'
7 ansible.builtin.set_fact:
8 run_test: false
9 when: platform is not search("N9K")
10
11 - name: Set a fact for 'run_test'
12 ansible.builtin.set_fact:
13 run_test: false
14 when: imagetag is search("I2|I3|I4|I5|I6")
15
16 - name: Fetch mgmt interface information
17 cisco.nxos.nxos_command:
18 commands: show interface mgmt 0 | json
19 register: result
20
21 - name: Store mgmt interface IP address
22 ansible.builtin.set_fact:
23 mgmt0_ip: "{{ result['stdout'][0]['TABLE_interface']['ROW_interface']['eth_ip_addr'] }}"
24
25 - name: Generate and store random password for temp user
26 ansible.builtin.set_fact:
27 temp_passwd: "{{ lookup('password', '/dev/null length=15 chars=ascii_letters') }}"
28 delegate_to: localhost
29 no_log: true
30
31 - name: Configure temporary user for test
32 cisco.nxos.nxos_user:
33 name: temp_user
34 configured_password: "{{ temp_passwd }}"
35 no_log: true
36
37 - name: Setup - turn on 'feature scp-server'
38 cisco.nxos.nxos_feature:
39 feature: scp-server
40 state: enabled
41
42 - name: Setup - backup admin password if ansible_user is not admin
43 cisco.nxos.nxos_command:
44 commands:
45 - command: show running-config | include "username admin password"
46 register: nxos_admin_password
47 no_log: true
48 when: ansible_user != "admin"
49
50 - name: Setup - change admin password if ansible_user is not admin
51 cisco.nxos.nxos_user:
52 name: admin
53 configured_password: "{{ temp_passwd }}"
54 when: ansible_user != "admin"
55
56 - name: Copy crt file from ansible controller to bootflash
57 register: result
58 cisco.nxos.nxos_file_copy:
59 local_file: "{{ role_path }}/tests/common/fixtures/{{ item }}"
60 file_system: "bootflash:"
61 connect_ssh_port: "{{ ansible_ssh_port | d(22) }}"
62 loop:
63 - server.crt
64 - new_server.crt
65 - local_server.crt
66 vars:
67 ansible_connection: ansible.netcommon.network_cli
68
69 - name: Run the CLI and NX-API tests
70 block:
71 - name: Include the CLI tasks
72 ansible.builtin.include_tasks: cli.yaml
73 tags: cli
74 when: run_test
75
76 - name: Include the NX-API tasks
77 ansible.builtin.include_tasks: nxapi.yaml
78 tags: nxapi
79 when: run_test
80 always:
81 - name: Remove temporary user
82 cisco.nxos.nxos_user:
83 name: temp_user
84 state: absent
85
86 - name: Turn off 'feature scp-server'
87 cisco.nxos.nxos_feature:
88 feature: scp-server
89 state: disabled
90
91 - name: Setup - remove existing file
92 ignore_errors: true # noqa ignore-errors
93 cisco.nxos.nxos_command:
94 commands:
95 - terminal dont-ask
96 - delete server.crt
97 - delete new_server.crt
98 - delete local_server.crt