Last active
February 27, 2025 13:16
Revisions
-
hegerdes revised this gist
Feb 27, 2025 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,4 +12,3 @@ apt-get install --yes --no-install-recommends wget fail2ban echo "cleanup..." cloud-init clean --machine-id --seed --logs -
hegerdes revised this gist
Dec 1, 2024 . 3 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ source "hcloud" "base-amd64" { image = "debian-12" location = "nbg1" server_type = "cx22" ssh_keys = [] user_data = "" ssh_username = "root" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ variable "user_data_path" { source "hcloud" "base-amd64" { image = var.base_image location = "nbg1" server_type = "cx22" ssh_keys = [] user_data = file(var.user_data_path) ssh_username = "root" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ source "hcloud" "talos" { rescue = "linux64" image = "debian-11" location = "hel1" server_type = "cx22" ssh_username = "root" snapshot_name = "talos system disk" snapshot_labels = { -
hegerdes revised this gist
Dec 3, 2023 . 1 changed file with 0 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,6 @@ # talos.pkr.hcl # NOTE: Based on https://www.talos.dev/v1.5/talos-guides/install/cloud-platforms/hetzner/ variable "talos_version" { type = string default = "v1.5.5" -
hegerdes created this gist
Dec 3, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #cloud-config ssh_pwauth: false disable_root_opts: no-port-forwarding,no-agent-forwarding,no-X11-forwarding # Install base packages package_update: true package_upgrade: true packages: - gnupg - curl - jq - unzip - apparmor - aptitude - lsb-release - ca-certificates - apt-transport-https - unattended-upgrades - apparmor-profiles-extra - logrotate - wget This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ # custom-img-v1.pkr.hcl source "hcloud" "base-amd64" { image = "debian-12" location = "nbg1" server_type = "cx11" ssh_keys = [] user_data = "" ssh_username = "root" snapshot_name = "custom-img" snapshot_labels = { base = "debian-12", version = "v1.0.0", name = "custom-img" } } build { sources = ["source.hcloud.base-amd64"] provisioner "shell" { inline = [ "apt-get update", "apt-get install -y wget fail2ban cowsay", "/usr/games/cowsay 'Hi Hetzner Cloud' > /etc/motd", ] env = { BUILDER = "packer" } } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ # custom-img-v2.pkr.hcl variable "base_image" { type = string default = "debian-12" } variable "output_name" { type = string default = "snapshot" } variable "version" { type = string default = "v1.0.0" } variable "user_data_path" { type = string default = "cloud-init-default.yml" } source "hcloud" "base-amd64" { image = var.base_image location = "nbg1" server_type = "cx11" ssh_keys = [] user_data = file(var.user_data_path) ssh_username = "root" snapshot_name = "${var.output_name}-${var.version}" snapshot_labels = { base = var.base_image, version = var.version, name = "${var.output_name}-${var.version}" } } source "hcloud" "base-arm64" { image = var.base_image location = "nbg1" server_type = "cax11" ssh_keys = [] user_data = file(var.user_data_path) ssh_username = "root" snapshot_name = "${var.output_name}-${var.version}" snapshot_labels = { base = var.base_image, version = var.version, name = "${var.output_name}-${var.version}" } } build { sources = ["source.hcloud.base-amd64", "source.hcloud.base-arm64"] provisioner "shell" { scripts = [ "os-setup.sh", ] env = { BUILDER = "packer" } } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/bin/bash set -e -o pipefail echo "waiting for cloud-init to finish..." cloud-init status --wait echo "installing packages..." apt-get update apt-get install --yes --no-install-recommends wget fail2ban # My setup... echo "cleanup..." cloud-init clean --machine-id --seed --logs rm -rvf /var/lib/cloud/instances /etc/machine-id /var/lib/dbus/machine-id /var/log/cloud-init* This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ # packer.pkr.hcl packer { required_plugins { hcloud = { source = "github.com/hetznercloud/hcloud" version = ">= 1.2.0" } } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ # talos.pkr.hcl # NOTE: Based on https://www.talos.dev/v1.5/talos-guides/install/cloud-platforms/hetzner/ packer { required_plugins { hcloud = { version = ">= 1.0.0" source = "github.com/hashicorp/hcloud" } } } variable "talos_version" { type = string default = "v1.5.5" } locals { image = "https://github.com/siderolabs/talos/releases/download/${var.talos_version}/hcloud-amd64.raw.xz" } source "hcloud" "talos" { rescue = "linux64" image = "debian-11" location = "hel1" server_type = "cx11" ssh_username = "root" snapshot_name = "talos system disk" snapshot_labels = { type = "infra", os = "talos", version = "${var.talos_version}", } } 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", ] } }