fix: configurable OVMF/machine type, routes syntax, package lists, interface names
This commit is contained in:
@@ -147,21 +147,27 @@ bootstrap_archlinux: >-
|
|||||||
|
|
||||||
bootstrap_alpine: >-
|
bootstrap_alpine: >-
|
||||||
{{
|
{{
|
||||||
['alpine-base', 'vim']
|
['alpine-base', 'btrfs-progs', 'chrony', 'curl', 'e2fsprogs',
|
||||||
|
'logrotate', 'lvm2', 'python3', 'rsync', 'sudo',
|
||||||
|
'util-linux', 'vim', 'xfsprogs']
|
||||||
+ [('openssh' if system_cfg.features.ssh.enabled | bool else '')]
|
+ [('openssh' if system_cfg.features.ssh.enabled | bool else '')]
|
||||||
+ bootstrap_common_conditional
|
+ bootstrap_common_conditional
|
||||||
}}
|
}}
|
||||||
|
|
||||||
bootstrap_opensuse: >-
|
bootstrap_opensuse: >-
|
||||||
{{
|
{{
|
||||||
['vim']
|
['btrfs-progs', 'chrony', 'curl', 'e2fsprogs',
|
||||||
|
'glibc-locale', 'logrotate', 'lvm2', 'NetworkManager',
|
||||||
|
'python3', 'rsync', 'sudo', 'vim', 'xfsprogs']
|
||||||
+ [('openssh' if system_cfg.features.ssh.enabled | bool else '')]
|
+ [('openssh' if system_cfg.features.ssh.enabled | bool else '')]
|
||||||
+ bootstrap_common_conditional
|
+ bootstrap_common_conditional
|
||||||
}}
|
}}
|
||||||
|
|
||||||
bootstrap_void: >-
|
bootstrap_void: >-
|
||||||
{{
|
{{
|
||||||
['vim']
|
['btrfs-progs', 'chrony', 'curl', 'dhcpcd', 'e2fsprogs',
|
||||||
|
'logrotate', 'lvm2', 'python3', 'rsync', 'sudo',
|
||||||
|
'vim', 'xfsprogs']
|
||||||
+ [('openssh' if system_cfg.features.ssh.enabled | bool else '')]
|
+ [('openssh' if system_cfg.features.ssh.enabled | bool else '')]
|
||||||
+ bootstrap_common_conditional
|
+ bootstrap_common_conditional
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -35,7 +35,12 @@
|
|||||||
- name: Copy NetworkManager keyfile per interface
|
- name: Copy NetworkManager keyfile per interface
|
||||||
vars:
|
vars:
|
||||||
configuration_iface: "{{ item }}"
|
configuration_iface: "{{ item }}"
|
||||||
configuration_iface_name: "{{ configuration_detected_interfaces[idx] | default('eth' ~ idx) }}"
|
configuration_iface_name: >-
|
||||||
|
{{
|
||||||
|
item.name
|
||||||
|
if (item.name | default('') | string | length) > 0
|
||||||
|
else (configuration_detected_interfaces[idx] | default('eth' ~ idx))
|
||||||
|
}}
|
||||||
configuration_net_uuid: "{{ ('LAN-' ~ idx ~ '-' ~ hostname) | ansible.builtin.to_uuid }}"
|
configuration_net_uuid: "{{ ('LAN-' ~ idx ~ '-' ~ hostname) | ansible.builtin.to_uuid }}"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: network.j2
|
src: network.j2
|
||||||
@@ -66,7 +71,9 @@
|
|||||||
auto lo
|
auto lo
|
||||||
iface lo inet loopback
|
iface lo inet loopback
|
||||||
{% for iface in system_cfg.network.interfaces %}
|
{% for iface in system_cfg.network.interfaces %}
|
||||||
{% set iface_name = configuration_detected_interfaces[loop.index0] | default(iface.name | default('eth' ~ loop.index0)) %}
|
{% set inv_name = iface.name | default('') | string %}
|
||||||
|
{% set det_name = configuration_detected_interfaces[loop.index0] | default('eth' ~ loop.index0) %}
|
||||||
|
{% set iface_name = inv_name if inv_name | length > 0 else det_name %}
|
||||||
{% set has_static = (iface.ip | default('') | string | length) > 0 %}
|
{% set has_static = (iface.ip | default('') | string | length) > 0 %}
|
||||||
|
|
||||||
auto {{ iface_name }}
|
auto {{ iface_name }}
|
||||||
@@ -100,7 +107,9 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
content: |
|
content: |
|
||||||
{% for iface in system_cfg.network.interfaces %}
|
{% for iface in system_cfg.network.interfaces %}
|
||||||
{% set iface_name = configuration_detected_interfaces[loop.index0] | default(iface.name | default('eth' ~ loop.index0)) %}
|
{% set inv_name = iface.name | default('') | string %}
|
||||||
|
{% set det_name = configuration_detected_interfaces[loop.index0] | default('eth' ~ loop.index0) %}
|
||||||
|
{% set iface_name = inv_name if inv_name | length > 0 else det_name %}
|
||||||
{% set has_static = (iface.ip | default('') | string | length) > 0 %}
|
{% set has_static = (iface.ip | default('') | string | length) > 0 %}
|
||||||
{% if has_static %}
|
{% if has_static %}
|
||||||
interface {{ iface_name }}
|
interface {{ iface_name }}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
if (system_raw.network.interfaces | default([]) | length > 0)
|
if (system_raw.network.interfaces | default([]) | length > 0)
|
||||||
else (
|
else (
|
||||||
[{
|
[{
|
||||||
'name': 'eth0',
|
'name': '',
|
||||||
'bridge': system_raw.network.bridge | default('') | string,
|
'bridge': system_raw.network.bridge | default('') | string,
|
||||||
'vlan': system_raw.network.vlan | default('') | string,
|
'vlan': system_raw.network.vlan | default('') | string,
|
||||||
'ip': system_raw.network.ip | default('') | string,
|
'ip': system_raw.network.ip | default('') | string,
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ virtualization_libvirt_cloudinit_path: >-
|
|||||||
{{ [virtualization_libvirt_image_dir, hostname ~ '-cloudinit.iso'] | ansible.builtin.path_join }}
|
{{ [virtualization_libvirt_image_dir, hostname ~ '-cloudinit.iso'] | ansible.builtin.path_join }}
|
||||||
virtualization_xen_disk_path: /var/lib/xen/images
|
virtualization_xen_disk_path: /var/lib/xen/images
|
||||||
|
|
||||||
|
virtualization_libvirt_machine_type: q35
|
||||||
|
virtualization_libvirt_ovmf_code: /usr/share/edk2/x64/OVMF_CODE.secboot.4m.fd
|
||||||
|
virtualization_libvirt_ovmf_vars: /usr/share/edk2/x64/OVMF_VARS.4m.fd
|
||||||
|
|
||||||
virtualization_tpm2_enabled: >-
|
virtualization_tpm2_enabled: >-
|
||||||
{{
|
{{
|
||||||
(system_cfg.luks.enabled | bool)
|
(system_cfg.luks.enabled | bool)
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ network:
|
|||||||
addresses:
|
addresses:
|
||||||
- "{{ iface.ip }}/{{ iface.prefix }}"
|
- "{{ iface.ip }}/{{ iface.prefix }}"
|
||||||
{% if iface.gateway | default('') | string | length %}
|
{% if iface.gateway | default('') | string | length %}
|
||||||
gateway4: "{{ iface.gateway }}"
|
routes:
|
||||||
|
- to: default
|
||||||
|
via: "{{ iface.gateway }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
dhcp4: true
|
dhcp4: true
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
{% if system_cfg.balloon is defined and system_cfg.balloon | int > 0 %}<currentMemory>{{ system_cfg.balloon | int * 1024 }}</currentMemory>{% endif %}
|
{% if system_cfg.balloon is defined and system_cfg.balloon | int > 0 %}<currentMemory>{{ system_cfg.balloon | int * 1024 }}</currentMemory>{% endif %}
|
||||||
<vcpu placement='static'>{{ system_cfg.cpus }}</vcpu>
|
<vcpu placement='static'>{{ system_cfg.cpus }}</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='x86_64' machine="pc-q35-8.0">hvm</type>
|
<type arch='x86_64' machine="{{ virtualization_libvirt_machine_type }}">hvm</type>
|
||||||
<bootmenu enable='no'/>
|
<bootmenu enable='no'/>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
<boot dev='cdrom'/>
|
<boot dev='cdrom'/>
|
||||||
<loader readonly="yes" type="pflash">/usr/share/edk2/x64/OVMF_CODE.secboot.4m.fd</loader>
|
<loader readonly="yes" type="pflash">{{ virtualization_libvirt_ovmf_code }}</loader>
|
||||||
<nvram template="/usr/share/edk2/x64/OVMF_VARS.4m.fd"/>
|
<nvram template="{{ virtualization_libvirt_ovmf_vars }}"/>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
<acpi/>
|
||||||
|
|||||||
Reference in New Issue
Block a user