feat: add flatcar image
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
parent
9fbe6b9d14
commit
1fca078455
1 changed files with 60 additions and 0 deletions
60
images/flatcar/image.pkr.hcl
Normal file
60
images/flatcar/image.pkr.hcl
Normal 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}",
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in a new issue