1
0
Fork 0

feat: add flatcar image

Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
Vojtěch Mareš 2025-06-13 19:35:39 +02:00
parent 9fbe6b9d14
commit 1fca078455
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D

View file

@ -0,0 +1,60 @@
packer {
required_plugins {
hcloud = {
source = "github.com/hetznercloud/hcloud"
version = "~> 1.4.0"
}
}
}
variable "channel" {
type = string
default = "stable"
}
variable "hcloud_token" {
type = string
default = env("HCLOUD_TOKEN")
sensitive = true
}
source "hcloud" "flatcar" {
token = var.hcloud_token
image = "ubuntu-24.04"
location = "fsn1"
rescue = "linux64"
snapshot_labels = {
os = "flatcar"
channel = var.channel
}
ssh_username = "root"
}
build {
source "hcloud.flatcar" {
name = "x86"
server_type = "cx22"
snapshot_name = "flatcar-${var.channel}-amd64"
}
source "hcloud.flatcar" {
name = "arm"
server_type = "cax11"
snapshot_name = "flatcar-${var.channel}-arm64"
}
provisioner "shell" {
inline = [
# Download script and dependencies
"apt-get -y install gawk",
"curl -fsSLO --retry-delay 1 --retry 60 --retry-connrefused --retry-max-time 60 --connect-timeout 20 https://raw.githubusercontent.com/flatcar/init/flatcar-master/bin/flatcar-install",
"chmod +x flatcar-install",
# Install flatcar
"./flatcar-install -s -o hetzner -C ${var.channel}",
]
}
}