Fix HCL on interpreted.html

This commit is contained in:
Seth Vargo 2016-10-03 15:50:35 -04:00
parent 1d71ac1a9f
commit a883bbfb42
No known key found for this signature in database
GPG key ID: 905A90C2949E8787

View file

@ -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>