Use constraints template

This commit is contained in:
Daniel Berteaud 2024-02-20 15:56:53 +01:00
parent abaf6b57db
commit 026f20b925
2 changed files with 6 additions and 4 deletions

View File

@ -9,10 +9,7 @@ job "[[ .instance ]]" {
count = [[ $c.count ]]
shutdown_delay = "10s"
constraint {
operator = "distinct_hosts"
value = "true"
}
[[ template "common/constraints" $c ]]
network {
mode = "bridge"

View File

@ -40,6 +40,11 @@ mongo:
meta:
addr: 'mongo-${NOMAD_ALLOC_INDEX}.[[ .instance ]][[ .consul.suffix ]].service.[[ .consul.domain ]]'
nomad:
constraints:
- operator: distinct_hosts
value: true
# If port is set, a static port will be allocated. Else, a dynamic port will be used
# port: 27017