Skip to content

Commit fe46e6c

Browse files
committed
services/nomad/infrastructure: Pull certificates from nomad variables
1 parent 0b77a62 commit fe46e6c

File tree

4 files changed

+15
-23
lines changed

4 files changed

+15
-23
lines changed

services/nomad/infrastructure/nginx-control.nomad

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,24 @@ job "nginx-control" {
1111
task "nginx" {
1212
driver = "docker"
1313

14-
vault {
15-
policies = ["void-secrets-tls"]
16-
}
17-
1814
config {
1915
image = "ghcr.io/void-linux/infra-nginx:20221230RC01"
2016
network_mode = "host"
2117
dns_servers = ["127.0.0.1"]
2218
}
2319

24-
dynamic "template" {
25-
for_each = [
26-
"voidlinux.org.crt",
27-
"voidlinux.org.key",
28-
]
20+
template {
21+
data = "{{ with nomadVar \"nomad/jobs/nginx-control\" }}{{ .certificate }}{{ end }}"
22+
destination = "secrets/certs/voidlinux.org.crt"
23+
perms = 400
24+
change_mode = "signal"
25+
}
2926

30-
content {
31-
data = file("nginx-sites/${template.value}")
32-
destination = "secrets/certs/${template.value}"
33-
perms = 400
34-
change_mode = "signal"
35-
}
27+
template {
28+
data = "{{ with nomadVar \"nomad/jobs/nginx-control\" }}{{ .key }}{{ end }}"
29+
destination = "secrets/certs/voidlinux.org.key"
30+
perms = 400
31+
change_mode = "signal"
3632
}
3733

3834
dynamic "template" {

services/nomad/infrastructure/nginx-mirror.nomad

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ job "nginx" {
2222
task "nginx" {
2323
driver = "docker"
2424

25-
vault {
26-
policies = ["void-secrets-tls"]
27-
}
28-
2925
config {
3026
image = "ghcr.io/void-linux/infra-nginx:20221230RC01"
3127
network_mode = "host"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{{- with secret "secret/lego/data/certificates/_.voidlinux.org.crt" -}}
2-
{{.Data.contents}}
1+
{{- with nomadVar "nomad/jobs/nginx" -}}
2+
{{ .certificate }}
33
{{- end -}}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{{- with secret "secret/lego/data/certificates/_.voidlinux.org.key" -}}
2-
{{.Data.contents}}
1+
{{- with nomadVar "nomad/jobs/nginx" -}}
2+
{{ .key }}
33
{{- end -}}

0 commit comments

Comments
 (0)