Compare commits
5 Commits
5ff6046169
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
8d0c6bc301
|
|||
|
80766f2473
|
|||
|
d9a59e064e
|
|||
|
16cb333991
|
|||
|
7386de86d7
|
@@ -81,7 +81,7 @@
|
|||||||
"garage-",
|
"garage-",
|
||||||
"lq-",
|
"lq-",
|
||||||
"rsk-",
|
"rsk-",
|
||||||
"postgres-6"
|
"postgres-11"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-1
Submodule nodes updated: e88e2382ca...2535a79036
@@ -5,6 +5,11 @@
|
|||||||
|
|
||||||
package %w(virtinst libvirt-daemon-system libvirt-clients)
|
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
|
directory "/var/lib/libvirt/images/base" do
|
||||||
recursive true
|
recursive true
|
||||||
owner "libvirt-qemu"
|
owner "libvirt-qemu"
|
||||||
@@ -24,7 +29,10 @@ end
|
|||||||
template "/usr/local/sbin/create_vm" do
|
template "/usr/local/sbin/create_vm" do
|
||||||
source "create_vm.erb"
|
source "create_vm.erb"
|
||||||
mode "0750"
|
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
|
end
|
||||||
|
|
||||||
firewall_rule 'ssh-alt-port' do
|
firewall_rule 'ssh-alt-port' do
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ EOS
|
|||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
<% if @modern_virt_install -%>
|
||||||
virt-install \
|
virt-install \
|
||||||
--name "$VMNAME" \
|
--name "$VMNAME" \
|
||||||
--ram "$RAM" \
|
--ram "$RAM" \
|
||||||
@@ -83,3 +84,30 @@ virt-install \
|
|||||||
--autostart \
|
--autostart \
|
||||||
--import \
|
--import \
|
||||||
--cloud-init root-password-generate=off,disable=on,meta-data=$CIDATA_PATH/meta-data,user-data=$CIDATA_PATH/user-data
|
--cloud-init root-password-generate=off,disable=on,meta-data=$CIDATA_PATH/meta-data,user-data=$CIDATA_PATH/user-data
|
||||||
|
<% else -%>
|
||||||
|
# Legacy path for hosts running virt-install < 4.0.0 (e.g. Ubuntu 20.04,
|
||||||
|
# virt-install 2.2.x). These versions predate the --osinfo/--cloud-init
|
||||||
|
# options, so we build a NoCloud seed ISO from the same user-data and
|
||||||
|
# meta-data files and attach it as a cdrom. The guest receives the
|
||||||
|
# exact same cloud-init configuration as on modern hosts.
|
||||||
|
cloud-localds "$CIDATA_PATH/seed.iso" "$CIDATA_PATH/user-data" "$CIDATA_PATH/meta-data"
|
||||||
|
|
||||||
|
virt-install \
|
||||||
|
--name "$VMNAME" \
|
||||||
|
--ram "$RAM" \
|
||||||
|
--vcpus "$CPUS" \
|
||||||
|
--cpu host \
|
||||||
|
--arch x86_64 \
|
||||||
|
--hvm \
|
||||||
|
--virt-type kvm \
|
||||||
|
--disk "$IMAGE_PATH" \
|
||||||
|
--disk "$CIDATA_PATH/seed.iso,device=cdrom" \
|
||||||
|
--boot hd \
|
||||||
|
--network=bridge=virbr0,model=virtio \
|
||||||
|
--graphics none \
|
||||||
|
--serial pty \
|
||||||
|
--console pty \
|
||||||
|
--channel unix,mode=bind,path=/var/lib/libvirt/qemu/$VMNAME.guest_agent.0,target_type=virtio,name=org.qemu.guest_agent.0 \
|
||||||
|
--autostart \
|
||||||
|
--import
|
||||||
|
<% end -%>
|
||||||
|
|||||||
Reference in New Issue
Block a user