Debian Codegraph @

test/integration/targets/facts_linux_network/tasks/main.yml

raw
1 - block:
2 - name: Add IP to interface
3 command: ip address add 100.42.42.1/32 dev {{ ansible_facts.default_ipv4.interface }}
4 ignore_errors: yes
5
6 - name: Gather network facts
7 setup:
8 gather_subset: network
9
10 - name: Ensure broadcast is reported as empty
11 assert:
12 that:
13 - ansible_facts[ansible_facts['default_ipv4']['interface']]['ipv4_secondaries'][0]['broadcast'] == ''
14
15 always:
16 - name: Remove IP from interface
17 command: ip address delete 100.42.42.1/32 dev {{ ansible_facts.default_ipv4.interface }}
18 ignore_errors: yes
19
20 - block:
21 - name: Add bridge device
22 command: ip link add name br1337 type bridge stp_state 1
23
24 - name: Add virtual interface
25 command: ip link add name veth1337 type veth
26
27 - name: Add virtual interface to bridge
28 command: ip link set veth1337 master br1337
29
30 - name: Gather network facts
31 setup:
32 gather_subset: network
33
34 - debug:
35 var: ansible_facts.br1337
36
37 - assert:
38 that:
39 - ansible_facts.br1337.type == 'bridge'
40 - ansible_facts.br1337.id != ''
41 - ansible_facts.br1337.stp is true
42 - ansible_facts.br1337.interfaces|first == 'veth1337'
43
44 always:
45 - name: Remove virtual interface
46 command: ip link delete veth1337 type veth
47 ignore_errors: yes
48
49 - name: Remove bridge device
50 command: ip link delete br1337 type bridge
51 ignore_errors: yes