Skip to content

Add scripts for automated Ubuntu VM creation using cloud images and cloud-init - #278

Merged
bubacoder merged 1 commit into
mainfrom
feature/ubuntu-cloud-image
Feb 4, 2026
Merged

Add scripts for automated Ubuntu VM creation using cloud images and cloud-init#278
bubacoder merged 1 commit into
mainfrom
feature/ubuntu-cloud-image

Conversation

@bubacoder

@bubacoder bubacoder commented Feb 4, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added automated Ubuntu VM provisioning for Proxmox using cloud images with checksum verification and optional download-only mode.
  • Documentation

    • Updated deployment guides to recommend cloud image approach as primary method with quickstart instructions and feature comparison.
  • Chores

    • Updated default VM configuration values.

@coderabbitai

coderabbitai Bot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

A new Bash script automates Proxmox VM provisioning using Ubuntu cloud images with cloud-init configuration. The script downloads verified images, generates cloud-init user-data, and creates fully configured VMs. Configuration variables in an existing script are updated, and documentation is reorganized to prioritize the cloud-init deployment method.

Changes

Cohort / File(s) Summary
Cloud VM Provisioning Script
proxmox/create-ubuntu-cloud-vm.sh
New script with 177 lines introducing four functions: get_authorized_keys(), download_cloud_image(), create_cloud_init_config(), and create_vm(). Orchestrates image download with checksum verification, cloud-init configuration generation, and Proxmox VM creation with network and storage setup. Supports --download-only mode for image staging.
VM Configuration Updates
proxmox/create-ubuntu-server-vm.sh
Updated readonly variables: VMNAME changed from "nest2" to "ubuntu-server-test" and VMID changed from 150 to 300.
Documentation Reorganization
proxmox/ubuntu.md
Restructured to prioritize cloud-init with cloud image method as recommended approach. Added "How it works" subsection, quickstart deployment sequence, cloud-init verification steps, and method comparison table. Repositioned autoinstall section and clarified configuration requirements.

Sequence Diagram

sequenceDiagram
    actor User
    participant Script as create-ubuntu-<br/>cloud-vm.sh
    participant HTTP as Ubuntu<br/>Cloud Server
    participant FS as Local<br/>Filesystem
    participant Proxmox as Proxmox<br/>qm Commands
    participant VM as Ubuntu<br/>Cloud-init VM

    User->>Script: Execute with --vmid, --vmname
    Script->>Script: Parse arguments & validate
    
    rect rgba(100, 150, 255, 0.5)
    Note over Script,HTTP: Download & Verify Image
    Script->>HTTP: Request cloud image
    HTTP-->>Script: Image data
    Script->>HTTP: Request SHA256SUMS
    HTTP-->>Script: Checksums
    Script->>FS: Write & verify image
    FS-->>Script: Verification result
    end
    
    alt Download-only mode
        Script-->>User: Image ready
    else VM Creation
    rect rgba(100, 200, 100, 0.5)
    Note over Script,FS: Generate Cloud-init Config
    Script->>Script: get_authorized_keys()
    Script->>FS: Write user-data config
    FS-->>Script: Config file path
    end
    
    rect rgba(200, 150, 100, 0.5)
    Note over Script,Proxmox: Create & Configure VM
    Script->>Proxmox: qm create (disk, CPU, memory)
    Proxmox-->>Script: VM created
    Script->>Proxmox: qm set (network, boot order)
    Proxmox-->>Script: VM configured
    Script->>Proxmox: Set cicustom (cloud-init)
    Proxmox-->>Script: Cloud-init linked
    Script->>Proxmox: qm start
    Proxmox->>VM: Boot VM
    VM->>VM: Apply cloud-init config
    VM-->>User: Ready
    end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: introduction of new scripts for automated Ubuntu VM creation using cloud images and cloud-init, which is the primary focus of the pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/ubuntu-cloud-image

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@proxmox/create-ubuntu-cloud-vm.sh`:
- Around line 18-20: The comment above readonly PASSWORD_HASH incorrectly states
SHA-512 while the hash uses the $5$ (SHA-256) prefix; either update the comment
to reflect SHA-256 (change the --method note to SHA-256) or regenerate the
PASSWORD_HASH using SHA-512 (ensuring the new hash has a $6$ prefix) and replace
the current value, and keep the shellcheck disable comment as-is.
🧹 Nitpick comments (1)
proxmox/create-ubuntu-cloud-vm.sh (1)

87-88: Empty ssh_authorized_keys produces valid but potentially unexpected YAML.

If ~/.ssh/authorized_keys is empty or missing, get_authorized_keys returns nothing, resulting in:

    ssh_authorized_keys:

packages:

This is technically valid YAML (empty sequence), but consider adding a comment or conditional to make the intent clearer, or omit the key entirely when there are no keys.

Optional: Conditional ssh_authorized_keys block
+get_ssh_authorized_keys_block() {
+    local AUTHORIZED_KEYS_FILE=~/.ssh/authorized_keys
+    if [ -s "$AUTHORIZED_KEYS_FILE" ]; then
+        echo "    ssh_authorized_keys:"
+        sed 's/^/      - /' "$AUTHORIZED_KEYS_FILE"
+    fi
+}

Then in the heredoc, replace lines 87-88 with:

$(get_ssh_authorized_keys_block)

Comment thread proxmox/create-ubuntu-cloud-vm.sh
@bubacoder
bubacoder merged commit 82aec9a into main Feb 4, 2026
4 checks passed
@bubacoder
bubacoder deleted the feature/ubuntu-cloud-image branch February 4, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant