Last active
June 6, 2025 15:29
-
Star
(165)
You must be signed in to star a gist -
Fork
(46)
You must be signed in to fork a gist
Revisions
-
chriswayg revised this gist
Aug 20, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,8 @@ * [Cloud-Init Support - Proxmox VE](https://pve.proxmox.com/wiki/Cloud-Init_Support) * [Proxmox VE Administration Guide](https://pve.proxmox.com/pve-docs/pve-admin-guide.html) ## A script which automates these steps for multiple distros incl. CoreOS, CentOS, Arch and ALpine - [create-cloud-template.sh](https://gist.github.com/chriswayg/43fbea910e024cbe608d7dcb12cb8466) ### Steps for creating an Ubuntu 18.04 cloud template * Using a ready-to-use Ubuntu image -
chriswayg revised this gist
Aug 19, 2019 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,10 @@ # Cloud images in Proxmox * [Preparing Cloud-Init Templates](https://pve.proxmox.com/pve-docs/qm.1.html) * [Cloud-Init Support - Proxmox VE](https://pve.proxmox.com/wiki/Cloud-Init_Support) * [Proxmox VE Administration Guide](https://pve.proxmox.com/pve-docs/pve-admin-guide.html) ## A script which automates these steps for multiple OS https://gist.github.com/chriswayg/43fbea910e024cbe608d7dcb12cb8466 ### Steps for creating an Ubuntu 18.04 cloud template * Using a ready-to-use Ubuntu image -
chriswayg revised this gist
Aug 14, 2019 . 1 changed file with 21 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -97,6 +97,27 @@ qm resize 190 scsi0 +8G qm start 190 ``` ### To fully disable cloud-init When booting under *systemd*, you can disable cloud-init completely by either: * creating a file: `sudo touch /etc/cloud/cloud-init.disabled` * or adding `cloud-init=disabled` to the kernel command line as found in `/proc/cmdline` ### To partially disable cloud-init To partially disable some functions, modify: `/etc/cloud/cloud.cfg`, for example to disable network configuration: ```sh sudo su - echo "network: {config: disabled}" > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg ``` ### To show the Grub Menu on the serial console `sudo nano /etc/default/grub config` ``` GRUB_TERMINAL="console serial" ``` `sudo update-grub` ### Checking cloud-init * [Cloud-init v.18.2: CLI subcommands | Ubuntu](https://ubuntu.com/blog/cloud-init-v-18-2-cli-subcommands) -
chriswayg renamed this gist
Aug 13, 2019 . 1 changed file with 45 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,10 +4,10 @@ * [Proxmox VE Administration Guide](https://pve.proxmox.com/pve-docs/pve-admin-guide.html) * .../pve-docs/chapter-qm.html ### Steps for creating an Ubuntu 18.04 cloud template * Using a ready-to-use Ubuntu image * [Ubuntu 18.04 LTS (Bionic Beaver) Daily Build](https://cloud-images.ubuntu.com/bionic/current/) ```sh wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img @@ -47,6 +47,49 @@ rm -v bionic-server-cloudimg-amd64.img * Login with: `ssh ubuntu@10.10.10.190` ### Steps for creating a Debian 10 cloud template * Using a ready-to-use Debian image * [Debian Official Cloud Images for OpenStack](https://cdimage.debian.org/cdimage/openstack/) ``` wget https://cdimage.debian.org/cdimage/openstack/current/debian-10.0.2-20190721-openstack-amd64.qcow2 # Create a VM qm create 9110 --name debian10-cloud --memory 2048 --net0 virtio,bridge=vmbr1 # Import the disk in qcow2 format (as unused disk) qm importdisk 9110 debian-10.0.2-20190721-openstack-amd64.qcow2 local -format qcow2 # Attach the disk to the vm using VirtIO SCSI qm set 9110 --scsihw virtio-scsi-pci --scsi0 /var/lib/vz/images/9110/vm-9110-disk-0.qcow2 # Important settings qm set 9110 --ide2 local:cloudinit --boot c --bootdisk scsi0 --serial0 socket --vga serial0 # The initial disk is only 2GB, thus we make it larger qm resize 9110 scsi0 +30G # Using a dhcp server on vmbr1 or use static IP qm set 9110 --ipconfig0 ip=dhcp #qm set 9110 --ipconfig0 ip=10.10.10.222/24,gw=10.10.10.1 # user authentication for 'debian' user (optional password) qm set 9110 --sshkey ~/.ssh/id_rsa.pub #qm set 9110 --cipassword AweSomePassword # check the cloud-init config qm cloudinit dump 9110 user # create tempalte and a linked clone qm template 9110 qm clone 9110 191 --name debian10-1 qm start 191 rm -v debian-10.0.2-20190721-openstack-amd64.qcow2 ``` * Login with: `ssh debian@10.10.10.191` #### To resize the VM disk later ``` qm shutdown 190 && qm wait -
chriswayg revised this gist
Aug 13, 2019 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,41 +3,41 @@ * [Cloud-Init Support - Proxmox VE](https://pve.proxmox.com/wiki/Cloud-Init_Support) * [Proxmox VE Administration Guide](https://pve.proxmox.com/pve-docs/pve-admin-guide.html) * .../pve-docs/chapter-qm.html ### Using a ready-to-use Ubuntu Cloud-Init image * [Ubuntu 18.04 LTS (Bionic Beaver) Daily Build](https://cloud-images.ubuntu.com/bionic/current/) - Steps for creating a template ```sh wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img # Create a VM qm create 9000 --name ubuntu1804-templ --memory 2048 --net0 virtio,bridge=vmbr1 # Import the disk in qcow2 format (as unused disk) qm importdisk 9000 bionic-server-cloudimg-amd64.img local -format qcow2 # Attach the disk to the vm using VirtIO SCSI qm set 9000 --scsihw virtio-scsi-pci --scsi0 /var/lib/vz/images/9000/vm-9000-disk-0.qcow2 # Important settings qm set 9000 --ide2 local:cloudinit --boot c --bootdisk scsi0 --serial0 socket --vga serial0 # The initial disk is only 2GB, thus we make it larger qm resize 9000 scsi0 +30G # Using a dhcp server on vmbr1 or use static IP qm set 9000 --ipconfig0 ip=dhcp #qm set 9000 --ipconfig0 ip=10.10.10.222/24,gw=10.10.10.1 # user authentication for 'ubuntu' user (optional password) qm set 9000 --sshkey ~/.ssh/id_rsa.pub #qm set 9000 --cipassword AweSomePassword # check the cloud-init config qm cloudinit dump 9000 user # create tempalte and a linked clone qm template 9000 qm clone 9000 190 --name ubuntu1804-1 qm start 190 @@ -47,7 +47,7 @@ rm -v bionic-server-cloudimg-amd64.img * Login with: `ssh ubuntu@10.10.10.190` #### To resize the VM disk later ``` qm shutdown 190 && qm wait qm resize 190 scsi0 +8G -
chriswayg revised this gist
Aug 13, 2019 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,11 @@ * [Cloud-Init Support - Proxmox VE](https://pve.proxmox.com/wiki/Cloud-Init_Support) * [Proxmox VE Administration Guide](https://pve.proxmox.com/pve-docs/pve-admin-guide.html) * .../pve-docs/chapter-qm.html * [Ubuntu 18.04 LTS (Bionic Beaver) Daily Build](https://cloud-images.ubuntu.com/bionic/current/) ### Using a ready-to-use Ubuntu Cloud-Init image - steps for creating a template ```sh wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img -
chriswayg created this gist
Aug 13, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ # Ubuntu Cloud image in Proxmox * [Preparing Cloud-Init Templates](https://pve.proxmox.com/pve-docs/qm.1.html) * [Cloud-Init Support - Proxmox VE](https://pve.proxmox.com/wiki/Cloud-Init_Support) * [Proxmox VE Administration Guide](https://pve.proxmox.com/pve-docs/pve-admin-guide.html) * .../pve-docs/chapter-qm.html * using a ready-to-use Ubuntu Cloud-Init image * [Ubuntu 18.04 LTS (Bionic Beaver) Daily Build](https://cloud-images.ubuntu.com/bionic/current/) ```sh wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img # create a VM qm create 9000 --name ubuntu1804-templ --memory 2048 --net0 virtio,bridge=vmbr1 # Import the disk in qcow2 format (as unused disk) qm importdisk 9000 bionic-server-cloudimg-amd64.img local -format qcow2 # attach the disk to the vm using VirtIO SCSI qm set 9000 --scsihw virtio-scsi-pci --scsi0 /var/lib/vz/images/9000/vm-9000-disk-0.qcow2 # Importtant settings qm set 9000 --ide2 local:cloudinit --boot c --bootdisk scsi0 --serial0 socket --vga serial0 # The initial disk is only 2GB qm resize 9000 scsi0 +30G # Use the dhcp server on vmbr1 or use static IP qm set 9000 --ipconfig0 ip=dhcp # , change with # user authentication for 'ubuntu' user (optional password) qm set 9000 --sshkey ~/.ssh/id_rsa.pub qm set 9000 --cipassword AweSomePassword # check the cloud-init config qm cloudinit dump 9000 user # create tempalte and full clone qm template 9000 qm clone 9000 190 --name ubuntu1804-1 qm start 190 rm -v bionic-server-cloudimg-amd64.img ``` * Login with: `ssh ubuntu@10.10.10.190` * - How to resize the VM disk later ``` qm shutdown 190 && qm wait qm resize 190 scsi0 +8G qm start 190 ``` ### Checking cloud-init * [Cloud-init v.18.2: CLI subcommands | Ubuntu](https://ubuntu.com/blog/cloud-init-v-18-2-cli-subcommands) * [Directory layout — Cloud-Init 19.2 documentation](https://cloudinit.readthedocs.io/en/latest/topics/dir_layout.html) * [Testing and debugging cloud-init — Cloud-Init 19.2 documentation](https://cloudinit.readthedocs.io/en/latest/topics/debugging.html) [cloud-localds(1) — cloud-image-utils — Debian testing — Debian Manpages](https://manpages.debian.org/testing/cloud-image-utils/cloud-localds.1.en.html) ### Convert Images https://docs.openstack.org/image-guide/convert-images.html ``` qemu-img convert -f raw -O qcow2 bionic-server-cloudimg-amd64.img bionic-server-cloudimg-amd64.qcow2 ```