---

- name: Install virtualization tools
  apt:
    pkg: "{{item}}"
    state: installed
  become: yes
  tags:
    - virtualization
  with_items:
    - qemu-kvm
    - virt-manager

- name: Download virtio drivers for windows
  get_url:
    url: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.117-1/virtio-win-0.1.117.iso
    dest: /var/lib/libvirt/images/virtio-win-0.1.117.iso
    owner: root
    group: root
  become: yes
  tags:
    - virtualization

- name: Define vms # TODO: Make indepotent
  virt:
    name: "{{ item }} "
    command: define
    xml: "{{ lookup('file', item+'.xml') }}"
  with_items:
    - Ubuntu_base
    - HTPC
    - OSX
  tags:
    - virtualization

- name: Configure networking
  copy:
    src: interfaces
    dest: /etc/network/interfaces
    owner: root
    group: root
    mode: 0644
  become: yes
  notify: Restart networking
  tags:
    - virtualization

---

- name: Install virtualization tools
  apt:
    pkg: "{{item}}"
    state: installed
  become: yes
  tags:
    - virtualization
  with_items:
    - qemu-kvm
    - virt-manager

- name: Download virtio drivers for windows
  get_url:
    url: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.117-1/virtio-win-0.1.117.iso
    dest: /var/lib/libvirt/images/virtio-win-0.1.117.iso
    owner: root
    group: root
  become: yes
  tags:
    - virtualization

- name: Define vms # TODO: Make indepotent
  virt:
    name: "{{ item }} "
    command: define
    xml: "{{ lookup('file', item+'.xml') }}"
  with_items:
    - Ubuntu_base
    - HTPC
    - OSX
  become: yes
  tags:
    - virtualization

- name: Configure networking
  copy:
    src: interfaces
    dest: /etc/network/interfaces
    owner: root
    group: root
    mode: 0644
  become: yes
  notify: Restart networking
  tags:
    - virtualization

Use root to define VMs
Use root to define VMs
