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