ansible-test/roles/virt_vm/tasks/main.yml

20 lines
442 B
YAML
Raw Normal View History

2021-06-06 21:46:18 +02:00
---
2021-06-09 21:07:20 +02:00
- include_vars: vm_templates.yml
2021-06-06 21:46:18 +02:00
- name: check vm existance
delegate_to: "{{ virt.host }}"
stat:
path: "{{ libvirt.images }}/{{ inventory_hostname }}.qcow2"
get_checksum: false
get_attributes: false
get_mime: false
2021-06-09 21:07:20 +02:00
vars:
virt: "{{ vm_templates[vm_template] }}"
2021-06-06 21:46:18 +02:00
register: vmimg
- name: create vm
include_tasks: create_vm.yml
2021-06-09 21:07:20 +02:00
vars:
virt: "{{ vm_templates[vm_template] }}"
2021-06-06 21:46:18 +02:00
when: not vmimg.stat.exists