Add scheduled job to update UniFi Traffic Routes
Because I use a custom DNS server, Domain based routing rules don't work. This instead resolves the domains and then adds the IP addresses to the rules.
This commit is contained in:
parent
e21ec11eb5
commit
b218633c2c
@ -132,6 +132,9 @@ nomad/jobs/traefik:
|
|||||||
acme_email: VALUE
|
acme_email: VALUE
|
||||||
domain_lego_dns: VALUE
|
domain_lego_dns: VALUE
|
||||||
usersfile: VALUE
|
usersfile: VALUE
|
||||||
|
nomad/jobs/unifi-traffic-route-ips:
|
||||||
|
unifi_password: VALUE
|
||||||
|
unifi_username: VALUE
|
||||||
nomad/oidc:
|
nomad/oidc:
|
||||||
secret: VALUE
|
secret: VALUE
|
||||||
secrets/mysql:
|
secrets/mysql:
|
||||||
|
36
services/unifi-traffic-route-ips.nomad
Normal file
36
services/unifi-traffic-route-ips.nomad
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
job "unifi-traffic-route-ips" {
|
||||||
|
|
||||||
|
type = "batch"
|
||||||
|
|
||||||
|
periodic {
|
||||||
|
cron = "*/15 * * * * *"
|
||||||
|
prohibit_overlap = true
|
||||||
|
}
|
||||||
|
|
||||||
|
group "main" {
|
||||||
|
|
||||||
|
task "main" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "iamthefij/unifi-traffic-routes:0.0.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
env = {
|
||||||
|
UNIFI_HOST = "192.168.2.1",
|
||||||
|
UNIFI_PORT = "443",
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
data = <<EOF
|
||||||
|
{{ with nomadVar "nomad/jobs/unifi-traffic-route-ips" -}}
|
||||||
|
UNIFI_USER={{ .unifi_username }}
|
||||||
|
UNIFI_PASS={{ .unifi_password }}
|
||||||
|
{{ end -}}
|
||||||
|
EOF
|
||||||
|
destination = "$${NOMAD_SECRETS_DIR}/env"
|
||||||
|
env = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
services/unifi-traffic-route-ips.tf
Normal file
3
services/unifi-traffic-route-ips.tf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
resource "nomad_job" "unifi-traffic-route-ips" {
|
||||||
|
jobspec = file("${path.module}/unifi-traffic-route-ips.nomad")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user