Skip to content

Commit f60e682

Browse files
committed
set FQCN on all calls
1 parent 4e1d9b5 commit f60e682

File tree

7 files changed

+29
-29
lines changed

7 files changed

+29
-29
lines changed

tasks/autodetect.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
- name: Detect the virtualisation engine
33
block:
44
- name: Load the kvm kernel module
5-
modprobe:
5+
community.general.modprobe:
66
name: kvm
77
become: true
88
failed_when: false
99

1010
- name: Check for the KVM device
11-
stat:
11+
ansible.builtin.stat:
1212
path: /dev/kvm
1313
register: stat_kvm
1414

1515
- name: Set a fact containing the virtualisation engine
16-
set_fact:
16+
ansible.builtin.set_fact:
1717
libvirt_vm_engine: >-
1818
{%- if ansible_facts.architecture != libvirt_vm_arch -%}
1919
{# Virtualisation instructions are generally available only for the host
@@ -32,7 +32,7 @@
3232
block:
3333
- block:
3434
- name: Detect the KVM emulator binary path
35-
stat:
35+
ansible.builtin.stat:
3636
path: "{{ item }}"
3737
register: kvm_emulator_result
3838
with_items:
@@ -49,12 +49,12 @@
4949

5050
- block:
5151
- name: Detect the QEMU emulator binary path
52-
stat:
52+
ansible.builtin.stat:
5353
path: /usr/libexec/qemu-kvm
5454
register: kvm_emulator_result
5555

5656
- name: Set a fact containing the QEMU emulator binary path
57-
set_fact:
57+
ansible.builtin.set_fact:
5858
libvirt_vm_emulator: "{{ kvm_emulator_result.stat.path }}"
5959
when: kvm_emulator_result.stat.exists
6060
when:
@@ -64,7 +64,7 @@
6464

6565
- block:
6666
- name: Detect the QEMU emulator binary path
67-
shell: which qemu-system-{{ libvirt_vm_arch }}
67+
ansible.builtin.command: "which qemu-system-{{ libvirt_vm_arch }}"
6868
register: qemu_emulator_result
6969
changed_when: false
7070

@@ -77,7 +77,7 @@
7777
- ansible_facts.os_family != 'RedHat' or ansible_facts.distribution_major_version | int == 7
7878

7979
- name: Fail if unable to detect the emulator
80-
fail:
80+
ansible.builtin.fail:
8181
msg: Unable to detect emulator for engine {{ libvirt_vm_engine }}.
8282
when: libvirt_vm_emulator is none
8383
when: libvirt_vm_emulator is none or libvirt_vm_emulator | length == 0

tasks/check-interface.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Check network interface has a network name
3-
fail:
3+
ansible.builtin.fail:
44
msg: >
55
The interface definition {{ interface }} has type 'network', but does not have
66
a network name defined.
@@ -10,7 +10,7 @@
1010
- interface.network is not defined
1111

1212
- name: Check direct interface has an interface device name
13-
fail:
13+
ansible.builtin.fail:
1414
msg: >
1515
The interface definition {{ interface }} has type 'direct', but does not have
1616
a host source device defined.

tasks/destroy-vm.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# The destroyed state does not seem to be idempotent, so check whether the VM
33
# exists before destroying it.
44
- name: Check the VM's status
5-
virt:
5+
community.libvirt.virt:
66
name: "{{ vm.name }}"
77
command: list_vms
88
uri: "{{ libvirt_vm_uri | default(omit, true) }}"
@@ -11,7 +11,7 @@
1111

1212
- block:
1313
- name: Ensure the VM is absent
14-
virt:
14+
community.libvirt.virt:
1515
name: "{{ vm.name }}"
1616
state: destroyed
1717
uri: "{{ libvirt_vm_uri | default(omit, true) }}"
@@ -23,7 +23,7 @@
2323
# actually contains an nvram element rather than relying on
2424
# boot_firmware having the correct value.
2525
- name: Ensure the VM is undefined
26-
command:
26+
ansible.builtin.command:
2727
cmd: >-
2828
virsh
2929
{% if libvirt_vm_uri %}-c {{ libvirt_vm_uri }}{% endif %}

tasks/destroy-volumes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Ensure the VM volumes do not exist
3-
script: >
3+
ansible.builtin.script: >
44
destroy_virt_volume.sh
55
{{ item.name }}
66
{{ item.pool | default('default') }}

tasks/main.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
- name: Gather os specific variables
3-
include_vars: "{{ item }}"
3+
ansible.builtin.include_vars: "{{ item }}"
44
with_first_found:
55
- files:
66
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
77
- "{{ ansible_facts.distribution }}.yml"
88
- "{{ ansible_facts.os_family }}.yml"
99
tags: vars
1010

11-
- include_tasks: autodetect.yml
11+
- ansible.builtin.include_tasks: autodetect.yml
1212
# We don't need to know the engine and emulator if we're not creating any new
1313
# VMs.
1414
when: >-
@@ -17,20 +17,20 @@
1717
1818
# Libvirt requires qemu-img to create qcow2 files.
1919
- name: Ensure qemu-img is installed
20-
package:
20+
ansible.builtin.package:
2121
name: "{{ 'qemu-img' if ansible_facts.os_family == 'RedHat' else 'qemu-utils' }}"
2222
update_cache: "{{ True if ansible_facts.pkg_mgr == 'apt' else omit }}"
2323
become: true
2424

25-
- include_tasks: volumes.yml
25+
- ansible.builtin.include_tasks: volumes.yml
2626
vars:
2727
volumes: "{{ vm.volumes | default([], true) }}"
2828
with_items: "{{ libvirt_vms }}"
2929
loop_control:
3030
loop_var: vm
3131
when: (vm.state | default('present', true)) == 'present'
3232

33-
- include_tasks: vm.yml
33+
- ansible.builtin.include_tasks: vm.yml
3434
vars:
3535
console_log_enabled: "{{ vm.console_log_enabled | default(false) }}"
3636
console_log_path: >-
@@ -51,15 +51,15 @@
5151
loop_var: vm
5252
when: (vm.state | default('present', true)) == 'present'
5353

54-
- include_tasks: destroy-vm.yml
54+
- ansible.builtin.include_tasks: destroy-vm.yml
5555
vars:
5656
boot_firmware: "{{ vm.boot_firmware | default('bios', true) | lower }}"
5757
with_items: "{{ libvirt_vms }}"
5858
loop_control:
5959
loop_var: vm
6060
when: (vm.state | default('present', true)) == 'absent'
6161

62-
- include_tasks: destroy-volumes.yml
62+
- ansible.builtin.include_tasks: destroy-volumes.yml
6363
vars:
6464
volumes: "{{ vm.volumes | default([], true) }}"
6565
with_items: "{{ libvirt_vms }}"

tasks/vm.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Ensure the VM console log directory exists
3-
file:
3+
ansible.builtin.file:
44
path: "{{ console_log_path | dirname }}"
55
state: directory
66
owner: "{{ libvirt_vm_log_owner }}"
@@ -11,21 +11,21 @@
1111
become: "{{ libvirt_vm_sudo }}"
1212

1313
- name: Validate VM interfaces
14-
include_tasks: check-interface.yml
14+
ansible.builtin.include_tasks: check-interface.yml
1515
vars:
1616
interface: "{{ item }}"
1717
with_items: "{{ interfaces }}"
1818

1919
- name: Ensure the VM is defined
20-
virt:
20+
community.libvirt.virt:
2121
name: "{{ vm.name }}"
2222
command: define
2323
xml: "{{ lookup('template', vm.xml_file | default('vm.xml.j2')) }}"
2424
uri: "{{ libvirt_vm_uri | default(omit, true) }}"
2525
become: "{{ libvirt_vm_sudo }}"
2626

2727
- name: Ensure the VM is running and started at boot
28-
virt:
28+
community.libvirt.virt:
2929
name: "{{ vm.name }}"
3030
autostart: "{{ autostart | bool }}"
3131
state: "{{ 'running' if (start | bool) else 'shutdown' }}"

tasks/volumes.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
- name: Ensure remote images are downloaded
3-
get_url:
3+
ansible.builtin.get_url:
44
url: "{{ item.image }}"
55
dest: "{{ libvirt_vm_image_cache_path }}/{{ item.image | basename }}"
66
checksum: "{{ item.checksum | default(omit) }}"
77
with_items: "{{ volumes | selectattr('image', 'defined') | list }}"
88
when: "'http' in item.image"
99

1010
- name: Ensure local images are copied
11-
copy:
11+
ansible.builtin.copy:
1212
src: "{{ item.image }}"
1313
dest: "{{ libvirt_vm_image_cache_path }}/{{ item.image | basename }}"
1414
checksum: "{{ item.checksum | default(omit) }}"
@@ -17,7 +17,7 @@
1717
when: "'http' not in item.image"
1818

1919
- name: Ensure the VM disk volumes exist
20-
script: >
20+
ansible.builtin.script: >
2121
virt_volume.sh
2222
-n {{ item.name }}
2323
-p {{ item.pool |default('default') }}
@@ -40,7 +40,7 @@
4040
become: true
4141

4242
- name: Ensure the VM network volumes exist
43-
command: qemu-img create -f {{ item.source.protocol }} {{ item.source.protocol }}:{{ item.source.name }} {{ item.capacity }}
43+
ansible.builtin.command: qemu-img create -f {{ item.source.protocol }} {{ item.source.protocol }}:{{ item.source.name }} {{ item.capacity }}
4444
with_items: "{{ volumes }}"
4545
when: item.type | default(libvirt_volume_default_type) == 'network'
4646
register: volume_result_network

0 commit comments

Comments
 (0)