mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 01:15:43 +03:00
* action page * change all page_title fields * update title * constraint through migrate pages * update page title and heading to use sentence case * fix front matter description * Apply suggestions from code review Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com> --------- Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
---
|
|
layout: docs
|
|
page_title: dispatch_payload block in the job specification
|
|
description: |-
|
|
Configure a parameterized job task payload in the `dispatch_payload` block of the Nomad job specification.
|
|
---
|
|
|
|
# `dispatch_payload` block in the job specification
|
|
|
|
<Placement groups={['job', 'group', 'task', 'dispatch_payload']} />
|
|
|
|
The `dispatch_payload` block is used in conjunction with a [`parameterized`][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.
|
|
|
|
```hcl
|
|
job "docs" {
|
|
group "example" {
|
|
task "server" {
|
|
dispatch_payload {
|
|
file = "config.json"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
## 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][localdir].
|
|
|
|
## Example
|
|
|
|
This example shows a `dispatch_payload` block in a parameterized job that writes
|
|
the payload to a `config.json` file.
|
|
|
|
```hcl
|
|
dispatch_payload {
|
|
file = "config.json"
|
|
}
|
|
```
|
|
|
|
[localdir]: /nomad/docs/runtime/environment#local 'Task Local Directory'
|
|
[parameterized]: /nomad/docs/job-specification/parameterized 'Nomad parameterized Job Specification'
|