Organizing complex jobs for nomad

We have complex system with 20 services (images). Most of them must share common variables like SYSTEM_INSTANCE and SYSTEM_PREFIX, so they must be passed to each task within environment.

I look for some way to organize such specification. How to share this varaible between ~20 jobs and ~2 groups in each job?

Hi @kinnalru :wave:

I think I answered a question similar to this a few minutes ago.

Is this what you are looking for?

Nope :frowning:
We decided to use ansible to preprocess our jobs definitions, so we have something like this:

 ...
    env {
      {{ macros.include('_env.nomad.j2') | indent(6) }}

      SYSTEM_INSTANCE = "{{ instance }}"
      SYSTEM_PREFIX = "start_{{ prefix }}.sh"
    }

    config {
      image = "{{ image }}"
      force_pull = true
    }
...