Job template executed in a queue fashion, empty limit.

I am generating a dynamic inventory from etcd.

The inventory script groups servers by a state key. Values such as: needsProvisioning, active, etc.

I have a job template that I want to run on a schedule basis with a limit of needsProvisioning, as part of this the job updates the status key to active on a succesful run, which could result in the needsProvisioning group being empty on the next run.

This causes the job to “fail” because the limit is empty, which is normal. Is there a way I can trigger this job to run only when the needsProvisioning group has members, or have it ignore the No hosts match error for this job template?

I was able to resolve this by placing the limit in the play and not in the job template