ansible-ffibk/loctevm-reset-vm.inc.yml

25 lines
570 B
YAML
Raw Normal View History

2016-07-26 17:32:47 +02:00
---
- name: find already defined local VMs
virt: command=list_vms
delegate_to: 127.0.0.1 # local action
# become: True
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