Debian Codegraph @

ansible_collections/cisco/nxos/tests/integration/targets/prepare_nxos_tests/tasks/prepare.yml

raw symbols SCIP
1 ---
2 - name: Enable feature privilege
3 connection: ansible.netcommon.network_cli
4 ignore_errors: true # noqa ignore-errors
5 cisco.nxos.nxos_config:
6 lines:
7 - feature privilege
8
9 - name: Enable feature NX-API
10 connection: ansible.netcommon.network_cli
11 cisco.nxos.nxos_nxapi:
12 state: present
13
14 - name: Enable lldp
15 connection: ansible.netcommon.network_cli
16 ignore_errors: true # noqa ignore-errors
17 cisco.nxos.nxos_config:
18 lines:
19 - feature lldp
20
21 - name: Collect interface list
22 connection: ansible.netcommon.network_cli
23 register: intout
24 cisco.nxos.nxos_command:
25 commands:
26 - show interface brief | json
27
28 - name: Set a fact for 'intdataraw'
29 ansible.builtin.set_fact:
30 intdataraw: "{{ intout.stdout_lines[0]['TABLE_interface']['ROW_interface'] }}"
31
32 - name: Set a fact for 'nxos_int1'
33 ansible.builtin.set_fact:
34 nxos_int1: "{{ intdataraw[1].interface }}"
35
36 - name: Set a fact for 'nxos_int2'
37 ansible.builtin.set_fact:
38 nxos_int2: "{{ intdataraw[2].interface }}"
39
40 - name: Set a fact for 'nxos_int3'
41 ansible.builtin.set_fact:
42 nxos_int3: "{{ intdataraw[3].interface }}"
43
44 - name: Gather image version info
45 connection: ansible.netcommon.network_cli
46 register: nxos_version_output
47 cisco.nxos.nxos_command:
48 commands:
49 - show version | json
50
51 - name: Set a fact for 'image_version'
52 ansible.builtin.set_fact:
53 image_version: "{{ nxos_version_output.stdout[0]['kickstart_ver_str'] }}"
54
55 - name: Gather platform info
56 connection: ansible.netcommon.network_cli
57 register: nxos_inventory_output
58 cisco.nxos.nxos_command:
59 commands:
60 - show inventory | json
61
62 - name: Set a fact for 'platform'
63 ansible.builtin.set_fact:
64 platform: "{{ nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'][0]['productid'].split('-')[0] }}"
65
66 - name: Set a fact for 'chassis_type'
67 ansible.builtin.set_fact:
68 chassis_type: "{{ nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'][0]['productid'].split('-')[1] }}"
69
70 - name: Set a fact for 'fretta'
71 ansible.builtin.set_fact:
72 fretta: "{% for row in nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'] if '-R' in row['productid'] %}true{% endfor %}"
73 when: platform is match("N9K|N3K")
74
75 - name: Set a fact for 'platform'
76 ansible.builtin.set_fact:
77 platform: N3K-F
78 when: (platform is match("N3K")) and (fretta is search("true"))
79
80 - name: Set a fact for 'platform'
81 ansible.builtin.set_fact:
82 platform: N9K-F
83 when: (platform is match("N9K")) and (fretta is search("true"))
84
85 - name: Set a fact for 'titanium'
86 ansible.builtin.set_fact:
87 titanium: "false"
88
89 - name: Set a fact for 'titanium'
90 ansible.builtin.set_fact:
91 titanium: "{% for row in nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'] if 'NX-OSv' in row['desc']%}true{% endfor %}"
92 when: platform is match("N7K")
93
94 - name: Set a fact for 'platform'
95 ansible.builtin.set_fact:
96 platform: N35
97 when: (chassis_type is search("C35"))
98
99 - name: Set a fact for 'platform'
100 ansible.builtin.set_fact:
101 platform: N35NG
102 when: (chassis_type is search("C35")) and image_version is search("7.0\(3\)I7")
103
104 - name: Set a fact for 'platform'
105 ansible.builtin.set_fact:
106 platform: N3L
107 when: (chassis_type is search("C3048"))
108
109 - name: Set a fact for 'imagetag'
110 ansible.builtin.set_fact:
111 imagetag: ""
112
113 - name: Set a fact for 'imagemr'
114 ansible.builtin.set_fact:
115 imagemr: ""
116
117 - name: Set a fact for 'major_version'
118 ansible.builtin.set_fact:
119 major_version: "{{ image_version[0:3] }}"
120
121 - name: Set a fact for 'imagetag'
122 ansible.builtin.set_fact:
123 imagetag: "{{ image_version[0:3] }}"
124 when: image_version is search("\d\.\d\(\d\)")
125
126 - name: Set a fact for 'imagetag'
127 ansible.builtin.set_fact:
128 imagetag: "{{ image_version[6:8] }}"
129 when: image_version is search("\d\.\d\(\d\)\S\S\(\d\)")
130
131 - name: Set a fact for 'imagetag'
132 ansible.builtin.set_fact:
133 imagetag: "{{ image_version[6:10] }}"
134 when: image_version is search("\d\.\d\(\d\)\S\S\S\S\(\d\)")
135
136 - name: Set a fact for 'imagemr'
137 ansible.builtin.set_fact:
138 imagemr: "{{ image_version[4:5] }}"
139 when: image_version is search("\d\.\d\(\d\)")
140
141 - name: Set a fact for 'imagemr'
142 ansible.builtin.set_fact:
143 imagemr: "{{ image_version[9:10] }}"
144 when: image_version is search("\d\.\d\(\d\)\S\S\(\d\)")
145
146 - name: Set a fact for 'imagemr'
147 ansible.builtin.set_fact:
148 imagemr: "{{ image_version[11:12] }}"
149 when: image_version is search("\d\.\d\(\d\)\S\S\S\S\(\d\)")
150
151 - name: Debug output the image version
152 ansible.builtin.debug:
153 msg: IMAGE VERSION {{ image_version }}
154
155 - name: Debug output the image tag
156 ansible.builtin.debug:
157 msg: IMAGE TAG {{ imagetag }}
158
159 - name: Debug output the image maintenance release
160 ansible.builtin.debug:
161 msg: IMAGE MR {{ imagemr }}
162
163 - name: Set a fact for 'ipv6_supported'
164 ansible.builtin.set_fact:
165 ipv6_supported: "true"
166
167 - name: Set a fact for 'ipv6_supported'
168 ansible.builtin.set_fact:
169 ipv6_supported: "false"
170 when: platform is match("N35")