feat: initial commit
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
commit
b975abb16b
3 changed files with 82 additions and 0 deletions
13
.editorconfig
Normal file
13
.editorconfig
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
end_of_line = lf
|
||||
max_line_length = null
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
3
README.md
Normal file
3
README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# hcloud-image-talos
|
||||
|
||||
Packer based Talos Linux image build for Hetzner Cloud.
|
||||
66
talos.pkr.hcl
Normal file
66
talos.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",
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue