Differentiate job arguments (?)

Given this example job:

job "docs" {
  datacenters = ["dc1"]

  group "example" {
    task "server" {
      driver = "docker"

      config {
        image = "hashicorp/http-echo"
        advertise_ipv6_address = true
        args = [
          "-listen", ":5678",
          "-text", "hello world",
        ]
      }

      resources {
        network {
          mbits = 10
          port "http" {
            static = "5678"
          }
        }
      }
   }
}

is there a way to define multiple of them with different arguments say one as shown with the -text of “hello world” and another with say “foo bar” and then “goodbye everyone” such that Nomad knows all these 3 jobs are the same thing, because they are they just echo different things.

I plan to create a number of jobs which are all 99% similar bar one or two environment variables which only differentiate where they say output resources to (akin to echo’ing text).

I need this behavior because I need to control how these jobs are scaled en-masse and so need these almost-perfect-replicas of each other to be seen as that.

the first thing which comes to mind as an alternative to your specific requirement is the tool levant, though I don’t know if levant supports loop constructs.

If you have some template to job file mechanism yourself; say possible using Python + Jinja2, then it could be achieved easily with less code :wink: :slightly_smiling_face:

Ah so I’d use levent to generate job files and then submit those jobs to Nomad correct?

Something that just sprang to mind is that if I make each thing it’s own unique job than I lose the ability to control their migrate behavior right?