diff options
author | Christian Pointner <equinox@spreadspace.org> | 2018-05-25 02:04:16 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2018-05-25 02:04:16 +0200 |
commit | 46787e1c9b9c574a13dae748d2f8ff89e7b55b8e (patch) | |
tree | 8a6c10959f53886565d873595d3c285fefbe9039 /roles/vm/install/templates/libvirt-domain.xml.j2 | |
parent | move kubernetes roles to subdir (diff) |
remerge vm roles from realraum noc repo
Diffstat (limited to 'roles/vm/install/templates/libvirt-domain.xml.j2')
-rw-r--r-- | roles/vm/install/templates/libvirt-domain.xml.j2 | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/roles/vm/install/templates/libvirt-domain.xml.j2 b/roles/vm/install/templates/libvirt-domain.xml.j2 index c84b1045..2bf4b57b 100644 --- a/roles/vm/install/templates/libvirt-domain.xml.j2 +++ b/roles/vm/install/templates/libvirt-domain.xml.j2 @@ -1,14 +1,14 @@ <domain type='kvm'> - <name>{{ inventory_hostname }}</name> - <memory>{{ vm_install.mem * 1024 }}</memory> - <currentMemory>{{ vm_install.mem * 1024 }}</currentMemory> - <vcpu>{{ vm_install.numcpu }}</vcpu> + <name>{{ vmname }}</name> + <memory>{{ hostvars[vmname].vm_install_cooked.mem * 1024 }}</memory> + <currentMemory>{{ hostvars[vmname].vm_install_cooked.mem * 1024 }}</currentMemory> + <vcpu>{{ hostvars[vmname].vm_install_cooked.numcpu }}</vcpu> <os> <type arch='x86_64' machine='pc-0.12'>hvm</type> {% if run_installer %} - <kernel>{{ hostvars[vm_install.host].vm_host.installer.path }}/{{ vmdistro }}-{{ vmdistcodename }}/{{ vm_install.arch | default('amd64') }}/linux</kernel> - <initrd>{{ hostvars[vm_install.host].vm_host.installer.path }}/{{ vmdistro }}-{{ vmdistcodename }}/{{ vm_install.arch | default('amd64') }}/initrd.gz</initrd> - <cmdline>console=ttyS0,115200n8 auto=true interface=auto url=tftp://{{ hostvars[vm_install.host]['ansible_' + hostvars[vm_install.host].vm_host.installer.net_if].ipv4.address }}/vm-{{ inventory_hostname }}-{{ vmdistro }}-{{ vmdistcodename }}.cfg netcfg/choose_interface=enp1s1 netcfg/disable_autoconfig=true netcfg/get_ipaddress={{ vm_network.primary.ip }} netcfg/get_netmask={{ vm_network.primary.mask }} netcfg/get_gateway={{ vm_network.primary.gateway }} netcfg/get_nameservers="{{ vm_network.primary.nameservers | join(' ') }}" netcfg/confirm_static=true netcfg/get_hostname={{ inventory_hostname }} netcfg/get_domain={{ vm_network.primary.domain }}</cmdline> + <kernel>{{ vm_host.installer.path }}/{{ vmdistro }}-{{ vmdistcodename }}/{{ hostvars[vmname].vm_install_cooked.arch | default('amd64') }}/linux</kernel> + <initrd>{{ vm_host.installer.path }}/{{ vmdistro }}-{{ vmdistcodename }}/{{ hostvars[vmname].vm_install_cooked.arch | default('amd64') }}/initrd.gz</initrd> + <cmdline>console=ttyS0,115200n8 auto=true interface=auto url=tftp://{{ hostvars[inventory_hostname]['ansible_' + (vm_host.installer.net_if | replace('-', '_'))].ipv4.address }}/vm-{{ vmname }}-{{ vmdistro }}-{{ vmdistcodename }}.cfg netcfg/choose_interface=enp1s1 netcfg/disable_autoconfig=true netcfg/get_ipaddress={{ hostvars[vmname].vm_network_cooked.primary.ip }} netcfg/get_netmask={{ hostvars[vmname].vm_network_cooked.primary.mask }} netcfg/get_gateway={{ hostvars[vmname].vm_network_cooked.primary.gateway }} netcfg/get_nameservers="{{ hostvars[vmname].vm_network_cooked.nameservers | join(' ') }}" netcfg/confirm_static=true netcfg/get_hostname={{ vmname }} netcfg/get_domain={{ hostvars[vmname].vm_network_cooked.domain }}</cmdline> {% endif %} <boot dev='hd'/> </os> @@ -29,8 +29,8 @@ <devices> <emulator>/usr/bin/kvm</emulator> -{% if 'virtio' in vm_install.disks %} -{% for device, lv in vm_install.disks.virtio.items() %} +{% if 'virtio' in hostvars[vmname].vm_install_cooked.disks %} +{% for device, lv in hostvars[vmname].vm_install_cooked.disks.virtio.items() %} <disk type='block' device='disk'> <driver name='qemu' type='raw' cache='none' discard='unmap'/> <source dev='/dev/mapper/{{ lv.vg | replace('-', '--') }}-{{ lv.lv | replace('-', '--') }}'/> @@ -39,9 +39,9 @@ {% endfor %} {% endif %} -{% if 'scsi' in vm_install.disks %} +{% if 'scsi' in hostvars[vmname].vm_install_cooked.disks %} <controller type='scsi' index='0' model='virtio-scsi'/> -{% for device, lv in vm_install.disks.scsi.items() %} +{% for device, lv in hostvars[vmname].vm_install_cooked.disks.scsi.items() %} <disk type='block' device='disk'> <driver name='qemu' type='raw' cache='none' discard='unmap'/> <source dev='/dev/mapper/{{ lv.vg | replace('-', '--') }}-{{ lv.lv | replace('-', '--') }}'/> @@ -50,12 +50,12 @@ {% endfor %} {% endif %} -{% if vm_install.interfaces %} -{% for if in vm_install.interfaces %} +{% if hostvars[vmname].vm_install_cooked.interfaces %} +{% for if in hostvars[vmname].vm_install_cooked.interfaces %} <interface type='bridge'> <source bridge='{{ if.bridge }}'/> <model type='virtio'/> - <address type='pci' domain='0x0000' bus='0x01' slot='0x0{{ if.idx }}' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x01' slot='0x0{{ loop.index }}' function='0x0'/> </interface> {% endfor %} {% endif %} |