diff --git a/tasks/RedHat.yml b/tasks/RedHat.yml index 046b229..bb7e38d 100644 --- a/tasks/RedHat.yml +++ b/tasks/RedHat.yml @@ -1,6 +1,11 @@ --- - 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 get_url: @@ -9,4 +14,7 @@ mode: 0644 - 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 diff --git a/tasks/main.yml b/tasks/main.yml index b6e6730..5e22913 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,22 +3,32 @@ include_vars: "{{ ansible_os_family }}.yml" - 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'" - 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'" - name: Include tasks for {{ ansible_os_family }} include_tasks: "{{ ansible_os_family }}.yml" - 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 - 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 include_role: @@ -26,7 +36,7 @@ # vars: # openvswitch_brname: "{{ libvirt_brname }}" when: - - libvirt_openvswitch == true + - libvirt_openvswitch|bool register: install_openvswitch - name: Restart libvirt_kvm after openvswitch installation @@ -41,7 +51,10 @@ # state: present - name: Enable libvirt deamon - service: name="{{ libvirt_service }}" state=started enabled=yes + service: + name: "{{ libvirt_service }}" + state: started + enabled: yes - name: Add defaults networks virt_net: @@ -77,7 +90,7 @@ - '{{ virtual_network }}' when: - virtual_network is defined - - libvirt_openvswitch == true + - libvirt_openvswitch|bool - name: Activate OpenVSwitch networks now if it doesn't already up virt_net: @@ -87,7 +100,7 @@ - '{{ virtual_network }}' when: - virtual_network is defined - - libvirt_openvswitch == true + - libvirt_openvswitch|bool - name: Enable OpenVSwitch networks on boot virt_net: @@ -97,5 +110,5 @@ - '{{ virtual_network }}' when: - virtual_network is defined - - libvirt_openvswitch == true + - libvirt_openvswitch|bool