Fix HCL on interpreted.html
This commit is contained in:
parent
1d71ac1a9f
commit
a883bbfb42
|
@ -16,42 +16,45 @@ scheduler has placed them on a particular node.
|
|||
The syntax for interpreting variables is `${variable}`. An example and a
|
||||
comprehensive list of interpretable fields can be seen below:
|
||||
|
||||
```
|
||||
```hcl
|
||||
task "demo" {
|
||||
driver = "docker"
|
||||
driver = "docker"
|
||||
|
||||
# Drivers support interpreting node attributes and runtime environment
|
||||
# variables
|
||||
config {
|
||||
image = "my-app"
|
||||
# Drivers support interpreting node attributes and runtime environment
|
||||
# variables
|
||||
config {
|
||||
image = "my-app"
|
||||
|
||||
# Interpret runtime variables to inject the address to bind to and the
|
||||
# location to write logs to.
|
||||
args = ["--bind=${NOMAD_ADDR_RPC}", "--logs=${NOMAD_ALLOC_DIR}/logs"]
|
||||
# Interpret runtime variables to inject the address to bind to and the
|
||||
# location to write logs to.
|
||||
args = [
|
||||
"--bind", "${NOMAD_ADDR_RPC}",
|
||||
"--logs", "${NOMAD_ALLOC_DIR}/logs",
|
||||
]
|
||||
|
||||
port_map {
|
||||
RPC = 6379
|
||||
}
|
||||
port_map {
|
||||
RPC = 6379
|
||||
}
|
||||
}
|
||||
|
||||
# Constraints only support node attributes as runtime environment variables
|
||||
# are only defined after the task is placed on a node.
|
||||
constraint {
|
||||
attribute = "${attr.kernel.name}"
|
||||
value = "linux"
|
||||
}
|
||||
# Constraints only support node attributes as runtime environment variables
|
||||
# are only defined after the task is placed on a node.
|
||||
constraint {
|
||||
attribute = "${attr.kernel.name}"
|
||||
value = "linux"
|
||||
}
|
||||
|
||||
# Environment variables are interpreted and can contain both runtime and
|
||||
# node attributes.
|
||||
env {
|
||||
"DC" = "Running on datacenter ${node.datacenter}"
|
||||
"VERSION" = "Version ${NOMAD_META_VERSION}"
|
||||
}
|
||||
# Environment variables are interpreted and can contain both runtime and
|
||||
# node attributes. There environment variables are passed into the task.
|
||||
env {
|
||||
"DC" = "Running on datacenter ${node.datacenter}"
|
||||
"VERSION" = "Version ${NOMAD_META_VERSION}"
|
||||
}
|
||||
|
||||
# Meta keys are also interpretable.
|
||||
meta {
|
||||
VERSION = "v0.3"
|
||||
}
|
||||
# Meta keys are also interpretable.
|
||||
meta {
|
||||
VERSION = "v0.3"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -229,4 +232,3 @@ a particular node and as such can not be used in constraints.
|
|||
<td>Interpret an environment variable with key `env_key` set on the task.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
Loading…
Reference in a new issue