2023-11-04 20:33:51 +00:00
|
|
|
|
|
|
|
job "pdns-auth" {
|
|
|
|
datacenters = ["homelab"]
|
|
|
|
priority = 100
|
|
|
|
meta {
|
2023-11-05 16:00:16 +00:00
|
|
|
force = 2
|
2023-11-04 20:33:51 +00:00
|
|
|
}
|
|
|
|
type = "service"
|
|
|
|
constraint {
|
|
|
|
attribute = "${attr.cpu.arch}"
|
|
|
|
value = "amd64"
|
|
|
|
}
|
2024-02-21 18:03:31 +00:00
|
|
|
constraint {
|
|
|
|
attribute = "${node.class}"
|
2024-09-29 15:38:27 +00:00
|
|
|
operator = "set_contains"
|
|
|
|
value = "cluster"
|
|
|
|
}
|
|
|
|
vault {
|
|
|
|
policies = ["pdns"]
|
2024-02-21 18:03:31 +00:00
|
|
|
}
|
2023-11-04 20:33:51 +00:00
|
|
|
group "pdns-auth" {
|
|
|
|
network {
|
|
|
|
port "dns" {
|
2024-09-29 15:38:27 +00:00
|
|
|
static = 5300
|
2023-11-04 20:33:51 +00:00
|
|
|
}
|
|
|
|
port "http" {
|
|
|
|
static = 8081
|
|
|
|
}
|
|
|
|
}
|
2024-09-29 15:38:27 +00:00
|
|
|
task "pdns-auth" {
|
2023-11-04 20:33:51 +00:00
|
|
|
|
2024-09-29 15:38:27 +00:00
|
|
|
driver = "docker"
|
|
|
|
service {
|
2023-11-04 20:33:51 +00:00
|
|
|
name = "pdns-auth"
|
|
|
|
port = "dns"
|
|
|
|
|
|
|
|
}
|
|
|
|
config {
|
2024-09-29 15:38:27 +00:00
|
|
|
image = "docker.service.consul:5000/powerdns/pdns-auth-master:latest"
|
2023-11-04 20:33:51 +00:00
|
|
|
network_mode = "host"
|
2024-09-29 15:38:27 +00:00
|
|
|
privileged = true
|
|
|
|
cap_add = ["net_bind_service"]
|
2023-11-04 20:33:51 +00:00
|
|
|
volumes = [
|
|
|
|
"/mnt/diskstation/nomad/pdns-auth/var:/var/lib/powerdns/",
|
|
|
|
"local/dnsupdate.conf:/etc/powerdns/pdns.d/dnsupdate.conf",
|
|
|
|
"local/pdns.conf:/etc/powerdns/pdns.conf"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
template {
|
|
|
|
destination = "secrets/env"
|
|
|
|
|
|
|
|
data = <<EOH
|
|
|
|
{{ with secret "secrets/data/nomad/pdns"}}
|
|
|
|
PDNS_AUTH_API_KEY="{{.Data.data.API_KEY}}"
|
|
|
|
{{ end }}
|
|
|
|
EOH
|
2024-09-29 15:38:27 +00:00
|
|
|
env = true
|
2023-11-04 20:33:51 +00:00
|
|
|
}
|
2024-09-29 15:38:27 +00:00
|
|
|
template {
|
2023-11-04 20:33:51 +00:00
|
|
|
destination = "local/dnsupdate.conf"
|
2024-09-29 15:38:27 +00:00
|
|
|
data = <<EOH
|
2023-11-04 20:33:51 +00:00
|
|
|
dnsupdate=yes
|
2024-02-24 16:11:40 +00:00
|
|
|
allow-dnsupdate-from=192.168.1.43/24
|
2023-11-05 16:00:16 +00:00
|
|
|
local-address=192.168.1.5
|
|
|
|
local-port=53
|
2023-11-04 20:33:51 +00:00
|
|
|
EOH
|
|
|
|
}
|
2024-09-29 15:38:27 +00:00
|
|
|
template {
|
2023-11-04 20:33:51 +00:00
|
|
|
destination = "local/pdns.conf"
|
2024-09-29 15:38:27 +00:00
|
|
|
data = <<EOH
|
2023-11-04 20:33:51 +00:00
|
|
|
launch=gpgsql
|
|
|
|
gpgsql-host=active.db.service.consul
|
|
|
|
gpgsql-port=5432
|
|
|
|
gpgsql-user=pdns-auth
|
|
|
|
{{ with secret "secrets/data/database/pdns"}}
|
|
|
|
gpgsql-password={{ .Data.data.pdnsauth }}
|
|
|
|
{{ end }}
|
2024-02-10 09:39:09 +00:00
|
|
|
resolver=192.168.1.6
|
|
|
|
expand-alias=yes
|
2023-11-04 20:33:51 +00:00
|
|
|
include-dir=/etc/powerdns/pdns.d
|
|
|
|
EOH
|
|
|
|
}
|
|
|
|
resources {
|
|
|
|
memory = 100
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-29 15:38:27 +00:00
|
|
|
task "pdns-recursor" {
|
2023-11-06 18:07:04 +00:00
|
|
|
|
2024-09-29 15:38:27 +00:00
|
|
|
driver = "docker"
|
|
|
|
config {
|
|
|
|
image = "docker.service.consul:5000/powerdns/pdns-recursor-master:latest"
|
|
|
|
network_mode = "host"
|
|
|
|
volumes = [
|
|
|
|
"local/recursor.conf:/etc/powerdns/recursor.conf",
|
|
|
|
]
|
|
|
|
}
|
2024-10-29 18:21:05 +00:00
|
|
|
template{
|
|
|
|
destination = "local/recursor.conf"
|
|
|
|
data= <<EOH
|
2024-12-08 10:37:58 +00:00
|
|
|
dnssec:
|
|
|
|
validation: off
|
|
|
|
recursor:
|
|
|
|
forward_zones:
|
|
|
|
- zone: consul
|
|
|
|
forwarders:
|
|
|
|
- 127.0.0.1:8600
|
|
|
|
- zone : ducamps.eu
|
|
|
|
forwarders:
|
|
|
|
- 192.168.1.5
|
|
|
|
- zone: 1.168.192.in-addr.arpa
|
|
|
|
forwarders:
|
|
|
|
- 192.168.1.5
|
|
|
|
incoming:
|
|
|
|
listen:
|
|
|
|
- 192.168.1.6
|
|
|
|
EOH
|
2024-09-29 15:38:27 +00:00
|
|
|
}
|
|
|
|
resources {
|
|
|
|
cpu = 50
|
|
|
|
memory = 50
|
|
|
|
}
|
2023-11-06 18:07:04 +00:00
|
|
|
}
|
2024-09-29 15:38:27 +00:00
|
|
|
task "keepalived" {
|
|
|
|
driver = "docker"
|
2023-11-04 20:33:51 +00:00
|
|
|
lifecycle {
|
2023-11-05 13:58:10 +00:00
|
|
|
hook = "prestart"
|
2023-11-04 20:33:51 +00:00
|
|
|
sidecar = true
|
|
|
|
}
|
|
|
|
|
|
|
|
env {
|
2024-09-29 15:38:27 +00:00
|
|
|
KEEPALIVED_ROUTER_ID = "52"
|
|
|
|
KEEPALIVED_STATE = "MASTER"
|
|
|
|
KEEPALIVED_VIRTUAL_IPS = "#PYTHON2BASH:['192.168.1.5','192.168.1.6']"
|
2023-11-04 20:33:51 +00:00
|
|
|
}
|
2024-09-29 15:38:27 +00:00
|
|
|
template {
|
2023-11-04 20:33:51 +00:00
|
|
|
destination = "local/env.yaml"
|
|
|
|
change_mode = "restart"
|
2024-09-29 15:38:27 +00:00
|
|
|
env = true
|
|
|
|
data = <<EOH
|
2023-11-04 20:33:51 +00:00
|
|
|
KEEPALIVED_INTERFACE= {{ sockaddr "GetPrivateInterfaces | include \"network\" \"192.168.1.0/24\" | attr \"name\"" }}
|
|
|
|
EOH
|
|
|
|
}
|
|
|
|
config {
|
2024-03-17 17:58:24 +00:00
|
|
|
image = "docker.service.consul:5000/osixia/keepalived:2.0.20"
|
2023-11-04 20:33:51 +00:00
|
|
|
network_mode = "host"
|
|
|
|
cap_add = [
|
|
|
|
"NET_ADMIN",
|
|
|
|
"NET_BROADCAST",
|
|
|
|
"NET_RAW"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
resources {
|
|
|
|
cpu = 20
|
|
|
|
memory = 20
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-09-29 15:38:27 +00:00
|
|
|
group "pdns-admin" {
|
|
|
|
network {
|
|
|
|
port "pdnsadmin" {
|
|
|
|
to = 80
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task "pnds-admin" {
|
|
|
|
service {
|
|
|
|
name = "pdns-admin"
|
|
|
|
tags = [
|
|
|
|
"homer.enable=true",
|
|
|
|
"homer.name=PDNS-ADMIN",
|
|
|
|
"homer.service=Application",
|
|
|
|
"homer.logo=http://${NOMAD_ADDR_pdnsadmin}/static/img/favicon.png",
|
|
|
|
"homer.target=_blank",
|
|
|
|
"homer.url=http://${NOMAD_ADDR_pdnsadmin}",
|
|
|
|
|
|
|
|
]
|
|
|
|
port = "pdnsadmin"
|
|
|
|
}
|
|
|
|
driver = "docker"
|
|
|
|
config {
|
|
|
|
image = "docker.service.consul:5000/powerdnsadmin/pda-legacy:latest"
|
|
|
|
ports = ["pdnsadmin"]
|
|
|
|
volumes = [
|
|
|
|
"/mnt/diskstation/nomad/pdns-admin/:/data/node_module/",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
template {
|
|
|
|
destination = "secrets/pdns-admin.env"
|
|
|
|
env = true
|
|
|
|
data = <<EOH
|
|
|
|
{{ with secret "secrets/data/nomad/pdns"}}
|
|
|
|
SECRET_KEY="{{ .Data.data.SECRET_KEY }}"
|
|
|
|
GUNICORN_WORKERS=2
|
|
|
|
{{ end }}
|
|
|
|
{{ with secret "secrets/data/database/pdns"}}
|
|
|
|
SQLALCHEMY_DATABASE_URI=postgresql://pdns-admin:{{ .Data.data.pdnsadmin }}@active.db.service.consul/pdns-admin
|
|
|
|
{{end}}
|
|
|
|
EOH
|
|
|
|
}
|
|
|
|
resources {
|
|
|
|
cpu = 50
|
|
|
|
memory = 200
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-11-04 20:33:51 +00:00
|
|
|
}
|