fix lint
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adrien Reslinger 2020-06-04 10:59:19 +02:00
parent 2630399d24
commit bd9c69b749
2 changed files with 32 additions and 11 deletions

View file

@ -1,6 +1,11 @@
--- ---
- name: Define libvirt-latest CentOS repo - name: Define libvirt-latest CentOS repo
template: src=CentOS-libvirt-latest.repo.j2 dest=/etc/yum.repos.d/CentOS-libvirt-latest.repo owner=root group=root mode=0644 template:
src: CentOS-libvirt-latest.repo.j2
dest: /etc/yum.repos.d/CentOS-libvirt-latest.repo
owner: root
group: root
mode: 0644
- name: Retreive CentOS SIG Virtualization key - name: Retreive CentOS SIG Virtualization key
get_url: get_url:
@ -9,4 +14,7 @@
mode: 0644 mode: 0644
- name: install repo packages - name: install repo packages
package: name="centos-release-qemu-ev" state=latest update_cache=yes package:
name: "centos-release-qemu-ev"
state: present
update_cache: yes

View file

@ -3,22 +3,32 @@
include_vars: "{{ ansible_os_family }}.yml" include_vars: "{{ ansible_os_family }}.yml"
- name: "Ensure system is x86_64" - name: "Ensure system is x86_64"
fail: msg="qemu-kvm requires a 64bit system architecture for now" fail:
msg: "qemu-kvm requires a 64bit system architecture for now"
when: "ansible_architecture != 'x86_64'" when: "ansible_architecture != 'x86_64'"
- name: "Ensure system is hardware virtualization capability" - name: "Ensure system is hardware virtualization capability"
fail: msg="qemu-kvm requires hypervisor capability" fail:
msg: "qemu-kvm requires hypervisor capability"
when: "ansible_virtualization_type != 'kvm'" when: "ansible_virtualization_type != 'kvm'"
- name: Include tasks for {{ ansible_os_family }} - name: Include tasks for {{ ansible_os_family }}
include_tasks: "{{ ansible_os_family }}.yml" include_tasks: "{{ ansible_os_family }}.yml"
- name: install packages - name: install packages
package: name="{{ libvirt_kvm_packages }}" state=latest update_cache=yes package:
name: "{{ libvirt_kvm_packages }}"
state: present
update_cache: yes
notify: Restart libvirt notify: Restart libvirt
- name: Allow hypervisor in VM - name: Allow hypervisor in VM
template: src=kvm.conf.j2 dest=/etc/modprobe.d/kvm.conf owner=root group=root mode=0644 template:
src: kvm.conf.j2
dest: /etc/modprobe.d/kvm.conf
owner: root
group: root
mode: 0644
- name: Install Openvswitch - name: Install Openvswitch
include_role: include_role:
@ -26,7 +36,7 @@
# vars: # vars:
# openvswitch_brname: "{{ libvirt_brname }}" # openvswitch_brname: "{{ libvirt_brname }}"
when: when:
- libvirt_openvswitch == true - libvirt_openvswitch|bool
register: install_openvswitch register: install_openvswitch
- name: Restart libvirt_kvm after openvswitch installation - name: Restart libvirt_kvm after openvswitch installation
@ -41,7 +51,10 @@
# state: present # state: present
- name: Enable libvirt deamon - name: Enable libvirt deamon
service: name="{{ libvirt_service }}" state=started enabled=yes service:
name: "{{ libvirt_service }}"
state: started
enabled: yes
- name: Add defaults networks - name: Add defaults networks
virt_net: virt_net:
@ -77,7 +90,7 @@
- '{{ virtual_network }}' - '{{ virtual_network }}'
when: when:
- virtual_network is defined - virtual_network is defined
- libvirt_openvswitch == true - libvirt_openvswitch|bool
- name: Activate OpenVSwitch networks now if it doesn't already up - name: Activate OpenVSwitch networks now if it doesn't already up
virt_net: virt_net:
@ -87,7 +100,7 @@
- '{{ virtual_network }}' - '{{ virtual_network }}'
when: when:
- virtual_network is defined - virtual_network is defined
- libvirt_openvswitch == true - libvirt_openvswitch|bool
- name: Enable OpenVSwitch networks on boot - name: Enable OpenVSwitch networks on boot
virt_net: virt_net:
@ -97,5 +110,5 @@
- '{{ virtual_network }}' - '{{ virtual_network }}'
when: when:
- virtual_network is defined - virtual_network is defined
- libvirt_openvswitch == true - libvirt_openvswitch|bool