---
# Ensure this file is written before kvm_intel or kvm_amd module is loaded
- name: enable nested kvm
  template: src=etc/modprobe.d/kvm-nested.conf dest=/etc/modprobe.d/kvm-nested.conf owner=root group=root mode=0644

- action: apt pkg={{ item }}
  with_items:
    - libvirt-bin
    - python-libvirt
    - kvm
    - open-iscsi

- name: ensure kvm is supported by cpu and enabled in bios
  command: kvm-ok
  when: "'{{ nova.libvirt_type }}' == 'kvm'"
  changed_when: False

# Ensure roles/nova-common/tasks/main.yml runs first, otherwise this will not be a system user
- user: name=nova groups=libvirtd

- file: dest=/var/lib/nova/instances state=directory owner=nova

- template: src=etc/init/nova-compute.conf dest=/etc/init/nova-compute.conf owner=root group=root mode=0644

- service: name=nova-compute state=started

---
# Ensure this file is written before kvm_intel or kvm_amd module is loaded
- name: enable nested kvm
  template: src=etc/modprobe.d/kvm-nested.conf dest=/etc/modprobe.d/kvm-nested.conf owner=root group=root mode=0644

- action: apt pkg={{ item }}
  with_items:
    - libvirt-bin
    - python-libvirt
    - kvm
    - open-iscsi

- name: ensure kvm is supported by cpu and enabled in bios
  command: kvm-ok
  when: "'{{ nova.libvirt_type }}' == 'kvm'"
  changed_when: False

- name: disable libvirt default network autostart
  file: dest=/etc/libvirt/qemu/networks/autostart/default.xml state=absent
# On a host which has already started libvirt with this network we will want to run
#  shell: virsh net-destroy default

# Ensure roles/nova-common/tasks/main.yml runs first, otherwise this will not be a system user
- user: name=nova groups=libvirtd

- file: dest=/var/lib/nova/instances state=directory owner=nova

- template: src=etc/init/nova-compute.conf dest=/etc/init/nova-compute.conf owner=root group=root mode=0644

- service: name=nova-compute state=started

Disable default libvirt network from starting automaticly
Disable default libvirt network from starting automaticly
