github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/job-specification/meta.mdx (about)

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