Running parametrized job on specific host

Is there a way to target a specific host to run a parameterized job on?

We’d like to have specific changes run on specific hosts built off of a parametrized job, but it doesn’t look like it’s possible to target a specific host.

thanks in advance!

Hi @brettpatricklarson. Thanks for using Nomad!

Would a constraint based on unique node id/name work for you?

Hi Derek - that works on targeting a specific host for a specific parameterized job.

Our issue is that we cannot create one parameterized job which can be assigned across multiple hosts depending on the payload. Unless I am mistaken.

Forgive me in advance if this doesn’t match your use case. I am trying to imagine a way to get the behavior you are looking for.

So looking at one of the examples in the documentation it looks liked you could pass the host name to the job like this:

args = ["-hostname=${attr.unique.hostname}"]

Node attributes might be more useful in your case, I am not sure. Then the logic in the job itself would have to know how to interpret the parameters and know how to run the job on that node based on those parameters.

Does that speaking to what you’d like to do here? Apologies if I am not following. Maybe you could post an example config that you wish were possible and that would help me better understand your use case.

An example use case would be a parameterized job for standardized file cleanup on a specific host.

An alert triggers and then sends a payload to a parameterized job which includes the host to run it against.

Currently if we had 100 hosts we’d need 100 unique identical parameterized jobs each targeting the specified host, or one job that targets any host.

There is a way to target a specific host with parameterized jobs, there is also a way to target a group of hosts, but I guess the missing piece for us is to target a host or multiple hosts based off of payloads.

We have a lot of weird host disk patterns that we’re trying to account for.

1 Like