Make create_vm work on all OS versions in use

Makes it work with the same cloudinit code on Ubuntu 20.04 by mounting
it from a custom ISO as CD-ROM
This commit is contained in:
2026-07-24 15:19:59 +02:00
parent 093a98b753
commit 7386de86d7
2 changed files with 37 additions and 1 deletions
+9 -1
View File
@@ -5,6 +5,11 @@
package %w(virtinst libvirt-daemon-system libvirt-clients)
# Required on legacy hosts (Ubuntu 20.04) to build the NoCloud seed ISO
# via cloud-localds. Modern virt-install (>= 4.0.0, Ubuntu >= 22.04)
# handles cloud-init natively via --cloud-init and does not need it.
package "cloud-image-utils" if node["platform_version"].to_f < 22.04
directory "/var/lib/libvirt/images/base" do
recursive true
owner "libvirt-qemu"
@@ -24,7 +29,10 @@ end
template "/usr/local/sbin/create_vm" do
source "create_vm.erb"
mode "0750"
variables base_image_path: node["kosmos_kvm"]["host"]["qemu_base_image"]["path"]
variables(
base_image_path: node["kosmos_kvm"]["host"]["qemu_base_image"]["path"],
modern_virt_install: node["platform_version"].to_f >= 22.04
)
end
firewall_rule 'ssh-alt-port' do