diff options
Diffstat (limited to 'roles/vmm/templates/vm.conf.j2')
-rw-r--r-- | roles/vmm/templates/vm.conf.j2 | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/roles/vmm/templates/vm.conf.j2 b/roles/vmm/templates/vm.conf.j2 index 88be7fb..2665c16 100644 --- a/roles/vmm/templates/vm.conf.j2 +++ b/roles/vmm/templates/vm.conf.j2 @@ -1,22 +1,22 @@ #jinja2: trim_blocks: True, lstrip_blocks: True -{% for vm in vm.hosts %} -{% set vm = hostvars[vm] %} +{% for vm in vms if hostvars[vm.name] is defined %} +{% set guest = hostvars[vm.name] %} -vm "{{ vm.ansible_host }}" { - {% if vm.enabled %} +vm "{{ guest.ansible_host }}" { + {% if vm.enabled and vm.enabled is defined %} enable {% else %} disable {% endif %} memory {{ vm.memory }} - disk "{{ vmm.disk.dir }}/{{ vm.ansible_host }}.{{ vmm.disk.format }}" + disk "{{ vmm.disk_dir }}/{{ guest.ansible_host }}.{{ vmm.disk_format }}" interface { - switch "{{ vmm.config.switch.name }}" + switch "{{ vmm.switch.name }}" } } {% endfor %} -switch "{{ vmm.config.switch.name }}" { - interface {{ vmm.config.switch.interface }} +switch "{{ vmm.switch.name }}" { + interface {{ vmm.switch.interface }} } |