This commit is contained in:
parent
2630399d24
commit
bd9c69b749
2 changed files with 32 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue