diff --git a/proxmox/terraform/init-template.md b/proxmox/terraform/init-template.md index a7b3b5f..4ace337 100644 --- a/proxmox/terraform/init-template.md +++ b/proxmox/terraform/init-template.md @@ -1,180 +1,162 @@ In the following documentation, we will explain the necessary steps needed to initialize a template vm. Expectations: - hypervisor: orsay (could be beaubourg, hypervisor3) - \`/usr/bin/qm\` available from the hypervisor Prepare vm template =================== Connect to hypervisor orsay (\`ssh orsay\`) And then as root, retrieve openstack images: ``` mkdir debian-10 wget -O debian-10/debian-10-openstack-amd64.qcow2 \ https://cdimage.debian.org/cdimage/openstack/current/debian-10.0.1-20190708-openstack-amd64.qcow2 wget -O debian-10/debian-10-openstack-amd64.qcow2.index \ https://cdimage.debian.org/cdimage/openstack/current/debian-10.0.1-20190708-openstack-amd64.qcow2.index mkdir debian-9 wget -O debian-9/debian-9-openstack-amd64.qcow2 \ https://cloud.debian.org/images/cloud/OpenStack/current-9/debian-9-openstack-amd64.qcow2 wget -O debian-9/debian-9-openstack-amd64.qcow2.index \ https://cloud.debian.org/images/cloud/OpenStack/current-9/debian-9-openstack-amd64.qcow2.index ``` Note: - Not presented here but you should check the hashes of what you retrieved from the internet Create vm --------- ``` chmod +x init-template.sh -./init-template.sh 9 +./init-template.sh 10 ``` This created a basic debian-9 vm (based on the cloud-stack one [1]). We still need to connect to it to adapt it prior to make it a template (cf. below). [1] https://cdimage.debian.org/cdimage/openstack/ Check image is working ---------------------- The rationale is to: - boot the vm - check some basic information (kernel, distribution, connection, release, etc...). - adapt slightly the vms (dns resolver, ip, upgrade, etc...) ### Start vm ``` -qm start 9000 +qm start 10000 ``` ### Connect #### ssh ``` ssh root@192.168.100.199 ``` Note: Public/Private Keys are stored in the credential store (`pass ls operations/terraform-proxmox/ssh-key`). #### proxmox console webui Providing you set it a "cipassword" and reboot the vm first: - accessible from - View \`datacenter\` - unfold the hypervisor \`orsay\` menu -- select the vm \`9000\` +- select the vm \`10000\` - click the \`console\` menu. - log in as root/test password ### Checks - kernel linux version - debian release ### Adaptations Update grub's timeout to 0 for a faster boot (as root): ``` -sed -i s'/GRUB_TIMEOUT = 5/GRUB_TIMEOUT = 0/' etc/default/grub +sed -i s'/GRUB_TIMEOUT = 5/GRUB_TIMEOUT = 0/' /etc/default/grub update-grub ``` Then, add some expected defaults: ``` +sed -i 's/nameserver 127.0.0.1/nameserver 192.168.100.29/' /etc/resolv.conf apt update apt upgrade -y apt install -y puppet systemctl stop puppet; systemctl disable puppet.service mkdir -p /etc/facter/facts.d echo location=sesi_rocquencourt_staging > /etc/facter/facts.d/location.txt - -# for stretch (debian-9) -# we need a superior version of facter package -# because we use syntax from that superior version -cat > /etc/apt/sources.list.d/backports.list < /etc/apt/sources.list.d/buster.list <