Nomad
dispatch_payload Block
Placement | job -> group -> task -> dispatch_payload |
The dispatch_payload
block is used in conjunction with a parameterized
job
that expects a payload. When the job is dispatched with a payload, the payload
will be made available to any task that has a dispatch_payload
block. The
payload will be written to the configured file before the task is started. This
allows the task to use the payload as input or configuration.
job "docs" {
group "example" {
task "server" {
dispatch_payload {
file = "config.json"
}
}
}
}
dispatch_payload
Parameters
file
(string: "")
- Specifies the file name to write the content of dispatch payload to. The file is written relative to the task's local directory.
dispatch_payload
Examples
The following examples only show the dispatch_payload
blocks. Remember that the
dispatch_payload
block is only valid in the placements listed above.
Write Payload to a File
This example shows a dispatch_payload
block in a parameterized job that writes
the payload to a config.json
file.
dispatch_payload {
file = "config.json"
}