From df6172a888269a691da85dd751ce121d7de3cacb Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Tue, 25 Jul 2017 16:53:10 -0700 Subject: [PATCH] Mention node attrs --- website/source/docs/job-specification/template.html.md | 1 + .../source/docs/operating-a-job/configuring-tasks.html.md | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/website/source/docs/job-specification/template.html.md b/website/source/docs/job-specification/template.html.md index 433b5afc8..ce2a52e87 100644 --- a/website/source/docs/job-specification/template.html.md +++ b/website/source/docs/job-specification/template.html.md @@ -119,6 +119,7 @@ template { --- bind_port: {{ env "NOMAD_PORT_db" }} scratch_dir: {{ env "NOMAD_TASK_DIR" }} + node_id: {{ env "node.unique.id" }} service_key: {{ key "service/my-key" }} EOH diff --git a/website/source/docs/operating-a-job/configuring-tasks.html.md b/website/source/docs/operating-a-job/configuring-tasks.html.md index dd60ca9d6..679cf53d3 100644 --- a/website/source/docs/operating-a-job/configuring-tasks.html.md +++ b/website/source/docs/operating-a-job/configuring-tasks.html.md @@ -141,7 +141,8 @@ See the [`env`](/docs/job-specification/env.html.md) docs for details. Nomad's [`template`][template] stanza can be used to generate environment variables. Environment variables may be templated with -the contents of files on disk, Consul keys, or secrets from Vault: +[Node attributes and metadata][nodevars], the contents of files on disk, Consul +keys, or secrets from Vault: ```hcl template { @@ -149,6 +150,7 @@ template { LOG_LEVEL="{{key "service/geo-api/log-verbosity"}}" API_KEY="{{with secret "secret/geo-api-key"}}{{.Data.key}}{{end}}" CERT={{ file "path/to/cert.pem" | to JSON }} +NODE_ID="{{ env "node.unique.id" }}" EOH destination = "secrets/config.env" @@ -204,5 +206,6 @@ job "docs" { For more information on the artifact resource, please see the [artifact documentation](/docs/job-specification/artifact.html). -[template]: /docs/job-specification/template.html "Nomad template Job Specification" [artifact]: /docs/job-specification/artifact.html "Nomad artifact Job Specification" +[nodevars]: /docs/runtime/interpolation.html#interpreted_node_vars "Nomad Node Variables" +[template]: /docs/job-specification/template.html "Nomad template Job Specification"