2020-10-14 12:43:28 +00:00
|
|
|
job "secrets" {
|
|
|
|
datacenters = ["dc1", "dc2"]
|
|
|
|
|
|
|
|
constraint {
|
|
|
|
attribute = "${attr.kernel.name}"
|
|
|
|
value = "linux"
|
|
|
|
}
|
|
|
|
|
|
|
|
group "group" {
|
|
|
|
|
|
|
|
meta {
|
|
|
|
test_deploy = "DEPLOYNUMBER"
|
|
|
|
}
|
|
|
|
|
|
|
|
task "task" {
|
|
|
|
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
|
|
|
image = "busybox:1"
|
|
|
|
command = "/bin/sh"
|
|
|
|
args = ["-c", "sleep 300"]
|
|
|
|
}
|
|
|
|
|
|
|
|
vault {
|
|
|
|
policies = ["access-secrets-TESTID"]
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOT
|
|
|
|
{{ with secret "pki-TESTID/issue/nomad" "common_name=nomad.service.consul" "ip_sans=127.0.0.1" }}
|
|
|
|
{{- .Data.certificate -}}
|
|
|
|
{{ end }}
|
|
|
|
EOT
|
|
|
|
|
2020-10-23 13:01:25 +00:00
|
|
|
destination = "${NOMAD_SECRETS_DIR}/certificate.crt"
|
2020-10-14 12:43:28 +00:00
|
|
|
change_mode = "noop"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOT
|
|
|
|
SOME_SECRET={{ with secret "secrets-TESTID/data/myapp" }}{{- .Data.data.key -}}{{end}}
|
|
|
|
EOT
|
|
|
|
|
2020-10-23 13:01:25 +00:00
|
|
|
destination = "${NOMAD_SECRETS_DIR}/access.key"
|
2020-10-14 12:43:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 128
|
|
|
|
memory = 64
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|