Debian Codegraph @

ansible_collections/cisco/ios/tests/integration/targets/prepare_ios_tests/tasks/main.yml

raw
1 ---
2 - name: Ensure we have loopback 888 for testing
3 connection: ansible.netcommon.network_cli
4 become: true
5 cisco.ios.ios_config:
6 src: config.j2
7
8 - name: Set test facts shorter_hostname
9 ansible.builtin.set_fact:
10 shorter_hostname: '{{ inventory_hostname_short | truncate(10, True, "") }}'
11
12 - name: Discover IOS l2/l3 switch type
13 connection: ansible.netcommon.network_cli
14 become: true
15 register: result
16 cisco.ios.ios_command:
17 commands:
18 - show version
19
20 - name: Set test facts
21 ansible.builtin.set_fact:
22 switch_type: ""
23
24 - name: Set test facts to layer 2
25 ansible.builtin.set_fact:
26 switch_type: "L2"
27 when: '"l2" in result.stdout[0]'
28
29 - name: Block to set facts
30 when: "'Cisco IOS' in result.stdout[0]"
31 block:
32 - name: Set test interface to gigabitethernet0/1 as we are on cisco IOS
33 ansible.builtin.set_fact:
34 test_interface: GigabitEthernet2
35
36 - name: Set test interface 2 to gigabitethernet0/2 as we are on cisco IOS
37 ansible.builtin.set_fact:
38 test_interface2: GigabitEthernet3
39
40 - name: Block to fix configuration
41 when: "'Cisco IOS-XE' in result.stdout[0]"
42 block:
43 - name: Set test interface to gigabitethernet2 as we are on cisco ios-xe
44 ansible.builtin.set_fact:
45 test_interface: GigabitEthernet2
46
47 - name: Disable autonegotiation on gigabitethernet2
48 cisco.ios.ios_config:
49 lines:
50 - no negotiation auto
51 parents: int GigabitEthernet2
52 become: true
53
54 - name: Set test interface 2 to gigabitethernet3 as we are on cisco ios-xe
55 ansible.builtin.set_fact:
56 test_interface2: GigabitEthernet3
57
58 - name: Disable autonegotiation on gigabitethernet3
59 cisco.ios.ios_config:
60 lines:
61 - no negotiation auto
62 parents: int GigabitEthernet3
63 become: true