Initial commit
This commit is contained in:
68
services.jsonnet
Normal file
68
services.jsonnet
Normal file
@@ -0,0 +1,68 @@
|
||||
local terraform = import "lib/terraform.libsonnet";
|
||||
local config = import "config/config.libsonnet";
|
||||
|
||||
{
|
||||
"terraform.tf.json": std.manifestJson({
|
||||
terraform: {
|
||||
required_providers: {
|
||||
hcloud: {
|
||||
source: "hetznercloud/hcloud",
|
||||
version: "1.30.0"
|
||||
},
|
||||
hetznerdns: {
|
||||
source: "timohirt/hetznerdns",
|
||||
version: "1.1.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
provider: {
|
||||
hcloud: {
|
||||
token: config.hcloudToken
|
||||
},
|
||||
hetznerdns: {
|
||||
apitoken: config.hdnsToken
|
||||
}
|
||||
},
|
||||
|
||||
resource: {
|
||||
hcloud_ssh_key: {
|
||||
[k]: terraform.HcloudSSHKey { name: k, public_key: config.sshKeys[k] }
|
||||
for k in std.objectFields(config.sshKeys)
|
||||
},
|
||||
hcloud_server: {
|
||||
[s.name]: s.instance
|
||||
for s in config.servers
|
||||
},
|
||||
hetznerdns_zone: {
|
||||
infra: { name: config.infraDomain, ttl: config.defaultZoneTTL },
|
||||
},
|
||||
hetznerdns_record: std.foldl(function (a, b) a + b, [
|
||||
terraform.serverDnsRecords(s)
|
||||
for s in config.servers
|
||||
], {})
|
||||
}
|
||||
}),
|
||||
"inventory.yaml": std.manifestYamlDoc({
|
||||
all: {
|
||||
hosts: {
|
||||
[s.name]: s + {
|
||||
ansible_host: s.publicDomain,
|
||||
ansible_user: "root"
|
||||
}
|
||||
for s in config.servers
|
||||
}
|
||||
}
|
||||
}),
|
||||
"site.yaml": std.manifestYamlDoc([
|
||||
{
|
||||
name: "Test command",
|
||||
hosts: "all",
|
||||
tasks: [
|
||||
{
|
||||
"ansible.builtin.command": "ls"
|
||||
}
|
||||
]
|
||||
}
|
||||
])
|
||||
}
|
||||
Reference in New Issue
Block a user