1
0
Fork 0
This repository has been archived on 2025-08-24. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mareshq-hcloud-images/images/flatcar-stable/flatcar.pkr.hcl
Vojtěch Mareš 169b90a865
wip
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
2025-08-24 11:46:52 +02:00

68 lines
1.3 KiB
HCL

variable "hcloud_token" {
type = string
default = env("HCLOUD_TOKEN")
sensitive = true
}
packer {
required_plugins {
hcloud = {
source = "github.com/hetznercloud/hcloud"
version = ">= 1.6.0, < 2.0.0"
}
}
}
variable "channel" {
type = string
default = "stable"
}
# variable "arch" {
# type = string
# default = "amd64"
# }
# variable "server_type" {
# type = string
# default = "cx22"
# }
# variable "server_location" {
# type = string
# default = "fsn1"
# }
source "hcloud" "flatcar" {
# token = var.hcloud_token
image = "debian-11"
location = "fsn1"
rescue = "linux64"
server_type = var.server_type
snapshot_name = "flatcar-${var.channel}-${var.arch}"
snapshot_labels = {
os = "flatcar"
channel = var.channel
}
ssh_username = "root"
}
build {
sources = ["source.hcloud.flatcar"]
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}",
]
}
}