From e1056eb38f102ea832d9cb47ff7c3b84de655e98 Mon Sep 17 00:00:00 2001 From: Mischa Taylor Date: Sun, 16 Jun 2024 13:19:38 +0000 Subject: [PATCH] Add bootstra_vm.md --- docs/bootstrap_vm.md | 191 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 docs/bootstrap_vm.md diff --git a/docs/bootstrap_vm.md b/docs/bootstrap_vm.md new file mode 100644 index 0000000..4cfa927 --- /dev/null +++ b/docs/bootstrap_vm.md @@ -0,0 +1,191 @@ +# Bootstrapping Chef + + +``` +curl -LO https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img + +$ qemu-img info jammy-server-cloudimg-amd64.img +image: jammy-server-cloudimg-amd64.img +file format: qcow2 +virtual size: 2.2 GiB (2361393152 bytes) +disk size: 620 MiB +cluster_size: 65536 +Format specific information: + compat: 0.10 + compression type: zlib + refcount bits: 16 + +sudo qemu-img convert \ + -f qcow2 \ + -O qcow2 \ + jammy-server-cloudimg-amd64.img \ + /var/lib/libvirt/images/ubuntu-server-2204.qcow2 +sudo qemu-img resize \ + -f qcow2 \ + /var/lib/libvirt/images/ubuntu-server-2204.qcow2 \ + 32G +``` + +``` +touch network-config + +cat >meta-data <user-data < + + + + +
+ +--> + +virsh snapshot-create-as --domain ubuntu-server-2204 --name clean --description "Initial install" + +# Nameless snapshot +virsh snapshot-create ubuntu-server-2204 +virsh snapshot-list ubuntu-server-2204 +virsh snapshot-revert ubuntu-server-2204 clean +virsh snapshot-delete ubuntu-server-2204 clean + +virsh destroy ubuntu-server-2404 +virsh undefine ubuntu-server-2404 --nvram --remove-all-storage +``` + +``` +# chefctl uses a shebang that points at /opt/chef, so make sure we have a link +# in place for compatibility +sudo mkdir -p /etc/cinc +# -n must be here in case /etc/chef already exists, otherwise +# it tries to create /etc/chef/cinc +# /etc/chef -> /etc/cinc +sudo ln -snf /etc/cinc /etc/chef + +curl -L https://omnitruck.cinc.sh/install.sh | sudo bash + +# /opt/chef -> /opt/cinc +sudo ln -snf /opt/cinc /opt/chef + +sudo tee /etc/cinc/client-prod.rb <