2023-05-06 10:56:29 +00:00
|
|
|
# Please see default.json for default values for these
|
|
|
|
variable "hostname" {}
|
|
|
|
|
|
|
|
locals {
|
2023-05-06 17:36:12 +00:00
|
|
|
timestamp = formatdate("YYYYMMDD-hhmmss", timestamp())
|
2023-05-06 10:56:29 +00:00
|
|
|
snapshot_id = sha1(uuidv4())
|
|
|
|
}
|
|
|
|
|
|
|
|
source "hcloud" "alpine" {
|
2023-05-06 17:36:12 +00:00
|
|
|
location = "fsn1"
|
|
|
|
server_type = "cx11"
|
|
|
|
image = "ubuntu-20.04"
|
|
|
|
rescue = "linux64"
|
|
|
|
ssh_username = "root"
|
2023-05-06 10:56:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build {
|
|
|
|
name = "alpine"
|
|
|
|
|
|
|
|
source "source.hcloud.alpine" {
|
2023-05-06 17:36:12 +00:00
|
|
|
snapshot_name = "${var.hostname}-${local.timestamp}"
|
2023-05-06 10:56:29 +00:00
|
|
|
snapshot_labels = {
|
2023-05-06 17:36:12 +00:00
|
|
|
"alpine.pius.dev/timestamp" = local.timestamp
|
|
|
|
"alpine.pius.dev/snapshot-id" = local.snapshot_id
|
2023-05-06 10:56:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
provisioner "ansible" {
|
2023-05-06 17:36:12 +00:00
|
|
|
playbook_file = "playbook.yml"
|
2023-05-06 10:56:29 +00:00
|
|
|
extra_arguments = ["--extra-vars", "@config.json"]
|
|
|
|
}
|
|
|
|
}
|