homelab/nomad-job/pihole.nomad

86 lines
1.8 KiB
Plaintext
Raw Normal View History

2022-04-03 18:45:50 +00:00
job "pihole" {
datacenters = ["homelab"]
2022-08-26 07:31:25 +00:00
priority= 100
2022-04-03 18:45:50 +00:00
type = "service"
constraint {
attribute = "${attr.unique.hostname}"
value = "oscar"
}
group "pi-hole" {
network {
mode = "host"
port "dns" {
static = 53
}
port "http" {
static = 8090
to = 80
}
}
service {
name = "pihole-gui"
2022-05-23 19:44:34 +00:00
tags = ["pihole", "admin",
"homer.enable=true",
"homer.name=Pi-hole",
"homer.service=Application",
"homer.type=PiHole",
"homer.logo=http://${NOMAD_ADDR_http}/admin/img/logo.svg",
"homer.target=_blank",
"homer.url=http://${NOMAD_ADDR_http}/admin",
]
2022-04-03 18:45:50 +00:00
port = "http"
}
task "server" {
driver = "docker"
config {
image = "pihole/pihole:latest"
ports = [
"dns",
"http",
]
volumes =[
"local/dnsmasq.d/02-localresolver.conf:/etc/dnsmasq.d/02-localresolver.conf",
"/mnt/diskstation/nomad/pihole:/etc/pihole"
]
}
vault{
policies= ["access-tables"]
}
env {
TZ= "Europe/Paris"
DNS1= "1.1.1.1"
DNS2= "80.67.169.40"
}
template {
data = <<EOH
WEBPASSWORD="{{with secret "secrets/data/pihole"}}{{.Data.data.WEBPASSWORD}}{{end}}"
EOH
destination = "local/file.env"
2022-10-15 08:48:39 +00:00
change_mode = "noop"
2022-04-03 18:45:50 +00:00
env = true
}
template{
data= <<EOH
2022-05-17 18:59:11 +00:00
server=/ducamps.win/192.168.1.10
{{range service "consul"}}server=/consul/{{.Address}}#8600
{{end}}
2022-05-28 14:01:01 +00:00
domain=ducamps.win
no-negcache
2022-05-17 18:59:11 +00:00
local-ttl=2
2022-04-03 18:45:50 +00:00
EOH
destination="local/dnsmasq.d/02-localresolver.conf"
2022-05-17 18:59:11 +00:00
change_mode = "restart"
2022-04-03 18:45:50 +00:00
}
2022-05-12 09:36:04 +00:00
resources {
memory = 200
}
2022-04-03 18:45:50 +00:00
}
}
}