Commit | Line | Data |
---|---|---|
455bd8ef KS |
1 | --- |
2 | - name: Merge defaults | |
3 | set_fact: | |
4 | vm: "{{vm_defaults|combine(object)}}" | |
5 | - name: Create VM disk | |
6 | when: vm.disk | |
7 | ansible.builtin.command: | |
8 | argv: [ | |
9 | 'qemu-img', 'create', '-f', 'qcow2', | |
10 | "{{vm.disk}}", "{{vm.disk_capacity}}", | |
11 | ] | |
12 | creates: "{{vm.disk}}" | |
13 | - name: Define VM | |
14 | # Note: is vm.uuid is not set and the template is changed, those changes will not be applied | |
15 | # Note: many changes will require the VM to be destroyed then started again | |
16 | community.libvirt.virt: | |
17 | command: define | |
18 | xml: "{{lookup('template', vm.template|default('vm_template.xml.j2'))}}" | |
19 | autostart: true |