Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Add ability to include other files into a jobspec #260

@cconstantine

Description

@cconstantine

This is a feature request for a method for including other files into a jobspec.

I would like to deploy a number of services into a single job, and each one requires a static configuration file to run. I could use heredocs with a template stanza to configure them, but that means putting ALL of the configuration files contents into a single file.

In addition to allowing me to put service configuration files into multiple files, it would generally allow people to split up large or complicated job specs into multiple pieces, and re-use repeated portions of a jobspec.

Example Nomad Job Template
This is an example interface for including files. I have no attachment to the specific method names or formats for how this would work, but this would satisfy me.

variables.yml:

---
configurationVariables:
  variable: someValue

job.tpl:

job "foo" {
  ...
  group "someGroup" {
    task "someTask" {
      template {
        data = <<EOF
[[ include "configuration.yml.tpl" .configurationVariables ]]
EOF
        destination = "configuration.yml"
      }
    }
  }
}

configuration.yml.tpl:

---
some: rather
large: configuration
file: [[ .variable ]]

Output of running levant render with the above files:

job "foo" {
  ...
  group "someGroup" {
    task "someTask" {
      template {
        data = <<EOF
---
some: rather
large: configuration
file: someValue
EOF
        destination = "configuration.yml"
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions