56 lines
1.6 KiB
HCL
56 lines
1.6 KiB
HCL
job "nomad-consul-config" {
|
|
datacenters = ["dc1"]
|
|
type = "system"
|
|
|
|
group "nomad-server-config" {
|
|
constraint {
|
|
attribute = "${node.unique.name}"
|
|
operator = "regexp"
|
|
value = "semaphore|ash1d|ash2e|ch2|ch3|onecloud1|de"
|
|
}
|
|
|
|
task "update-nomad-config" {
|
|
driver = "exec"
|
|
|
|
config {
|
|
command = "sh"
|
|
args = [
|
|
"-c",
|
|
"sed -i '/^consul {/,/^}/c\\consul {\\n address = \"ch4.tailnet-68f9.ts.net:8500,ash3c.tailnet-68f9.ts.net:8500,warden.tailnet-68f9.ts.net:8500\"\\n server_service_name = \"nomad\"\\n client_service_name = \"nomad-client\"\\n auto_advertise = true\\n server_auto_join = true\\n client_auto_join = false\\n}' /etc/nomad.d/nomad.hcl && systemctl restart nomad"
|
|
]
|
|
}
|
|
|
|
resources {
|
|
cpu = 100
|
|
memory = 128
|
|
}
|
|
}
|
|
}
|
|
|
|
group "nomad-client-config" {
|
|
constraint {
|
|
attribute = "${node.unique.name}"
|
|
operator = "regexp"
|
|
value = "ch4|ash3c|browser|influxdb1|hcp1|warden"
|
|
}
|
|
|
|
task "update-nomad-config" {
|
|
driver = "exec"
|
|
|
|
config {
|
|
command = "sh"
|
|
args = [
|
|
"-c",
|
|
"sed -i '/^consul {/,/^}/c\\consul {\\n address = \"ch4.tailnet-68f9.ts.net:8500,ash3c.tailnet-68f9.ts.net:8500,warden.tailnet-68f9.ts.net:8500\"\\n server_service_name = \"nomad\"\\n client_service_name = \"nomad-client\"\\n auto_advertise = true\\n server_auto_join = false\\n client_auto_join = true\\n}' /etc/nomad.d/nomad.hcl && systemctl restart nomad"
|
|
]
|
|
}
|
|
|
|
resources {
|
|
cpu = 100
|
|
memory = 128
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|