use template
This commit is contained in:
parent
b2a0b7bf84
commit
3a08206abf
2 changed files with 13 additions and 13 deletions
|
@ -7,18 +7,7 @@ resource "hcloud_server" "single-server1" {
|
||||||
type = "single"
|
type = "single"
|
||||||
}
|
}
|
||||||
ssh_keys = [hcloud_ssh_key.default.id]
|
ssh_keys = [hcloud_ssh_key.default.id]
|
||||||
# TODO: user_data seems to have no effect on VM yet
|
user_data = templatefile("user-data.yaml.tpl",
|
||||||
user_data = jsonencode({
|
{ssh_pubkey = file("../ssh-terraform-hetzner.pub")})
|
||||||
"users": {
|
|
||||||
"name": "ansible",
|
|
||||||
"groups": ["users", "admin"],
|
|
||||||
"sudo": "ALL=(ALL) NOPASSWD:ALL",
|
|
||||||
"shell": "/bin/bash",
|
|
||||||
# TODO: have some sort of lookup for the pubkey (include from file?)
|
|
||||||
"ssh_authorized_keys": ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE32LygGZyJonoWVjRgQ0Hq8iy39aLs+oH5Flmn9RhAj terraform melpomene"]
|
|
||||||
},
|
|
||||||
"package_update": true,
|
|
||||||
"package_upgrade": true
|
|
||||||
})
|
|
||||||
firewall_ids = [hcloud_firewall.single-firewall.id]
|
firewall_ids = [hcloud_firewall.single-firewall.id]
|
||||||
}
|
}
|
||||||
|
|
11
single-host/user-data.yaml.tpl
Normal file
11
single-host/user-data.yaml.tpl
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#cloud-config
|
||||||
|
users:
|
||||||
|
- name: "ansible"
|
||||||
|
groups: ["sudo"]
|
||||||
|
sudo: "ALL=(ALL) NOPASSWD:ALL"
|
||||||
|
shell: "/bin/bash"
|
||||||
|
ssh_authorized_keys:
|
||||||
|
- "${ssh_pubkey}"
|
||||||
|
|
||||||
|
package_update: true
|
||||||
|
package_upgrade: true
|
Loading…
Reference in a new issue