Reputation: 21
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.
Upvotes: 1
Views: 421
Reputation: 141698
Is there a way to make templates optional in Nomad job files?
No.
Upvotes: 0