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

     1  ---
     2  layout: "docs"
     3  page_title: "group Stanza - Job Specification"
     4  sidebar_current: "docs-job-specification-group"
     5  description: |-
     6    The "group" stanza defines a series of tasks that should be co-located on the
     7    same Nomad client. Any task within a group will be placed on the same client.
     8  ---
     9  
    10  # `group` Stanza
    11  
    12  <table class="table table-bordered table-striped">
    13    <tr>
    14      <th width="120">Placement</th>
    15      <td>
    16        <code>job -> **group**</code>
    17      </td>
    18    </tr>
    19  </table>
    20  
    21  The `group` stanza defines a series of tasks that should be co-located on the
    22  same Nomad client. Any [task][] within a group will be placed on the same
    23  client.
    24  
    25  ```hcl
    26  job "docs" {
    27    group "example" {
    28      # ...
    29    }
    30  }
    31  ```
    32  
    33  ## `group` Parameters
    34  
    35  - `constraint` <code>([Constraint][]: nil)</code> -
    36    This can be provided multiple times to define additional constraints.
    37  
    38  - `count` `(int: 1)` - Specifies the number of the task groups that should
    39    be running under this group. This value must be non-negative.
    40  
    41  - `ephemeral_disk` <code>([EphemeralDisk][]: nil)</code> - Specifies the
    42    ephemeral disk requirements of the group. Ephemeral disks can be marked as
    43    sticky and support live data migrations.
    44  
    45  - `meta` <code>([Meta][]: nil)</code> - Specifies a key-value map that annotates
    46    with user-defined metadata.
    47  
    48  - `restart` <code>([Restart][]: nil)</code> - Specifies the restart policy for
    49    all tasks in this group. If omitted, a default policy exists for each job
    50    type, which can be found in the [restart stanza documentation][restart].
    51  
    52  - `task` <code>([Task][]: <required>)</code> - Specifies one or more tasks to run
    53    within this group. This can be specified multiple times, to add a task as part
    54    of the group.
    55  
    56  - `vault` <code>([Vault][]: nil)</code> - Specifies the set of Vault policies
    57    required by all tasks in this group. Overrides a `vault` block set at the
    58    `job` level.
    59  
    60  ## `group` Examples
    61  
    62  The following examples only show the `group` stanzas. Remember that the
    63  `group` stanza is only valid in the placements listed above.
    64  
    65  ### Specifying Count
    66  
    67  This example specifies that 5 instances of the tasks within this group should be
    68  running:
    69  
    70  ```hcl
    71  group "example" {
    72    count = 5
    73  }
    74  ```
    75  
    76  ### Tasks with Constraint
    77  
    78  This example shows two abbreviated tasks with a constraint on the group. This
    79  will restrict the tasks to 64-bit operating systems.
    80  
    81  ```hcl
    82  group "example" {
    83    constraint {
    84      attribute = "${attr.cpu.arch}"
    85      value     = "amd64"
    86    }
    87  
    88    task "cache" {
    89      # ...
    90    }
    91  
    92    task "server" {
    93      # ...
    94    }
    95  }
    96  ```
    97  
    98  ### Metadata
    99  
   100  This example show arbitrary user-defined metadata on the group:
   101  
   102  ```hcl
   103  group "example" {
   104    meta {
   105      "my-key" = "my-value"
   106    }
   107  }
   108  ```
   109  
   110  [task]: /docs/job-specification/task.html "Nomad task Job Specification"
   111  [job]: /docs/job-specification/job.html "Nomad job Job Specification"
   112  [constraint]: /docs/job-specification/constraint.html "Nomad constraint Job Specification"
   113  [ephemeraldisk]: /docs/job-specification/ephemeral_disk.html "Nomad ephemeral_disk Job Specification"
   114  [meta]: /docs/job-specification/meta.html "Nomad meta Job Specification"
   115  [restart]: /docs/job-specification/restart.html "Nomad restart Job Specification"
   116  [vault]: /docs/job-specification/vault.html "Nomad vault Job Specification"