Application deployment constraint on the basis of hostname

Hello Team,

Consider a scenario where we have 6 nodes acting as nomad clients. Now I want to deploy a job in such a way that it will deploy the application only on 2 specific machines rather than all 6. This means the job should spin one instance of app each on both the machines.

Is there any way we can set some constraint as hostname of the machine. If it is possible then it will be very easy to manage as we just have to specify the instance value as 2(1 per node) and constraints in an array like [hostname1, hostname2] in the job file.

Any suggestions please. Can anyone share the template of job file here.