feat: initial commit
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
commit
6fddbcfb9e
3 changed files with 84 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-flatcar
|
||||||
|
|
||||||
|
Packer built Flatcar Linux image build for Hetzner Cloud.
|
||||||
68
flatcar.pkr.hcl
Normal file
68
flatcar.pkr.hcl
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
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}",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue