diff --git a/roles/bootstrap/vars/main.yml b/roles/bootstrap/vars/main.yml index 8abe67d..1dc3deb 100644 --- a/roles/bootstrap/vars/main.yml +++ b/roles/bootstrap/vars/main.yml @@ -147,21 +147,27 @@ bootstrap_archlinux: >- 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 '')] + bootstrap_common_conditional }} 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 '')] + bootstrap_common_conditional }} 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 '')] + bootstrap_common_conditional }} diff --git a/roles/configuration/tasks/network.yml b/roles/configuration/tasks/network.yml index aea2b2d..1494123 100644 --- a/roles/configuration/tasks/network.yml +++ b/roles/configuration/tasks/network.yml @@ -35,7 +35,12 @@ - name: Copy NetworkManager keyfile per interface vars: 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 }}" ansible.builtin.template: src: network.j2 @@ -66,7 +71,9 @@ auto lo iface lo inet loopback {% 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 %} auto {{ iface_name }} @@ -100,7 +107,9 @@ mode: "0644" content: | {% 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 %} {% if has_static %} interface {{ iface_name }} diff --git a/roles/global_defaults/tasks/system.yml b/roles/global_defaults/tasks/system.yml index 4889f55..5c21592 100644 --- a/roles/global_defaults/tasks/system.yml +++ b/roles/global_defaults/tasks/system.yml @@ -98,7 +98,7 @@ if (system_raw.network.interfaces | default([]) | length > 0) else ( [{ - 'name': 'eth0', + 'name': '', 'bridge': system_raw.network.bridge | default('') | string, 'vlan': system_raw.network.vlan | default('') | string, 'ip': system_raw.network.ip | default('') | string, diff --git a/roles/virtualization/defaults/main.yml b/roles/virtualization/defaults/main.yml index eb7a7be..fbd549a 100644 --- a/roles/virtualization/defaults/main.yml +++ b/roles/virtualization/defaults/main.yml @@ -11,6 +11,10 @@ virtualization_libvirt_cloudinit_path: >- {{ [virtualization_libvirt_image_dir, hostname ~ '-cloudinit.iso'] | ansible.builtin.path_join }} 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: >- {{ (system_cfg.luks.enabled | bool) diff --git a/roles/virtualization/templates/cloud-network-config.yml.j2 b/roles/virtualization/templates/cloud-network-config.yml.j2 index f98b601..7f5c142 100644 --- a/roles/virtualization/templates/cloud-network-config.yml.j2 +++ b/roles/virtualization/templates/cloud-network-config.yml.j2 @@ -13,7 +13,9 @@ network: addresses: - "{{ iface.ip }}/{{ iface.prefix }}" {% if iface.gateway | default('') | string | length %} - gateway4: "{{ iface.gateway }}" + routes: + - to: default + via: "{{ iface.gateway }}" {% endif %} {% else %} dhcp4: true diff --git a/roles/virtualization/templates/vm.xml.j2 b/roles/virtualization/templates/vm.xml.j2 index 73d662f..9d5f1b1 100644 --- a/roles/virtualization/templates/vm.xml.j2 +++ b/roles/virtualization/templates/vm.xml.j2 @@ -4,12 +4,12 @@ {% if system_cfg.balloon is defined and system_cfg.balloon | int > 0 %}{{ system_cfg.balloon | int * 1024 }}{% endif %} {{ system_cfg.cpus }} - hvm + hvm - /usr/share/edk2/x64/OVMF_CODE.secboot.4m.fd - + {{ virtualization_libvirt_ovmf_code }} +