github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/e2e/affinities/input/anti_affinities.nomad (about)

     1  job "test1" {
     2    datacenters = ["dc1", "dc2"]
     3    type        = "service"
     4  
     5    constraint {
     6      attribute = "${attr.kernel.name}"
     7      value     = "linux"
     8    }
     9  
    10    affinity {
    11      attribute = "${meta.rack}"
    12      operator  = "="
    13      value     = "r1"
    14      weight    = -50
    15    }
    16  
    17    group "test1" {
    18      count = 4
    19  
    20      affinity {
    21        attribute = "${node.datacenter}"
    22        operator  = "="
    23        value     = "dc1"
    24        weight    = -50
    25      }
    26  
    27      task "test" {
    28        driver = "raw_exec"
    29  
    30        config {
    31          command = "bash"
    32          args    = ["-c", "sleep 15000"]
    33        }
    34      }
    35    }
    36  }