Add external traefik routes to nomad vars
This commit is contained in:
parent
bc87688f1a
commit
cf8bde7920
@ -129,6 +129,7 @@ nomad/jobs/redis-blocky:
|
||||
nomad/jobs/rediscommander:
|
||||
redis_stunnel_psk: VALUE
|
||||
nomad/jobs/traefik:
|
||||
external: VALUE
|
||||
usersfile: VALUE
|
||||
nomad/jobs/unifi-traffic-route-ips:
|
||||
unifi_password: VALUE
|
||||
|
@ -172,23 +172,39 @@ job "traefik" {
|
||||
entryPoints = ["websecure"]
|
||||
service = "nomad"
|
||||
rule = "Host(`nomad.{{ with nomadVar "nomad/jobs" }}{{ .base_hostname }}{{ end }}`)"
|
||||
[http.routers.hass]
|
||||
|
||||
{{ with nomadVar "nomad/jobs/traefik" }}{{ with .external }}{{ with .Value | parseYAML -}}
|
||||
{{ range $service, $url := . }}
|
||||
[http.routers.{{ $service }}]
|
||||
entryPoints = ["websecure"]
|
||||
service = "hass"
|
||||
rule = "Host(`hass.{{ with nomadVar "nomad/jobs" }}{{ .base_hostname }}{{ end }}`)"
|
||||
service = "{{ $service }}"
|
||||
rule = "Host(`{{ $service }}.{{ with nomadVar "nomad/jobs" }}{{ .base_hostname }}{{ end }}`)"
|
||||
{{ end }}
|
||||
{{- end }}{{ end }}{{ end }}
|
||||
|
||||
[http.services]
|
||||
[http.services.nomad]
|
||||
[http.services.nomad.loadBalancer]
|
||||
[[http.services.nomad.loadBalancer.servers]]
|
||||
url = "http://127.0.0.1:4646"
|
||||
[http.services.hass]
|
||||
[http.services.hass.loadBalancer]
|
||||
[[http.services.hass.loadBalancer.servers]]
|
||||
url = "http://192.168.3.65:8123"
|
||||
|
||||
{{ with nomadVar "nomad/jobs/traefik" }}{{ with .external }}{{ with .Value | parseYAML -}}
|
||||
{{ range $service, $url := . }}
|
||||
[http.services.{{ $service }}]
|
||||
[http.services.{{ $service }}.loadBalancer]
|
||||
[[http.services.{{ $service }}.loadBalancer.servers]]
|
||||
url = "{{ $url }}"
|
||||
{{ end }}
|
||||
{{- end }}{{ end }}{{ end }}
|
||||
EOH
|
||||
destination = "${NOMAD_TASK_DIR}/config/conf/route-hashi.toml"
|
||||
change_mode = "noop"
|
||||
splay = "1m"
|
||||
|
||||
wait {
|
||||
min = "10s"
|
||||
max = "20s"
|
||||
}
|
||||
}
|
||||
|
||||
template {
|
||||
@ -226,6 +242,12 @@ job "traefik" {
|
||||
EOH
|
||||
destination = "${NOMAD_TASK_DIR}/config/conf/route-syslog-ng.toml"
|
||||
change_mode = "noop"
|
||||
splay = "1m"
|
||||
|
||||
wait {
|
||||
min = "10s"
|
||||
max = "20s"
|
||||
}
|
||||
}
|
||||
|
||||
template {
|
||||
|
Loading…
Reference in New Issue
Block a user