I'd like to use a template in a Nomad job that has a string value that can be optionally overridden on a node basis, something like this:
job "foldingathome" {
...
meta {
foldingathome_power = coalesce(meta.foldingathome_power, "medium")
}
template {
destination = "${NOMAD_ALLOC_DIR}/data/config.xml"
data = <<EOT
<config>
<power v='{{ env "meta.foldingathome_power" }}'/>
</config>
EOT
}
}
Example Nomad client metadata:
client {
...
meta {
foldingathome_power = "light"
}
}
This job-level meta stanza almost works, and uses the node's meta.foldingathome_power
properly.
However, nodes that don't have this metadata key do not fallback to using "medium", and instead interpolate an empty string.
Has anyone come across a solution to this usecase?