This commit is contained in:
Serge Logvinov
2024-08-14 09:37:15 +03:00
parent 474eff2499
commit e048cf0fe5
8 changed files with 0 additions and 217 deletions

View File

@@ -1,6 +0,0 @@
release:
packer build -only=release.hcloud.talos .
develop:
packer build -only=develop.hcloud.talos .

View File

@@ -1,55 +0,0 @@
packer {
required_plugins {
hcloud = {
version = ">= 1.0.4"
source = "github.com/hashicorp/hcloud"
}
}
}
source "hcloud" "talos" {
token = var.hcloud_token
rescue = "linux64"
image = "debian-11"
location = "hel1"
server_type = "cx11"
ssh_username = "root"
snapshot_name = "talos system disk"
snapshot_labels = {
type = "infra",
os = "talos",
version = "${var.talos_version}",
}
}
build {
name = "release"
sources = ["source.hcloud.talos"]
provisioner "shell" {
inline = [
"apt-get install -y wget",
"wget -O /tmp/talos.raw.xz ${local.image}",
"xz -d -c /tmp/talos.raw.xz | dd of=/dev/sda && sync",
"mount /dev/sda3 /mnt && sed -i 's/set timeout=3/set timeout=10/g' /mnt/grub/grub.cfg && umount /mnt"
]
}
}
build {
name = "develop"
sources = ["source.hcloud.talos"]
provisioner "file" {
source = "hcloud-amd64.raw.xz"
destination = "/tmp/talos.raw.xz"
}
provisioner "shell" {
inline = [
"xz -d -c /tmp/talos.raw.xz | dd of=/dev/sda && sync",
"mount /dev/sda3 /mnt && sed -i 's/set timeout=3/set timeout=10/g' /mnt/grub/grub.cfg && umount /mnt"
]
}
}

View File

@@ -1,15 +0,0 @@
variable "hcloud_token" {
type = string
default = env("HCLOUD_TOKEN")
sensitive = true
}
variable "talos_version" {
type = string
default = "v1.3.3"
}
locals {
image = "https://github.com/talos-systems/talos/releases/download/${var.talos_version}/hcloud-amd64.raw.xz"
}

View File

@@ -1 +0,0 @@
packer_cache/

View File

@@ -1,9 +0,0 @@
init:
packer init -upgrade .
release:
packer build -only=release.proxmox.talos .
develop:
packer build -only=develop.proxmox.talos .

View File

@@ -1,2 +0,0 @@
* https://developer.hashicorp.com/packer/plugins/builders/proxmox/iso
* https://github.com/Telmate/proxmox-api-go

View File

@@ -1,96 +0,0 @@
packer {
required_plugins {
proxmox = {
version = ">= 1.1.3"
source = "github.com/hashicorp/proxmox"
}
}
}
source "proxmox" "talos" {
proxmox_url = "https://${var.proxmox_host}:8006/api2/json"
username = var.proxmox_username
token = var.proxmox_token
node = var.proxmox_nodename
insecure_skip_tls_verify = true
iso_file = "local:iso/archlinux-2023.03.01-x86_64.iso"
# iso_url = "https://mirror.rackspace.com/archlinux/iso/2023.03.01/archlinux-2023.03.01-x86_64.iso"
# iso_checksum = "sha1:3ae7c83eca8bd698b4e54c49d43e8de5dc8a4456"
# iso_storage_pool = "local"
unmount_iso = true
network_adapters {
bridge = "vmbr0"
model = "virtio"
firewall = true
}
network_adapters {
bridge = "vmbr1"
model = "virtio"
}
scsi_controller = "virtio-scsi-single"
disks {
type = "scsi"
storage_pool = var.proxmox_storage
storage_pool_type = var.proxmox_storage_type
format = "raw"
disk_size = "5G"
io_thread = "true"
cache_mode = "writethrough"
}
cpu_type = "host"
memory = 3072
# vga {
# type = "serial0"
# }
serials = ["socket"]
ssh_username = "root"
ssh_password = "packer"
ssh_timeout = "15m"
qemu_agent = true
ssh_bastion_host = var.proxmox_host
ssh_bastion_username = "root"
ssh_bastion_agent_auth = true
template_name = "talos"
template_description = "Talos system disk, version ${var.talos_version}"
boot_wait = "15s"
boot_command = [
"<enter><wait1m>",
"passwd<enter><wait>packer<enter><wait>packer<enter>"
]
}
build {
name = "release"
sources = ["source.proxmox.talos"]
provisioner "shell" {
inline = [
"curl -L ${local.image} -o /tmp/talos.raw.xz",
"xz -d -c /tmp/talos.raw.xz | dd of=/dev/sda && sync",
]
}
}
build {
name = "develop"
sources = ["source.proxmox.talos"]
provisioner "file" {
source = "nocloud-amd64.raw.xz"
destination = "/tmp/talos.raw.xz"
}
provisioner "shell" {
inline = [
"xz -d -c /tmp/talos.raw.xz | dd of=/dev/sda && sync",
]
}
}

View File

@@ -1,33 +0,0 @@
variable "proxmox_host" {
type = string
}
variable "proxmox_username" {
type = string
}
variable "proxmox_token" {
type = string
}
variable "proxmox_nodename" {
type = string
}
variable "proxmox_storage" {
type = string
}
variable "proxmox_storage_type" {
type = string
}
variable "talos_version" {
type = string
default = "v1.3.7"
}
locals {
image = "https://github.com/talos-systems/talos/releases/download/${var.talos_version}/nocloud-amd64.raw.xz"
}