24 lines
554 B
YAML
24 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
|