I’m trying to find a way to avoid specifying nomad datacenter in each nomad file.
Interpolation is not working with that attribute:
job "job-name" {
datacenters = ["${node.datacenter}"]
results in deploying to the datacenter named ${node.datacenter}
.
Why that is not possible?
So far I have a little complicated working solution using levant:
datacenter=$(nomad node status -t “{{range .}}{{.Datacenter}}{{end}}”)
levant deploy -var “datacenter=$datacenter” job.nomad
job "job-name" {
datacenters = ["[[.datacenter]]"]
But would like to know is there something less verbose.
Thanks,
Igor.