-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuniversal-server-template.pkr.hcl
66 lines (58 loc) · 1.44 KB
/
universal-server-template.pkr.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
packer {
required_plugins {
hcloud = {
source = "github.com/hetznercloud/hcloud"
version = "~> 1"
}
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
}
}
variable "hcloud_token" {
sensitive = true # Requires terraform >= 0.14
}
source "hcloud" "jammy_home" {
image = "ubuntu-22.04"
location = "nbg1"
server_type = "cx11"
upgrade_server_type = "cx51"
ssh_keys = ["mykey"]
ssh_username = "root"
token = "${var.hcloud_token}"
rescue = "linux64"
snapshot_name = "universal-server-template-jammy-home"
snapshot_labels = {
"type" = "universal-server-template-jammy-home"
}
}
source "hcloud" "bookworm_home" {
image = "debian-12"
location = "nbg1"
server_type = "cx11"
upgrade_server_type = "cx51"
temporary_key_pair_type = "ed25519"
ssh_keys = ["mykey"]
ssh_username = "root"
token = "${var.hcloud_token}"
rescue = "linux64"
snapshot_name = "universal-server-template-bookworm-home"
snapshot_labels = {
"type" = "universal-server-template-bookworm-home"
}
}
build {
sources = ["source.hcloud.bookworm_home", "source.hcloud.jammy_home"]
provisioner "shell" {
inline = [
"echo provisioning all the things",
]
}
provisioner "ansible" {
#extra_arguments = [ "-vvvv" ]
playbook_file = "./ansible-packer.yml"
user = "root"
use_proxy = false
}
}