github.com/smintz/nomad@v0.8.3/website/source/docs/job-specification/dispatch_payload.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "dispatch_payload Stanza - Job Specification" 4 sidebar_current: "docs-job-specification-dispatch-payload" 5 description: |- 6 The "dispatch_payload" stanza allows a task to access dispatch payloads. 7 to 8 --- 9 10 # `dispatch_payload` Stanza 11 12 <table class="table table-bordered table-striped"> 13 <tr> 14 <th width="120">Placement</th> 15 <td> 16 <code>job -> group -> task -> **dispatch_payload**</code> 17 </td> 18 </tr> 19 </table> 20 21 The `dispatch_payload` stanza is used in conjunction with a [`parameterized`][parameterized] job 22 that expects a payload. When the job is dispatched with a payload, the payload 23 will be made available to any task that has a `dispatch_payload` stanza. The 24 payload will be written to the configured file before the task is started. This 25 allows the task to use the payload as input or configuration. 26 27 ```hcl 28 job "docs" { 29 group "example" { 30 task "server" { 31 dispatch_payload { 32 file = "config.json" 33 } 34 } 35 } 36 } 37 ``` 38 39 ## `dispatch_payload` Parameters 40 41 - `file` `(string: "")` - Specifies the file name to write the content of 42 dispatch payload to. The file is written relative to the [task's local 43 directory][localdir]. 44 45 ## `dispatch_payload` Examples 46 47 The following examples only show the `dispatch_payload` stanzas. Remember that the 48 `dispatch_payload` stanza is only valid in the placements listed above. 49 50 ### Write Payload to a File 51 52 This example shows a `dispatch_payload` block in a parameterized job that writes 53 the payload to a `config.json` file. 54 55 ```hcl 56 dispatch_payload { 57 file = "config.json" 58 } 59 ``` 60 61 [localdir]: /docs/runtime/environment.html#local_ "Task Local Directory" 62 [parameterized]: /docs/job-specification/parameterized.html "Nomad parameterized Job Specification"