Script creating new VMs #252
@ -1,11 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# The base VM was downloaded using the following commands:
|
||||
# mkdir /var/lib/libvirt/images/base
|
||||
# curl -o http://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.img /var/lib/libvirt/images/base/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.qcow2
|
||||
# chown -R libvirt-qemu:root /var/lib/libvirt/images/base
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
echo 'USAGE: create_vm VMNAME'
|
||||
exit 1
|
||||
|
||||
|
@ -26,6 +26,21 @@
|
||||
|
||||
package %w(virtinst libvirt-daemon-system)
|
||||
|
||||
directory "/var/lib/libvirt/images/base" do
|
||||
recursive true
|
||||
owner "libvirt-qemu"
|
||||
group "root"
|
||||
mode "0750"
|
||||
end
|
||||
|
||||
# Base Ubuntu 20.04 image
|
||||
remote_file "/var/lib/libvirt/images/base/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.qcow2" do
|
||||
source "http://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.img"
|
||||
owner "libvirt-qemu"
|
||||
group "root"
|
||||
mode "0640"
|
||||
end
|
||||
|
||||
cookbook_file "/usr/local/sbin/create_vm" do
|
||||
source "create_vm"
|
||||
mode "0750"
|
||||
|
Loading…
x
Reference in New Issue
Block a user
This doesn't look right to me. It would attempt to download the path as a second file, no? The pathname should come after the
-o
flag.However, why not just use a normal file download resource in the KVM host recipe in the first place? Same amount of characters as this extended comment, but then it's automated and handles existing files.