Periodic, parameterized jobs?

is it possible to schedule periodic, parameterized jobs ?? my example job (see below) never seems to get allocated … the job is deployed, but again, never “runs” …

thanks !!

job "ansible" {
  datacenters = ["dc1"]
  type = "sysbatch"

  parameterized {
    payload       = "forbidden"
    meta_optional = ["EXTRA_VARS"]

  periodic {
    cron             = "* * * * * *"
    prohibit_overlap = true

  group "ansible" {
    task "ansible" {
      driver = "raw_exec"

      config {
        command = "/opt/ansible/bin/ansible-playbook"
        args    = [
          "-i", "localhost,",
          "/vagrant/ansible/playbook.yml -e 'node_bootstrap=True ${NOMAD_META_EXTRA_VARS}'",

going to explain a little more, as i discovered some behavior when finally dispatching the job …

i was hoping to be able to define 1 job that will run on a schedule (w/ default, empty meta params), but also allow me to invoke it from time to time with one-off runtime params …

i wanted to take advantage of the prohibit_overlap = true periodic option – so that only 1 job would be running at a time …

for example, run the “normal” ansible-playbook on a schedule – basic config mgmt stuffs … but every once in a while, sneak in an EXTRA_VARS meta parameter of ‘deploy_website=True’ as a dispatched job – so that my ansible-playbook tasks can react accordingly …

what i am seeing is after dispatching a job (w/ or w/o meta params) is that the dispatched job is what is running on the defined periodic cron schedule – vs just being a one-off execution …

obviously, this isn’t good – because i only wanted the dispatched job to run once (‘deploy_website=True’) – vs on a schedule …

it looks like i will need to define one non-parameterized, periodic job for the “normal” ansible-playbook runs – and another parameterized, non-periodic job for those one off commands – which is fine by me … again, just was hoping to use that fancy prohibit_overlap = true periodic option so only 1 ansible-playbook execution was happening at a time …

Hi @gkspranger,

Yes the behaviour you described in your second comment is the expected behaviour as the parameterized nature of the job takes precedence. As you state, each child of this job that is dispatched then becomes a periodic job.

Personally I feel having two separate jobs is easier to understand from an operational viewpoint and creates a clear separation of duty.

jrasell and the Nomad team