ansible-ffibk/loctevm-provide-vm.inc.yml
2016-08-31 15:51:14 +02:00

23 lines
554 B
YAML

---
- name: find already defined local VMs
virt: command=list_vms
delegate_to: 127.0.0.1 # local action
register: vms
- block:
- name: construct VM xml file
template:
src: templates/loctevm.xml
dest: "{{ vm_path }}/loctevm.xml"
delegate_to: 127.0.0.1 # local action
- name: define VM
virt:
command: define
name: "{{ inventory_hostname }}"
xml: "{{ lookup('file',vm_path ~ '/loctevm.xml') }}"
delegate_to: 127.0.0.1 # local action
when: not inventory_hostname in vms.list_vms
# block end