3.2 KiB
layout | page_title | sidebar_current | description |
---|---|---|---|
docs | group Stanza - Job Specification | docs-job-specification-group | The "group" stanza defines a series of tasks that should be co-located on the same Nomad client. Any task within a group will be placed on the same client. |
group
Stanza
Placement |
job -> **group**
|
---|
The group
stanza defines a series of tasks that should be co-located on the
same Nomad client. Any task within a group will be placed on the same
client.
job "docs" {
group "example" {
# ...
}
}
group
Parameters
-
constraint
(Constraint: nil)
- This can be provided multiple times to define additional constraints. -
count
(int: 1)
- Specifies the number of the task groups that should be running under this group. This value must be non-negative. -
ephemeral_disk
(EphemeralDisk: nil)
- Specifies the ephemeral disk requirements of the group. Ephemeral disks can be marked as sticky and support live data migrations. -
meta
(Meta: nil)
- Specifies a key-value map that annotates with user-defined metadata. -
restart
(Restart: nil)
- Specifies the restart policy for all tasks in this group. If omitted, a default policy exists for each job type, which can be found in the restart stanza documentation. -
task
(Task: )
- Specifies one or more tasks to run within this group. This can be specified multiple times, to add a task as part of the group. -
vault
(Vault: nil)
- Specifies the set of Vault policies required by all tasks in this group. Overrides avault
block set at thejob
level.
group
Examples
The following examples only show the group
stanzas. Remember that the
group
stanza is only valid in the placements listed above.
Specifying Count
This example specifies that 5 instances of the tasks within this group should be running:
group "example" {
count = 5
}
Tasks with Constraint
This example shows two abbreviated tasks with a constraint on the group. This will restrict the tasks to 64-bit operating systems.
group "example" {
constraint {
attribute = "${attr.cpu.arch}"
value = "amd64"
}
task "cache" {
# ...
}
task "server" {
# ...
}
}
Metadata
This example show arbitrary user-defined metadata on the group:
group "example" {
meta {
"my-key" = "my-value"
}
}