wip
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
parent
bb0303814d
commit
169b90a865
4 changed files with 96 additions and 78 deletions
|
|
@ -1,5 +0,0 @@
|
|||
variable "hcloud_token" {
|
||||
type = string
|
||||
default = env("HCLOUD_TOKEN")
|
||||
sensitive = true
|
||||
}
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
variable "hcloud_token" {
|
||||
type = string
|
||||
default = env("HCLOUD_TOKEN")
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
packer {
|
||||
required_plugins {
|
||||
hcloud = {
|
||||
|
|
@ -7,23 +13,36 @@ packer {
|
|||
}
|
||||
}
|
||||
|
||||
locals {
|
||||
flatcar_channel = "stable"
|
||||
variable "channel" {
|
||||
type = string
|
||||
default = "stable"
|
||||
}
|
||||
|
||||
variable "hcloud_token" {
|
||||
type = string
|
||||
default = env("HCLOUD_TOKEN")
|
||||
sensitive = true
|
||||
}
|
||||
# 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
|
||||
# token = var.hcloud_token
|
||||
|
||||
image = "ubuntu-24.04"
|
||||
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
|
||||
|
|
@ -33,17 +52,7 @@ source "hcloud" "flatcar" {
|
|||
}
|
||||
|
||||
build {
|
||||
source "hcloud.flatcar" {
|
||||
name = "x86"
|
||||
server_type = "cx22"
|
||||
snapshot_name = "flatcar-${local.flatcar_channel}-amd64-${formatdate("YYYY-MM-DD", timestamp())}"
|
||||
}
|
||||
|
||||
source "hcloud.flatcar" {
|
||||
name = "arm"
|
||||
server_type = "cax11"
|
||||
snapshot_name = "flatcar-${local.flatcar_channel}-arm64-${formatdate("YYYY-MM-DD", timestamp())}"
|
||||
}
|
||||
sources = ["source.hcloud.flatcar"]
|
||||
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
|
|
@ -53,7 +62,7 @@ build {
|
|||
"chmod +x flatcar-install",
|
||||
|
||||
# Install flatcar
|
||||
"./flatcar-install -s -o hetzner -C ${local.flatcar_channel}",
|
||||
"./flatcar-install -s -o hetzner -C ${var.channel}",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
# hcloud.pkr.hcl
|
||||
|
||||
packer {
|
||||
required_plugins {
|
||||
hcloud = {
|
||||
source = "github.com/hetznercloud/hcloud"
|
||||
version = ">= 1.6.0, < 2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locals {
|
||||
image = "https://factory.talos.dev/image/376567988ad370138ad8b2698212367b8edcb69b5fd68c80be1f2ec7d603b4ba/${local.talos_version}/hcloud-${var.arch}.raw.xz"
|
||||
talos_version = "v1.10.3"
|
||||
}
|
||||
|
||||
source "hcloud" "talos" {
|
||||
token = var.hcloud_token
|
||||
|
||||
rescue = "linux64"
|
||||
image = "debian-11"
|
||||
location = "fsn1"
|
||||
ssh_username = "root"
|
||||
|
||||
snapshot_labels = {
|
||||
type = "infra",
|
||||
os = "talos",
|
||||
version = "${local.talos_version}",
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
source "hcloud.talos" {
|
||||
name = "x86"
|
||||
server_type = "cx22"
|
||||
snapshot_name = "talos-${local.talos_version}-amd64-${formatdate("YYYY-MM-DD", timestamp())}"
|
||||
}
|
||||
|
||||
source "hcloud.talos" {
|
||||
name = "arm"
|
||||
server_type = "cax11"
|
||||
snapshot_name = "talos-${local.talos_version}-arm64-${formatdate("YYYY-MM-DD", timestamp())}"
|
||||
}
|
||||
|
||||
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",
|
||||
]
|
||||
}
|
||||
}
|
||||
66
images/talos-v1.10.x/image.pkr.hcl
Normal file
66
images/talos-v1.10.x/image.pkr.hcl
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
packer {
|
||||
required_plugins {
|
||||
hcloud = {
|
||||
source = "github.com/hetznercloud/hcloud"
|
||||
version = ">= 1.6.0, < 2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "hcloud_token" {
|
||||
type = string
|
||||
default = env("HCLOUD_TOKEN")
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "talos_version" {
|
||||
type = string
|
||||
default = "v1.10.6"
|
||||
}
|
||||
|
||||
variable "arch" {
|
||||
type = string
|
||||
default = "amd64"
|
||||
}
|
||||
|
||||
variable "server_type" {
|
||||
type = string
|
||||
default = "cx22"
|
||||
}
|
||||
|
||||
variable "server_location" {
|
||||
type = string
|
||||
default = "fsn1"
|
||||
}
|
||||
|
||||
locals {
|
||||
image = "https://factory.talos.dev/image/376567988ad370138ad8b2698212367b8edcb69b5fd68c80be1f2ec7d603b4ba/${var.talos_version}/hcloud-${var.arch}.raw.xz"
|
||||
}
|
||||
|
||||
source "hcloud" "talos" {
|
||||
rescue = "linux64"
|
||||
image = "debian-11"
|
||||
location = "${var.server_location}"
|
||||
server_type = "${var.server_type}"
|
||||
ssh_username = "root"
|
||||
|
||||
snapshot_name = "talos-${var.talos_version}-${var.arch}"
|
||||
snapshot_labels = {
|
||||
type = "infra",
|
||||
os = "talos",
|
||||
version = "${var.talos_version}",
|
||||
arch = "${var.arch}",
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
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",
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in a new issue