aboutsummaryrefslogtreecommitdiffstats
path: root/roles/vmm/templates/vm.conf.j2
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-11-07 20:38:07 +0100
committerbinary <me@rgoncalves.se>2020-11-07 20:38:07 +0100
commit352c98322771af117a85904d580e1c062062d634 (patch)
treed3bca9d27d6ee5d678264d83fc22030d274f30bf /roles/vmm/templates/vm.conf.j2
parent282be811d2ac07a76d56ac066df5bf33d748bd64 (diff)
downloadinfrastructure-352c98322771af117a85904d580e1c062062d634.tar.gz
Refactor vmm role with automation
Diffstat (limited to 'roles/vmm/templates/vm.conf.j2')
-rw-r--r--roles/vmm/templates/vm.conf.j216
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 }}
}
remember that computers suck.