From bf636f0288de08ac3d39bd6b9f162fe6a75103f0 Mon Sep 17 00:00:00 2001 From: Minimumax <66018049+mptm436@users.noreply.github.com> Date: Fri, 6 Oct 2023 10:12:03 +0800 Subject: [PATCH] patch: latest Packer deployment for pve8 (#385) * fix: update on packer template hcl file * fix: update to the latest distro version * fix: add packer init procedure to avoid plugin missing error * chore: add reference link * Update packer-templates/http/user-data --------- Co-authored-by: kev <31861128+yqlbu@users.noreply.github.com> --- packer-templates/README.md | 1 + packer-templates/bakery-config.json | 10 +++++----- packer-templates/http/user-data | 6 +++--- packer-templates/proxmox-packer-template.pkr.hcl | 14 +++++++++++++- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/packer-templates/README.md b/packer-templates/README.md index ba0b3713..71a951d4 100644 --- a/packer-templates/README.md +++ b/packer-templates/README.md @@ -58,6 +58,7 @@ $ brew install hashicorp/tap/packer # verify installation $ packer ``` +Run `packer init` to install necessary plugins For detailed instructions on how to install Packer on other platforms or Linux distributions, please head to this [ Getting Started ](https://learn.hashicorp.com/tutorials/packer/get-started-install-cli) guide. diff --git a/packer-templates/bakery-config.json b/packer-templates/bakery-config.json index 81aea543..8cb0cdc3 100644 --- a/packer-templates/bakery-config.json +++ b/packer-templates/bakery-config.json @@ -6,27 +6,27 @@ }, "ubuntu-2204-server": { "image_name": "ubuntu-2204-server", - "iso": "ubuntu-22.04.1-live-server-amd64.iso", + "iso": "ubuntu-22.04.3-live-server-amd64.iso", "playbook": "ubuntu-2204-1-server.yml" }, "docker-ubuntu-2204-server": { "image_name": "docker-ubuntu-2204-server", - "iso": "ubuntu-22.04.1-live-server-amd64.iso", + "iso": "ubuntu-22.04.3-live-server-amd64.iso", "playbook": "docker-2204-ubuntu-server.yml" }, "containerd-ubuntu-2204-server": { "image_name": "containerd-ubuntu-2204-server", - "iso": "ubuntu-22.04.1-live-server-amd64.iso", + "iso": "ubuntu-22.04.3-live-server-amd64.iso", "playbook": "containerd-ubuntu-2204-server.yml" }, "cn-ubuntu-2204-server": { "image_name": "cn-ubuntu-2204-server", - "iso": "ubuntu-22.04.1-live-server-amd64.iso", + "iso": "ubuntu-22.04.3-live-server-amd64.iso", "playbook": "cn-ubuntu-2204-server.yml" }, "custom": { "image_name": "custom-server", - "iso": "ubuntu-22.04.1-live-server-amd64.iso", + "iso": "ubuntu-22.04.3-live-server-amd64.iso", "playbook": "custom.yml" } } diff --git a/packer-templates/http/user-data b/packer-templates/http/user-data index a6853f3b..3968bf82 100644 --- a/packer-templates/http/user-data +++ b/packer-templates/http/user-data @@ -1,10 +1,10 @@ -#cloud-config +# cloud-init-modules-config +# https://cloudinit.readthedocs.io/en/latest/reference/modules.html autoinstall: version: 1 locale: en_US keyboard: - layout: en - variant: us + layout: us write_files: - path: /etc/sysctl.d/10-disable-ipv6.conf permissions: 0644 diff --git a/packer-templates/proxmox-packer-template.pkr.hcl b/packer-templates/proxmox-packer-template.pkr.hcl index 27989570..6b683345 100644 --- a/packer-templates/proxmox-packer-template.pkr.hcl +++ b/packer-templates/proxmox-packer-template.pkr.hcl @@ -1,3 +1,16 @@ +packer { + required_plugins { + proxmox = { + version = ">= 1.1.5" + source = "github.com/hashicorp/proxmox" + } + ansible = { + source = "github.com/hashicorp/ansible" + version = "~> 1" + } + } +} + # Variable Definitions variable "proxmox_host" { type = string } variable "proxmox_api_user" { type = string } @@ -124,7 +137,6 @@ build { post-processor "shell-local" { inline = [ "ssh root@${var.proxmox_host} qm set ${var.vm_id} --boot c --bootdisk scsi0", # set boot order - "ssh root@${var.proxmox_host} qm set ${var.vm_id} --ide0 ${var.cloud_init_storage_pool}:cloudinit", # ensure cloud-init drive is present "ssh root@${var.proxmox_host} qm set ${var.vm_id} --delete ide2", # delete default iso "ssh root@${var.proxmox_host} qm set ${var.vm_id} --vga std", # set default graphics type "ssh root@${var.proxmox_host} qm set ${var.vm_id} --ciuser ${var.ssh_username}", # set cloud-init default user