Skip to content

Commit f1bd3da

Browse files
committed
set FQCN on all calls
1 parent 13087d3 commit f1bd3da

12 files changed

+41
-39
lines changed

.github/workflows/molecule.yml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
sudo apt update
3434
sudo apt -y install python3-setuptools python3 python3-pip
3535
pip3 install wheel
36+
pip3 install ansible-compat==0.5.0
3637
pip3 install ansible molecule testinfra yamllint ansible-lint flake8 molecule-vagrant
3738
3839
- name: molecule lint

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ install:
3333
- vagrant plugin install vagrant-libvirt
3434
- pip install wheel pyopenssl
3535
- pip install netaddr python-vagrant yamllint testinfra flake8
36+
- pip install ansible-compat==0.5.0 # see https://github.com/ansible-community/molecule/issues/3404
3637
- pip install ansible ansible-lint
3738
- pip install molecule molecule-vagrant python-vagrant
3839
- sudo chmod o+rwx /var/run/libvirt/libvirt-sock

tasks/config.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Configure services - runs after the install stage
33

44
- name: Set socket directory in libvirtd.conf
5-
lineinfile:
5+
ansible.builtin.lineinfile:
66
path: /etc/libvirt/libvirtd.conf
77
insertafter: '^#unix_sock_dir ='
88
regexp: '^unix_sock_dir ='
@@ -12,7 +12,7 @@
1212
notify: restart libvirt
1313

1414
- name: Create directory for libvirt socket
15-
file:
15+
ansible.builtin.file:
1616
state: directory
1717
path: "{{ libvirt_host_socket_dir }}"
1818
owner: root
@@ -22,7 +22,7 @@
2222
when: libvirt_host_socket_dir | length > 0
2323

2424
- name: Process lineinfile rules
25-
lineinfile: "{{ rule.args }}"
25+
ansible.builtin.lineinfile: "{{ rule.args }}"
2626
become: true
2727
loop: "{{ libvirt_host_lineinfile_extra_rules | default([]) }}"
2828
loop_control:
@@ -32,10 +32,10 @@
3232
- restart libvirt
3333

3434
- name: Flush handlers
35-
meta: flush_handlers
35+
ansible.builtin.meta: flush_handlers
3636

3737
- name: Ensure the libvirt daemon is started and enabled
38-
service:
38+
ansible.builtin.service:
3939
name: libvirtd
4040
state: started
4141
enabled: yes

tasks/install-client.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Ensure libvirt client packages are installed
3-
package:
3+
ansible.builtin.package:
44
name: "{{ libvirt_host_libvirt_packages_client }}"
55
state: present
66
register: result

tasks/install-daemon.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
#
99
# The core team had a a change of heart and it is actually being preserved:
1010
# https://github.com/ansible/ansible/pull/43798
11-
yum_repository: "{{ item }}"
11+
ansible.builtin.yum_repository: "{{ item }}"
1212
loop: "{{ libvirt_host_custom_yum_repos | default([]) }}"
1313
become: true
1414

1515
- name: Ensure libvirt packages are installed
16-
package:
16+
ansible.builtin.package:
1717
name: "{{ libvirt_host_libvirt_packages | select | list }}"
1818
state: present
1919
register: result
@@ -23,7 +23,7 @@
2323

2424
# NOTE: QEMU emulators are available in EPEL.
2525
- name: Ensure the EPEL repository is enabled
26-
yum:
26+
ansible.builtin.yum:
2727
name: epel-release
2828
state: present
2929
register: result
@@ -35,7 +35,7 @@
3535
- libvirt_host_qemu_emulators | length > 0
3636

3737
- name: Ensure QEMU emulator packages are installed
38-
package:
38+
ansible.builtin.package:
3939
name: "{{ package }}"
4040
state: present
4141
loop: "{{ libvirt_host_qemu_emulators | flatten(levels=1) }}"

