lv: "{{ inventory_hostname }}"
size: 10g
interfaces:
- - idx: 1
- bridge: "{{ hostvars[vm_install_host].vm_host.network.interface }}"
- name: primary0
+ - bridge: "{{ hostvars[vm_install_host].vm_host.network.interface }}"
+ name: mgmt0
+ - bridge: "br-http"
+ name: http0
autostart: True
vm_network:
+ nameservers: "{{ hostvars[vm_install_host].vm_host.network.nameservers }}"
+ domain: realraum.at
systemd_link:
interfaces: "{{ vm_install.interfaces }}"
primary:
- interface: primary0
+ interface: mgmt0
ip: "{{ (hostvars[vm_install_host].vm_host.network.ip+'/'+hostvars[vm_install_host].vm_host.network.mask) | ipaddr(hostvars[vm_install_host].vm_host.network.indices[inventory_hostname]) | ipaddr('address') }}"
mask: "{{ hostvars[vm_install_host].vm_host.network.mask }}"
gateway: "{{ hostvars[vm_install_host].vm_host.network.gateway | default(hostvars[vm_install_host].vm_host.network.ip) }}"
- nameservers: "{{ hostvars[vm_install_host].vm_host.network.nameservers }}"
- domain: realraum.at
{% if run_installer %}
<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.primary.nameservers | join(' ') }}" netcfg/confirm_static=true netcfg/get_hostname={{ vmname }} netcfg/get_domain={{ hostvars[vmname].vm_network_cooked.primary.domain }}</cmdline>
+ <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>
<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 %}
#d-i netcfg/get_ipaddress string {{ hostvars[vmname].vm_network_cooked.primary.ip }}
#d-i netcfg/get_netmask string {{ hostvars[vmname].vm_network_cooked.primary.mask }}
#d-i netcfg/get_gateway string {{ hostvars[vmname].vm_network_cooked.primary.gateway }}
-#d-i netcfg/get_nameservers string {{ hostvars[vmname].vm_network_cooked.primary.nameservers | join(' ') }}
+#d-i netcfg/get_nameservers string {{ hostvars[vmname].vm_network_cooked.nameservers | join(' ') }}
#d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string {{ vmname }}
-d-i netcfg/get_domain string {{ hostvars[vmname].vm_network_cooked.primary.domain }}
+d-i netcfg/get_domain string {{ hostvars[vmname].vm_network_cooked.domain }}
d-i netcfg/wireless_wep string
#d-i netcfg/get_ipaddress string {{ hostvars[vmname].vm_network_cooked.primary.ip }}
#d-i netcfg/get_netmask string {{ hostvars[vmname].vm_network_cooked.primary.mask }}
#d-i netcfg/get_gateway string {{ hostvars[vmname].vm_network_cooked.primary.gateway }}
-#d-i netcfg/get_nameservers string {{ hostvars[vmname].vm_network_cooked.primary.nameservers | join(' ') }}
+#d-i netcfg/get_nameservers string {{ hostvars[vmname].vm_network_cooked.nameservers | join(' ') }}
#d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string {{ vmname }}
-d-i netcfg/get_domain string {{ hostvars[vmname].vm_network_cooked.primary.domain }}
+d-i netcfg/get_domain string {{ hostvars[vmname].vm_network_cooked.domain }}
d-i netcfg/wireless_wep string
state: absent
- name: install systemd network link units
+ with_items: "{{ vm_network.systemd_link.interfaces }}"
+ loop_control:
+ index_var: interface_index
template:
src: systemd.link.j2
- dest: "/etc/systemd/network/{{ '%02d' | format(item.idx + 10) }}-{{ item.name }}.link"
- with_items: "{{ vm_network.systemd_link.interfaces }}"
+ dest: "/etc/systemd/network/{{ '%02d' | format(interface_index + 11) }}-{{ item.name }}.link"
notify: rebuild initramfs
when: vm_network.systemd_link is defined
src: interfaces.j2
dest: /etc/network/interfaces
mode: 0644
+
+- name: remove resolvconf package
+ apt:
+ name: resolvconf
+ state: absent
+ purge: yes
+
+- name: generate resolv.conf
+ template:
+ src: resolv.conf.j2
+ dest: /etc/resolv.conf
--- /dev/null
+{% for nsrv in vm_network.nameservers %}
+nameserver {{ nsrv }}
+{% endfor %}
+search {{ vm_network.domain }}
[Match]
-Path=*pci-0000:01:{{ "%02d" | format(item.idx) }}.0
+Path=*pci-0000:01:{{ "%02d" | format(interface_index + 1) }}.0
[Link]
Name={{ item.name }}