2.2 KiB
Cloud Init Script
This script automates the setup of a virtual machine using a cloud image in Proxmox, with options to create a template and override any existing virtual machine with the same ID.
Usage
You can execute this script directly using curl
with the following commands:
1. Default Storage (proxmox
) and Default VM Name (ubuntu-cloudinit2404
):
To run the script using the default storage (proxmox
) and the default VM name (ubuntu-cloudinit2404
):
curl -sSL https://git.nixc.us/colin/cloud-init/raw/branch/main/install.sh | bash
2. Specify a Different Storage:
To specify a different storage (local
) while using the default VM name (ubuntu-cloudinit2404
):
curl -sSL https://git.nixc.us/colin/cloud-init/raw/branch/main/install.sh | bash -s -- local
3. Specify a Different Cloud Image, VM Name, and Storage:
To specify a custom cloud image URL, image name, distribution name, version, and storage, the script expects the following parameters in order:
- Cloud Image URL: The URL from where the cloud image will be downloaded.
- Image Name: The name to save the downloaded image file.
- Distribution Name: The name of the distribution (e.g.,
ubuntu
,debian
). - Version: The version of the distribution (e.g.,
2404
,11
). - Storage: The Proxmox storage location (e.g.,
local
,proxmox
).
Example:
curl -sSL https://git.nixc.us/colin/cloud-init/raw/branch/main/install.sh | bash -s -- https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img noble-server-cloudimg-amd64.img ubuntu 2404 local
This command does the following:
- Downloads the cloud image from
https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
. - Saves the image as
noble-server-cloudimg-amd64.img
. - Sets the distribution name as
ubuntu
and the version as2404
. - Uses
local
as the Proxmox storage location.
Manual Template Creation
After configuring your VM, when you're ready, create a template using the following command:
qm template <VM_ID>
Where <VM_ID>
is the ID of the VM you created.
No license or contributors are defined for this script.