tasks/main.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
- include: prelude.yml
3-
- include: validate.yml
2+
- ansible.builtin.include_tasks: prelude.yml
3+
- ansible.builtin.include_tasks: validate.yml
44
- include: install-daemon.yml
55
when: libvirt_host_install_daemon | bool
66
- include: install-client.yml
77
when:
88
- not libvirt_host_install_daemon | bool
99
- libvirt_host_install_client | bool
1010
- name: Run post-install stage
11-
include: "{{ post_install_path }}"
11+
ansible.builtin.include_tasks: "{{ post_install_path }}"
1212
with_first_found:
1313
- files:
1414
- post-install-{{ ansible_facts.distribution }}.yml

tasks/networks.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Ensure libvirt networks are defined
3-
virt_net:
3+
community.libvirt.virt_net:
44
name: "{{ item.name }}"
55
command: define
66
xml: "{{ item.xml | default(lookup('template', 'network.xml.j2')) }}"
@@ -9,15 +9,15 @@
99
become: True
1010

1111
- name: Ensure libvirt networks are started on boot
12-
virt_net:
12+
community.libvirt.virt_net:
1313
name: "{{ item.name }}"
1414
autostart: yes
1515
uri: "{{ libvirt_host_uri | default(omit, true) }}"
1616
with_items: "{{ libvirt_host_networks }}"
1717
become: True
1818

1919
- name: Ensure libvirt networks are active
20-
virt_net:
20+
community.libvirt.virt_net:
2121
name: "{{ item.name }}"
2222
state: active
2323
uri: "{{ libvirt_host_uri | default(omit, true) }}"

tasks/pools.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
- name: Include lvm role to create VG
3-
include_role:
3+
ansible.builtin.include_role:
44
name: mrlesmithjr.manage-lvm
55
when:
66
- manage_lvm is defined
77
- manage_lvm
88
- libvirt_host_pools | map(attribute='type') | select('match', '^lvm2$') | join(',') | length > 0
99

1010
- name: Ensure libvirt dir storage pool directories exist
11-
file:
11+
ansible.builtin.file:
1212
path: "{{ item.path }}"
1313
owner: "{{ item.owner }}"
1414
group: "{{ item.group }}"
@@ -18,15 +18,15 @@
1818
loop: "{{ libvirt_host_pools | flatten(levels=1) }}"
1919
become: True
2020

21-
- include_tasks:
21+
- ansible.builtin.include_tasks:
2222
file: rbd.yml
2323
apply:
2424
become: True
2525
when: item.type == "rbd"
2626
loop: "{{ libvirt_host_pools | flatten(levels=1) }}"
2727

2828
- name: Ensure libvirt storage pools are defined
29-
virt_pool:
29+
community.libvirt.virt_pool:
3030
name: "{{ item.name }}"
3131
command: define
3232
xml: "{{ item.xml | default(lookup('template', 'pool.xml.j2')) }}"
@@ -35,7 +35,7 @@
3535
become: True
3636

3737
- name: Check libvirt directory storage pool status
38-
virt_pool:
38+
community.libvirt.virt_pool:
3939
name: "{{ item.name }}"
4040
command: status
4141
uri: "{{ libvirt_host_uri | default(omit, true) }}"
@@ -45,7 +45,7 @@
4545
register: pool_status
4646

4747
- name: Ensure libvirt directory storage pools are built
48-
virt_pool:
48+
community.libvirt.virt_pool:
4949
name: "{{ item.item.name }}"
5050
command: build
5151
uri: "{{ libvirt_host_uri | default(omit, true) }}"
@@ -56,15 +56,15 @@
5656
become: True
5757

5858
- name: Ensure libvirt storage pools are active
59-
virt_pool:
59+
community.libvirt.virt_pool:
6060
name: "{{ item.name }}"
6161
state: active
6262
uri: "{{ libvirt_host_uri | default(omit, true) }}"
6363
loop: "{{ libvirt_host_pools | flatten(levels=1) }}"
6464
become: True
6565

6666
- name: Ensure libvirt storage pools are started on boot
67-
virt_pool:
67+
community.libvirt.virt_pool:
6868
name: "{{ item.name }}"
6969
autostart: yes
7070
uri: "{{ libvirt_host_uri | default(omit, true) }}"

tasks/post-install-Debian.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
# skip being set to true. This is undeseriable so we have to
99
# put it behind an include (a block doesn't work).
1010
- name: Check if /etc/default/libvirt-bin exists
11-
stat:
11+
ansible.builtin.stat:
1212
path: /etc/default/libvirt-bin
1313
register: libvirt_bin_stat
1414
tags: vars
1515

1616
- name: Determine path to libvirt environment file
17-
set_fact:
17+
ansible.builtin.set_fact:
1818
libvirt_host_lineinfile_extra_rules:
1919
- args:
2020
path: "{{ libvirt_env_path }}"
@@ -27,7 +27,7 @@
2727
tags: vars
2828

2929
- name: Configure libvirt QEMU apparmor profile template
30-
lineinfile:
30+
ansible.builtin.lineinfile:
3131
path: "/etc/apparmor.d/libvirt/TEMPLATE.qemu"
3232
insertbefore: "^}"
3333
line: " {{ item.path }}/** rwk,"

tasks/prelude.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is intended to be included at the beginning of a playbook.
33

44
- name: gather os specific variables
5-
include_vars: "{{ item }}"
5+
ansible.builtin.include_vars: "{{ item }}"
66
with_first_found:
77
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
88
- "{{ ansible_facts.distribution }}.yml"

tasks/rbd.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
---
22

33
- name: Install additional packages for rbd support
4-
package:
4+
ansible.builtin.package:
55
name: "{{ libvirt_host_packages_rbd_volume_pool | flatten(levels=1) }}"
66
state: present
77
notify: restart libvirt
88

99
- name: Create temporary file for Ceph secret
10-
tempfile:
10+
ansible.builtin.tempfile:
1111
state: file
1212
suffix: .xml
1313
register: secret_tempfile
1414

1515
- name: Send Ceph secret
16-
template:
16+
ansible.builtin.template:
1717
mode: 0640
1818
src: ceph_secret.xml.j2
1919
dest: "{{ secret_tempfile.path }}"
2020

2121
- name: Define Ceph secret
22-
command: "virsh secret-define {{ secret_tempfile.path }}"
22+
ansible.builtin.command: "virsh secret-define {{ secret_tempfile.path }}"
2323
changed_when: false
2424

2525
- name: Set Ceph secret value
26-
command: "virsh secret-set-value {{ item.name | to_uuid }} {{ item.passphrase }}"
26+
ansible.builtin.command: "virsh secret-set-value {{ item.name | to_uuid }} {{ item.passphrase }}"
2727
changed_when: false
2828

2929
- name: Delete temporary file
30-
file:
30+
ansible.builtin.file:
3131
path: "{{ secret_tempfile.path }}"
3232
state: absent
3333

3434
- name: Flush handlers
35-
meta: flush_handlers
35+
ansible.builtin.meta: flush_handlers

tasks/validate.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
- name: Verify that Virtualization Technology (VT) is enabled
3-
command: grep -c -E 'svm|vmx' /proc/cpuinfo
3+
ansible.builtin.command: grep -c -E 'svm|vmx' /proc/cpuinfo
44
check_mode: False
55
changed_when: False
66
failed_when: False
77
register: result
88

99
- name: Set a fact about whether Virtualization Technology (VT) is enabled
10-
set_fact:
10+
ansible.builtin.set_fact:
1111
libvirt_host_vt_enabled: "{{ result.rc == 0 }}"
1212

1313
- name: Notify if Virtualization Technology (VT) is disabled
14-
debug:
14+
ansible.builtin.debug:
1515
msg: >
1616
Virtualization Technology (VT) is currently disabled. Please enable VT
1717
before running this role again.
@@ -20,7 +20,7 @@
2020
- not libvirt_host_vt_enabled
2121

2222
- name: Fail if Virtualization Technology (VT) is disabled
23-
fail:
23+
ansible.builtin.fail:
2424
msg: >
2525
Virtualization Technology (VT) is currently disabled. Please enable VT
2626
before running this role again.

0 commit comments

Comments
 (0)