besseres templating für VMs

This commit is contained in:
2021-06-09 21:07:20 +02:00
parent 30617b19a6
commit 00623c7f0c
5 changed files with 29 additions and 14 deletions

View File

@@ -4,7 +4,7 @@
- name: create vm storage
delegate_to: "{{ virt.host }}"
copy:
src: "{{ libvirt.images }}/{{ virt.image }}"
src: "{{ libvirt.images }}/{{ virt.image.filename }}"
dest: "{{ libvirt.images }}/{{ inventory_hostname }}.qcow2"
force: no

View File

@@ -1,4 +1,6 @@
---
- include_vars: vm_templates.yml
- name: check vm existance
delegate_to: "{{ virt.host }}"
stat:
@@ -6,8 +8,12 @@
get_checksum: false
get_attributes: false
get_mime: false
vars:
virt: "{{ vm_templates[vm_template] }}"
register: vmimg
- name: create vm
include_tasks: create_vm.yml
vars:
virt: "{{ vm_templates[vm_template] }}"
when: not vmimg.stat.exists