Nomad
Nomad is a job schedular similar to kubernetes but a lot simpler. It uses only one binary
Nomad pack
Nomad pack is used to create a template of a nomad job definition
A hash within nomad pack
I have not been able to create a hash within nomad pack templating engine. But what you can do is put it in the variable file and then refference that variable in your nomad-pack.
variable "drinksMap" {
description = "Mapping drinks to a person"
type = map(string)
default = {"cola": "peter", "fanta": "rudolf", "sprite": "mark"}
}
to refference it use the following structure:
[[ index $drinksMap fanta ]]
The result will be: rudolf
In my pack I've used it together with another variable. This way you can set multiple different values when using only one input variable for the nomad-pack
Now with the pack:
job "init_drinks" {
type = "batch"
group "servedrinks" {
task "servedrinks1" {
driver = "docker"
config {
image = "dockerimg:0.1"
command = "serve_drinks"
}
env {
person = "[[ index $drinksMap .my.drink ]]"
person = "[[ .my.drink ]]"
}
}
}
And when running:
nomad-pack render drinkpack --var drink="fanta"
You get
job "init_drinks" {
type = "batch"
group "servedrinks" {
task "servedrinks1" {
driver = "docker"
config {
image = "dockerimg:0.1"
command = "serve_drinks"
}
env {
person = "rudolf"
drink = "fanta"
}
}
}