Hello,
I am trying to use vault secrets in my nomad job file to set authentication for redis. I have a policy in vault with the read permission set. My consul template stanza look something like this:
template {
data = template {
data = <<EOH
{{ with secret “secret/data/db” }}
REDIS_PASSWORD=“{{ .Data.data.REDIS_PASS }}”
{{ end }}{{ end }}
EOH
destination = "secrets/file.env"
env = true
}
Job spec:
job “redis” {
datacenters = [“dc1”]
group “redis” {
count = 1
vault {
policies = [“nomad_redis”]
}
network {
mode = “host”
port “db” { to = 6379 }
}
task “redis” {
driver = “docker”
config {
image = “redis:6.2”
ports = [“db”]
command = "redis-server"
args = ["/etc/redis.conf", "--requirepass","$REDIS_PASSWORD" ]
How do I pass the same variable name “REDIS_PASSWORD” from template as the arguments
?