Debian Codegraph @

ansible_collections/community/libvirt/tests/integration/targets/virt_interfaces/tasks/main.yml

raw
1 ---
2 - name: Create VM XML definition
3 template:
4 src: files/vm_template.xml.j2
5 dest: "/tmp/{{ vm_name }}.xml"
6
7 - name: Define VM
8 community.libvirt.virt:
9 command: define
10 xml: "{{ lookup('file', '/tmp/' + vm_name + '.xml') }}"
11 uri: qemu:///system
12
13 - name: Validate the VM
14 community.libvirt.virt:
15 command: list_vms
16 register: vm_list
17
18 - name: Show VMs
19 debug:
20 var: vm_list
21
22 - name: register vm info
23 community.libvirt.virt:
24 command: get_interfaces
25 name: "{{ vm_name }}"
26 register: vminfo
27
28 - name: debug result
29 debug:
30 msg: "{{ vminfo }}"
31
32 - name: Assert First Mac Address present
33 assert:
34 that:
35 - "vminfo['network_interfaces']['interface_1']['mac'] == mac_address"
36 fail_msg: "Mac address does not match or is missing. Expected: {{ mac_address }}, Got: {{ vminfo['network_interfaces']['interface_1']['mac'] }}"
37 success_msg: "Original variable from defaults: {{ mac_address }} found in netowrking output"
38
39
40 - name: Assert Second Mac Address present
41 assert:
42 that:
43 - "vminfo['network_interfaces']['interface_2']['mac'] == mac_address_2"
44 fail_msg: "Mac address does not match or is missing. Expected: {{ mac_address_2 }}, Got: {{ vminfo['network_interfaces']['interface_2']['mac'] }}"
45 success_msg: "Original variable from defaults: {{ mac_address_2 }} found in netowrking output"