github.com/smintz/nomad@v0.8.3/website/source/docs/job-specification/meta.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "meta Stanza - Job Specification"
     4  sidebar_current: "docs-job-specification-meta"
     5  description: |-
     6    The "meta" stanza allows for user-defined arbitrary key-value pairs.
     7  ---
     8  
     9  # `meta` Stanza
    10  
    11  <table class="table table-bordered table-striped">
    12    <tr>
    13      <th width="120">Placement</th>
    14      <td>
    15        <code>job -> **meta**</code>
    16        <br>
    17        <code>job -> group -> **meta**</code>
    18        <br>
    19        <code>job -> group -> task -> **meta**</code>
    20      </td>
    21    </tr>
    22  </table>
    23  
    24  The `meta` stanza allows for user-defined arbitrary key-value pairs. It is
    25  possible to use the `meta` stanza at the [job][], [group][], or [task][] level.
    26  
    27  ```hcl
    28  job "docs" {
    29    meta {
    30      my-key = "my-value"
    31    }
    32  
    33    group "example" {
    34      meta {
    35        my-key = "my-value"
    36      }
    37  
    38      task "server" {
    39        meta {
    40          my-key = "my-value"
    41        }
    42      }
    43    }
    44  }
    45  ```
    46  
    47  Metadata is merged up the job specification, so metadata defined at the job
    48  level applies to all groups and tasks within that job. Metadata defined at the
    49  group layer applies to all tasks within that group.
    50  
    51  ## `meta` Parameters
    52  
    53  The "parameters" for the `meta` stanza can be any key-value. The keys and values
    54  are both of type `string`, but they can be specified as other types. They will
    55  automatically be converted to strings.
    56  
    57  ## `meta` Examples
    58  
    59  The following examples only show the `meta` stanzas. Remember that the
    60  `meta` stanza is only valid in the placements listed above.
    61  
    62  ### Coercion
    63  
    64  This example shows the different ways to specify key-value pairs. Internally,
    65  these values will be stored as their string representation. No type information
    66  is preserved.
    67  
    68  ```hcl
    69  meta {
    70    key = "true"
    71    key = true
    72  
    73    "key" = true
    74  
    75    key = 1.4
    76    key = "1.4"
    77  }
    78  ```
    79  
    80  ### Interpolation
    81  
    82  This example shows using [Nomad interpolation][interpolation] to populate
    83  environment variables.
    84  
    85  ```hcl
    86  meta {
    87    class = "${nomad.class}"
    88  }
    89  ```
    90  
    91  [job]: /docs/job-specification/job.html "Nomad job Job Specification"
    92  [group]: /docs/job-specification/group.html "Nomad group Job Specification"
    93  [task]: /docs/job-specification/task.html "Nomad task Job Specification"
    94  [interpolation]: /docs/runtime/interpolation.html "Nomad interpolation"