I think I may be misunderstanding what you're trying to accomplish.
To clarify, the distinct_hosts constraint I recommended will prevent multiple instances of the same job from being placed on a single host. It has no effect across different jobs.
There currently is no mechanism to prevent one job from running on the same node as another job; in fact, Nomad's scheduler is a bin-packing scheduler, which will typically encourage tasks from different jobs to be collocated.
Explicit job constraints (e.g., using node metadata) can produce the behavior that you're looking for, with the risk that if the constraints cannot be satisfied, the jobs will not be placed. Also, this has the downside of potentially complicated external management.
There is one hack that has been used in the past to provide this capability.... by requesting a static port resource, you can avoid collocating jobs. For example, if I have some number of jobs (job1, job2, and job3) where I want to express some anti-affinity, I could indicate a static port resource requirement (specific to these jobs) that would prevent those jobs from being scheduled on a given node:
resources {
...
network {
...
port "schedulinghack" {
static = 31234
}
}
}
This works because there is only one port 31234 per node, and therefore only one task requiring the resource 31234 can be placed per node. You still have the work of keeping track of which "hack" ports you are using per "job anti-affinity class", and you should strive to avoid using ports that might be needed for bonafide usage.