aboutsummaryrefslogtreecommitdiffstats
path: root/roles/vmm/templates
diff options
context:
space:
mode:
Diffstat (limited to 'roles/vmm/templates')
-rw-r--r--roles/vmm/templates/hostname.j21
-rw-r--r--roles/vmm/templates/vm.conf.j216
2 files changed, 9 insertions, 8 deletions
diff --git a/roles/vmm/templates/hostname.j2 b/roles/vmm/templates/hostname.j2
new file mode 100644
index 0000000..68b989a
--- /dev/null
+++ b/roles/vmm/templates/hostname.j2
@@ -0,0 +1 @@
+add {{ vmm.switch.interface_host }}
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.