|
1 | 1 | --- |
2 | 2 | - name: Gather os specific variables |
3 | | - include_vars: "{{ item }}" |
| 3 | + ansible.builtin.include_vars: "{{ item }}" |
4 | 4 | with_first_found: |
5 | 5 | - files: |
6 | 6 | - "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml" |
7 | 7 | - "{{ ansible_facts.distribution }}.yml" |
8 | 8 | - "{{ ansible_facts.os_family }}.yml" |
9 | 9 | tags: vars |
10 | 10 |
|
11 | | -- include_tasks: autodetect.yml |
| 11 | +- ansible.builtin.include_tasks: autodetect.yml |
12 | 12 | # We don't need to know the engine and emulator if we're not creating any new |
13 | 13 | # VMs. |
14 | 14 | when: >- |
|
17 | 17 |
|
18 | 18 | # Libvirt requires qemu-img to create qcow2 files. |
19 | 19 | - name: Ensure qemu-img is installed |
20 | | - package: |
| 20 | + ansible.builtin.package: |
21 | 21 | name: "{{ 'qemu-img' if ansible_facts.os_family == 'RedHat' else 'qemu-utils' }}" |
22 | 22 | update_cache: "{{ True if ansible_facts.pkg_mgr == 'apt' else omit }}" |
23 | 23 | become: true |
24 | 24 |
|
25 | | -- include_tasks: volumes.yml |
| 25 | +- ansible.builtin.include_tasks: volumes.yml |
26 | 26 | vars: |
27 | 27 | volumes: "{{ vm.volumes | default([], true) }}" |
28 | 28 | with_items: "{{ libvirt_vms }}" |
29 | 29 | loop_control: |
30 | 30 | loop_var: vm |
31 | 31 | when: (vm.state | default('present', true)) == 'present' |
32 | 32 |
|
33 | | -- include_tasks: vm.yml |
| 33 | +- ansible.builtin.include_tasks: vm.yml |
34 | 34 | vars: |
35 | 35 | console_log_enabled: "{{ vm.console_log_enabled | default(false) }}" |
36 | 36 | console_log_path: >- |
|
45 | 45 | autostart: "{{ vm.autostart | default(true) }}" |
46 | 46 | enable_vnc: "{{ vm.enable_vnc | default(false) }}" |
47 | 47 | enable_spice: "{{ vm.enable_spice | default(false) }}" |
| 48 | + boot_firmware: "{{ vm.boot_firmware | default('bios', true) | lower }}" |
48 | 49 | with_items: "{{ libvirt_vms }}" |
49 | 50 | loop_control: |
50 | 51 | loop_var: vm |
51 | 52 | when: (vm.state | default('present', true)) == 'present' |
52 | 53 |
|
53 | | -- include_tasks: destroy-vm.yml |
| 54 | +- ansible.builtin.include_tasks: destroy-vm.yml |
| 55 | + vars: |
| 56 | + boot_firmware: "{{ vm.boot_firmware | default('bios', true) | lower }}" |
54 | 57 | with_items: "{{ libvirt_vms }}" |
55 | 58 | loop_control: |
56 | 59 | loop_var: vm |
57 | 60 | when: (vm.state | default('present', true)) == 'absent' |
58 | 61 |
|
59 | | -- include_tasks: destroy-volumes.yml |
| 62 | +- ansible.builtin.include_tasks: destroy-volumes.yml |
60 | 63 | vars: |
61 | 64 | volumes: "{{ vm.volumes | default([], true) }}" |
62 | 65 | with_items: "{{ libvirt_vms }}" |
|
0 commit comments