1

Is there a way to make templates optional in Nomad job files?
If test.data does not exist in Consul KV I want the job to simply ignore the template.
Below example using keyOrDefault nearly does what I want but still creates an empty file in my container "testfile".
I don't want any file to be created at all if key does not exist.

  template {
    destination = "local/testfile"
    perms       = "100"
    data        = "{{ keyOrDefault \"service/foo/bar/test.data\" \"\" }}"
  }

If possible I would like to include the entire template in an if statement.

lind3r
  • 21
  • 2

0 Answers0