Fix linter issues
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Adrien Reslinger 2022-11-30 07:46:38 +01:00
parent d5ee4dc2f6
commit 70ec9068e8
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
6 changed files with 45 additions and 47 deletions

View file

@ -1,3 +1,2 @@
---
qemu_default_network_interface: brdefaults

View file

@ -1,4 +1,5 @@
---
- name: Restart libvirt
service: name="{{ libvirt_service }}" state=restarted
ansible.builtin.service:
name: "{{ libvirt_service }}"
state: restarted

View file

@ -6,11 +6,11 @@ galaxy_info:
galaxy_tags: []
license: GPL2
platforms:
- name: CentOS
version:
- 7
- 8
- name: RedHat
version:
- 7
- 8
- name: CentOS
version:
- 7
- 8
- name: RedHat
version:
- 7
- 8

View file

@ -1,6 +1,6 @@
---
- name: Define libvirt-latest CentOS repo
template:
ansible.builtin.template:
src: CentOS-libvirt-latest.repo.j2
dest: /etc/yum.repos.d/CentOS-libvirt-latest.repo
owner: root
@ -8,13 +8,13 @@
mode: 0644
- name: Retreive CentOS SIG Virtualization key
get_url:
ansible.builtin.get_url:
url: https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-Virtualization
dest: /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization
mode: 0644
- name: install repo packages
package:
ansible.builtin.package:
name: "centos-release-qemu-ev"
state: present
update_cache: yes
update_cache: true

View file

@ -1,14 +1,14 @@
---
- name: Include vars for {{ ansible_os_family }}
include_vars: "{{ ansible_os_family }}.yml"
ansible.builtin.include_vars: "{{ ansible_os_family }}.yml"
- name: "Ensure system is hardware virtualization capability"
fail:
ansible.builtin.fail:
msg: "qemu-kvm requires hypervisor capability"
when: "ansible_virtualization_type != 'kvm'"
- name: Include tasks for {{ ansible_os_family }}
include_tasks: "{{ ansible_os_family }}.yml"
ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml"
when:
- ansible_distribution == 'CentOS'
- ansible_distribution_major_version == '7'
@ -25,14 +25,14 @@
# vg: vg_sys
# thinpool: libvirt_var
# size: "{{ lv_libvirt_size | default('20g') }}"
#
#
# - name: Create cache pool logical volume
# community.general.lvol:
# vg: firefly
# lv: lvcache
# size: 512m
# opts: --type cache-pool
#
#
# - name: Verify or create backup LV
# community.general.lvol:
# lv: libvirt_var
@ -40,12 +40,12 @@
# state: present
# active: yes
# size: 200G
#
#
# - name: Verify or apply filesystem for backup LV
# ansible.builtin.filesystem:
# fstype: ext4
# dev: "/dev/mapper/vg_sys-libvirt_var"
#
#
# - name: Create /var/lib/libvirt directory
# ansible.builtin.file:
# path: /var/lib/libvirt
@ -53,7 +53,7 @@
# owner: root
# group: root
# mode: 0755
#
#
# - name: mount /var/lib/libvirt
# ansible.posix.mount:
# name: /var/lib/libvirt
@ -63,14 +63,14 @@
# state: mounted
- name: install packages
package:
ansible.builtin.package:
name: "{{ libvirt_kvm_packages }}"
state: present
update_cache: yes
update_cache: true
notify: Restart libvirt
- name: Allow hypervisor in VM
template:
ansible.builtin.template:
src: kvm.conf.j2
dest: /etc/modprobe.d/kvm.conf
owner: root
@ -78,7 +78,7 @@
mode: 0644
- name: Install OpenVSwitch
include_role:
ansible.builtin.include_role:
name: openvswitch
# vars:
# openvswitch_brname: "{{ libvirt_brname }}"
@ -87,25 +87,25 @@
register: install_openvswitch
- name: Restart libvirt_kvm after openvswitch installation
service:
ansible.builtin.service:
name: "{{ libvirt_service }}"
state: restarted
#- name: Add OpenVSwitch bridge
# openvswitch_bridge:
# bridge: '{{ qemu_default_network_interface }}'
# parent: '{{ openvswitch_interface }}'
# state: present
# - name: Add OpenVSwitch bridge
# openvswitch.openvswitch.openvswitch_bridge:
# bridge: '{{ qemu_default_network_interface }}'
# parent: '{{ openvswitch_interface }}'
# state: present
- name: Enable libvirt deamon
service:
ansible.builtin.service:
name: "{{ libvirt_service }}"
state: started
enabled: yes
enabled: true
- name: Add defaults networks
virt_net:
command: define
community.libvirt.virt_net:
ansible.builtin.command: define
name: '{{ item }}'
xml: '{{ lookup ("template", "networks/" + item + ".xml.j2") }}'
with_items:
@ -113,15 +113,15 @@
- private
- name: Enable defaults networks on boot
virt_net:
community.libvirt.virt_net:
name: '{{ item }}'
autostart: yes
autostart: true
with_items:
- default
- private
- name: Activate defaults networks now if it doesn't already up
virt_net:
community.libvirt.virt_net:
name: '{{ item }}'
state: active
with_items:
@ -129,8 +129,8 @@
- private
- name: Add OpenVSwitch networks
virt_net:
command: define
community.libvirt.virt_net:
ansible.builtin.command: define
name: '{{ item.name }}'
xml: '{{ lookup ("template", "networks/openvswitch.xml.j2") }}'
with_items:
@ -140,7 +140,7 @@
- libvirt_openvswitch|bool
- name: Activate OpenVSwitch networks now if it doesn't already up
virt_net:
community.libvirt.virt_net:
name: '{{ item.name }}'
state: active
with_items:
@ -150,12 +150,11 @@
- libvirt_openvswitch|bool
- name: Enable OpenVSwitch networks on boot
virt_net:
community.libvirt.virt_net:
name: '{{ item.name }}'
autostart: yes
autostart: true
with_items:
- '{{ virtual_network }}'
when:
- virtual_network is defined
- libvirt_openvswitch|bool

View file

@ -31,4 +31,3 @@ libvirt_kvm_packages:
# - virt-backup
# - virt-install
libvirt_service: libvirtd