github.com/ncodes/nomad@v0.5.7-0.20170403112158-97adf4a74fb3/website/source/docs/http/json-jobs.html.md (about)

     1  ---
     2  layout: "http"
     3  page_title: "HTTP API: JSON Job Specification"
     4  sidebar_current: "docs-http-json-jobs"
     5  description: |-
     6    Jobs can also be specified via the HTTP API using a JSON format. This guide
     7    discusses the job specification in JSON format.
     8  ---
     9  
    10  # Job Specification
    11  
    12  This guide covers the JSON syntax for submitting jobs to Nomad. A useful command
    13  for generating valid JSON versions of HCL jobs is
    14  `nomad run -output <job.nomad>` which will emit a JSON version of the job.
    15  
    16  ## JSON Syntax
    17  
    18  Below is an example of a JSON object that submits a `periodic` job to Nomad:
    19  
    20  ```json
    21  {
    22    "Job":{
    23      "Region":"global",
    24      "ID":"example",
    25      "Name":"example",
    26      "Type":"batch",
    27      "Priority":50,
    28      "AllAtOnce":false,
    29      "Datacenters":[
    30        "dc1"
    31      ],
    32      "Constraints":[
    33        {
    34          "LTarget":"${attr.kernel.name}",
    35          "RTarget":"linux",
    36          "Operand":"="
    37        }
    38      ],
    39      "TaskGroups":[
    40        {
    41          "Name":"cache",
    42          "Count":1,
    43          "Constraints":null,
    44          "Tasks":[
    45            {
    46              "Name":"redis",
    47              "Driver":"docker",
    48              "User":"foo-user",
    49              "Config":{
    50                "image":"redis:latest",
    51                "port_map":[
    52                  {
    53                    "db":6379
    54                  }
    55                ]
    56              },
    57              "Constraints":null,
    58              "Env":{
    59                "foo":"bar",
    60                "baz":"pipe"
    61              },
    62              "Services":[
    63                {
    64                  "Name":"cache-redis",
    65                  "Tags":[
    66                    "global",
    67                    "cache"
    68                  ],
    69                  "PortLabel":"db",
    70                  "Checks":[
    71                    {
    72                      "Id":"",
    73                      "Name":"alive",
    74                      "Type":"tcp",
    75                      "Command":"",
    76                      "Args":null,
    77                      "Path":"",
    78                      "Protocol":"",
    79                      "Interval":10000000000,
    80                      "Timeout":2000000000
    81                    }
    82                  ]
    83                }
    84              ],
    85              "Vault": {
    86                "Policies": ["policy-name"],
    87                "Env": true,
    88                "ChangeMode": "restart",
    89                "ChangeSignal": ""
    90              },
    91              "Resources":{
    92                "CPU":500,
    93                "MemoryMB":256,
    94                "DiskMB":300,
    95                "IOPS":0,
    96                "Networks":[
    97                  {
    98                    "ReservedPorts":[
    99                      {
   100                        "Label":"rpc",
   101                        "Value":25566
   102                      }
   103                    ],
   104                    "DynamicPorts":[
   105                      {
   106                        "Label":"db"
   107                      }
   108                    ],
   109                    "MBits":10
   110                  }
   111                ]
   112              },
   113              "Meta":{
   114                "foo":"bar",
   115                "baz":"pipe"
   116              },
   117              "KillTimeout":5000000000,
   118              "LogConfig":{
   119                "MaxFiles":10,
   120                "MaxFileSizeMB":10
   121              },
   122              "Templates":[
   123                {
   124                  "SourcePath": "local/config.conf.tpl",
   125                  "DestPath": "local/config.conf",
   126                  "EmbeddedTmpl": "",
   127                  "ChangeMode": "signal",
   128                  "ChangeSignal": "SIGUSR1",
   129                  "Splay": 5000000000
   130                }
   131              ],
   132              "Artifacts":[
   133                {
   134                  "GetterSource":"http://foo.com/artifact.tar.gz",
   135                  "GetterOptions":{
   136                    "checksum":"md5:c4aa853ad2215426eb7d70a21922e794"
   137                  },
   138                  "RelativeDest":"local/"
   139                }
   140              ],
   141              "DispatchPayload": {
   142                "File": "config.json"
   143              }
   144            }
   145          ],
   146          "RestartPolicy":{
   147            "Interval":300000000000,
   148            "Attempts":10,
   149            "Delay":25000000000,
   150            "Mode":"delay"
   151          },
   152          "Meta":{
   153            "foo":"bar",
   154            "baz":"pipe"
   155          }
   156        }
   157      ],
   158      "Update":{
   159        "Stagger":10000000000,
   160        "MaxParallel":1
   161      },
   162      "Periodic":{
   163        "Enabled":true,
   164        "Spec":"* * * * *",
   165        "SpecType":"cron",
   166        "ProhibitOverlap":true
   167      },
   168      "Meta":{
   169        "foo":"bar",
   170        "baz":"pipe"
   171      },
   172      "ParameterizedJob": {
   173        "Payload": "required",
   174        "MetaRequired": [
   175          "foo"
   176        ],
   177        "MetaOptional": [
   178          "bar"
   179         ]
   180      },
   181      "Payload": null
   182    }
   183  }
   184  ```
   185  
   186  ## Syntax Reference
   187  
   188  Following is a syntax reference for the possible keys that are supported
   189  and their default values if any for each type of object.
   190  
   191  ### Job
   192  
   193  The `Job` object supports the following keys:
   194  
   195  * `AllAtOnce` - Controls if the entire set of tasks in the job must
   196    be placed atomically or if they can be scheduled incrementally.
   197    This should only be used for special circumstances. Defaults to `false`.
   198  
   199  * `Constraints` - A list to define additional constraints where a job can be
   200    run. See the constraint reference for more details.
   201  
   202  * `Datacenters` - A list of datacenters in the region which are eligible
   203    for task placement. This must be provided, and does not have a default.
   204  
   205  * `TaskGroups` - A list to define additional task groups. See the task group
   206    reference for more details.
   207  
   208  * `Meta` - Annotates the job with opaque metadata.
   209  
   210  * `ParameterizedJob` - Specifies the job as a paramterized job such that it can
   211    be dispatched against. The `ParamaterizedJob` object supports the following
   212    attributes:
   213  
   214    * `MetaOptional` - Specifies the set of metadata keys that may be provided
   215      when dispatching against the job as a string array.
   216  
   217    * `MetaRequired` - Specifies the set of metadata keys that must be provided
   218      when dispatching against the job as a string array.
   219  
   220    * `Payload` - Specifies the requirement of providing a payload when
   221      dispatching against the parameterized job. The options for this field are
   222      "optional", "required" and "forbidden". The default value is "optional".
   223  
   224  * `Payload` - The payload may not be set when submitting a job but may appear in
   225    a dispatched job. The `Payload` will be a base64 encoded string containing the
   226    payload that the job was dispatched with. The `payload` has a **maximum size
   227    of 16 KiB**.
   228  
   229  * `Priority` - Specifies the job priority which is used to prioritize
   230    scheduling and access to resources. Must be between 1 and 100 inclusively,
   231    and defaults to 50.
   232  
   233  * `Region` - The region to run the job in, defaults to "global".
   234  
   235  * `Type` - Specifies the job type and switches which scheduler
   236    is used. Nomad provides the `service`, `system` and `batch` schedulers,
   237    and defaults to `service`. To learn more about each scheduler type visit
   238    [here](/docs/runtime/schedulers.html)
   239  
   240  * `Update` - Specifies the task's update strategy. When omitted, rolling
   241    updates are disabled. The `Update` object supports the following attributes:
   242  
   243    * `MaxParallel` - `MaxParallel` is given as an integer value and specifies
   244    the number of tasks that can be updated at the same time.
   245  
   246    * `Stagger` - `Stagger` introduces a delay between sets of task updates and
   247    is given in nanoseconds.
   248  
   249      An example `Update` block:
   250  
   251      ```json
   252      {
   253        "Update": {
   254          "MaxParallel" : 3,
   255          "Stagger" : 10000000000
   256        }
   257      }
   258      ```
   259  
   260  *   `Periodic` - `Periodic` allows the job to be scheduled at fixed times, dates
   261      or intervals. The periodic expression is always evaluated in the UTC
   262      timezone to ensure consistent evaluation when Nomad Servers span multiple
   263      time zones. The `Periodic` object is optional and supports the following attributes:
   264  
   265      * `Enabled` - `Enabled` determines whether the periodic job will spawn child
   266      jobs.
   267  
   268      * `time_zone` - Specifies the time zone to evaluate the next launch interval
   269        against. This is useful when wanting to account for day light savings in
   270        various time zones. The time zone must be parsable by Golang's
   271        [LoadLocation](https://golang.org/pkg/time/#LoadLocation). The default is
   272        UTC.
   273  
   274      * `SpecType` - `SpecType` determines how Nomad is going to interpret the
   275        periodic expression. `cron` is the only supported `SpecType` currently.
   276  
   277      * `Spec` - A cron expression configuring the interval the job is launched
   278      at. Supports predefined expressions such as "@daily" and "@weekly" See
   279      [here](https://github.com/gorhill/cronexpr#implementation) for full
   280      documentation of supported cron specs and the predefined expressions.
   281  
   282      * <a id="prohibit_overlap">`ProhibitOverlap`</a> - `ProhibitOverlap` can
   283        be set to true to enforce that the periodic job doesn't spawn a new
   284        instance of the job if any of the previous jobs are still running. It is
   285        defaulted to false.
   286  
   287      An example `periodic` block:
   288  
   289      ```json
   290      {
   291        "Periodic": {
   292            "Spec": "*/15 * * * * *"
   293            "SpecType": "cron",
   294            "Enabled": true,
   295            "ProhibitOverlap": true
   296        }
   297      }
   298      ```
   299  
   300  ### Task Group
   301  
   302  `TaskGroups` is a list of `TaskGroup` objects, each supports the following
   303  attributes:
   304  
   305  * `Constraints` - This is a list of `Constraint` objects. See the constraint
   306    reference for more details.
   307  
   308  * `Count` - Specifies the number of the task groups that should
   309    be running. Must be non-negative, defaults to one.
   310  
   311  * `Meta` - A key-value map that annotates the task group with opaque metadata.
   312  
   313  * `Name` - The name of the task group. Must be specified.
   314  
   315  * `RestartPolicy` - Specifies the restart policy to be applied to tasks in this group.
   316    If omitted, a default policy for batch and non-batch jobs is used based on the
   317    job type. See the [restart policy reference](#restart_policy) for more details.
   318  
   319  * `Tasks` - A list of `Task` object that are part of the task group.
   320  
   321  ### Task
   322  
   323  The `Task` object supports the following keys:
   324  
   325  * `Artifacts` - `Artifacts` is a list of `Artifact` objects which define
   326    artifacts to be downloaded before the task is run. See the artifacts
   327    reference for more details.
   328  
   329  * `Config` - A map of key-value configuration passed into the driver
   330    to start the task. The details of configurations are specific to
   331    each driver.
   332  
   333  * `Constraints` - This is a list of `Constraint` objects. See the constraint
   334    reference for more details.
   335  
   336  - `DispatchPayload` - Configures the task to have access to dispatch payloads.
   337    The `DispatchPayload` object supports the following attributes:
   338  
   339    * `File` - Specifies the file name to write the content of dispatch payload
   340      to. The file is written relative to the task's local directory.
   341  
   342  * `Driver` - Specifies the task driver that should be used to run the
   343    task. See the [driver documentation](/docs/drivers/index.html) for what
   344    is available. Examples include `docker`, `qemu`, `java`, and `exec`.
   345  
   346  *   `Env` - A map of key-value representing environment variables that
   347      will be passed along to the running process. Nomad variables are
   348      interpreted when set in the environment variable values. See the table of
   349      interpreted variables [here](/docs/runtime/interpolation.html).
   350  
   351      For example the below environment map will be reinterpreted:
   352  
   353      ```json
   354      {
   355        "Env": {
   356          "NODE_CLASS" : "${nomad.class}"
   357        }
   358      }
   359      ```
   360  
   361  * `KillTimeout` - `KillTimeout` is a time duration in nanoseconds. It can be
   362    used to configure the time between signaling a task it will be killed and
   363    actually killing it. Drivers first sends a task the `SIGINT` signal and then
   364    sends `SIGTERM` if the task doesn't die after the `KillTimeout` duration has
   365    elapsed. The default `KillTimeout` is 5 seconds.
   366  
   367  * `leader` - Specifies whether the task is the leader task of the task group. If
   368    set to true, when the leader task completes, all other tasks within the task
   369    group will be gracefully shutdown.
   370  
   371  * `LogConfig` - This allows configuring log rotation for the `stdout` and `stderr`
   372    buffers of a Task. See the log rotation reference below for more details.
   373  
   374  * `Meta` - Annotates the task group with opaque metadata.
   375  
   376  * `Name` - The name of the task. This field is required.
   377  
   378  * `Resources` - Provides the resource requirements of the task.
   379    See the resources reference for more details.
   380  
   381  * `Services` - `Services` is a list of `Service` objects. Nomad integrates with
   382    Consul for service discovery. A `Service` object represents a routable and
   383    discoverable service on the network. Nomad automatically registers when a task
   384    is started and de-registers it when the task transitions to the dead state.
   385    [Click here](/docs/service-discovery/index.html) to learn more about
   386    services. Below is the fields in the `Service` object:
   387  
   388       * `Name`: An explicit name for the Service. Nomad will replace `${JOB}`,
   389         `${TASKGROUP}` and `${TASK}` by the name of the job, task group or task,
   390         respectively. `${BASE}` expands to the equivalent of
   391         `${JOB}-${TASKGROUP}-${TASK}`, and is the default name for a Service.
   392         Each service defined for a given task must have a distinct name, so if
   393         a task has multiple services only one of them can use the default name
   394         and the others must be explicitly named. Names must adhere to
   395         [RFC-1123 ยง2.1](https://tools.ietf.org/html/rfc1123#section-2) and are
   396         limited to alphanumeric and hyphen characters (i.e. `[a-z0-9\-]`), and be
   397         less than 64 characters in length.
   398  
   399       * `Tags`: A list of string tags associated with this Service. String
   400         interpolation is supported in tags.
   401  
   402       * `PortLabel`: `PortLabel` is an optional string and is used to associate
   403         a port with the service.  If specified, the port label must match one
   404         defined in the resources block.  This could be a label of either a
   405         dynamic or a static port.
   406  
   407       * `Checks`: `Checks` is an array of check objects. A check object defines a
   408         health check associated with the service. Nomad supports the `script`,
   409         `http` and `tcp` Consul Checks. Script checks are not supported for the
   410         qemu driver since the Nomad client doesn't have access to the file system
   411         of a task using the Qemu driver.
   412  
   413           * `Type`:  This indicates the check types supported by Nomad. Valid
   414             options are currently `script`, `http` and `tcp`.
   415  
   416           * `Name`: The name of the health check.
   417  
   418           * `Interval`: This indicates the frequency of the health checks that
   419             Consul will perform.
   420  
   421           * `Timeout`: This indicates how long Consul will wait for a health
   422             check query to succeed.
   423  
   424           * `Path`:The path of the http endpoint which Consul will query to query
   425             the health of a service if the type of the check is `http`. Nomad
   426             will add the IP of the service and the port, users are only required
   427             to add the relative URL of the health check endpoint.
   428  
   429           * `Protocol`: This indicates the protocol for the http checks. Valid
   430             options are `http` and `https`. We default it to `http`.
   431  
   432           * `Command`: This is the command that the Nomad client runs for doing
   433             script based health check.
   434  
   435           * `Args`: Additional arguments to the `command` for script based health
   436             checks.
   437  
   438  * `Templates` - Specifies the set of [`Template`](#template) objects to render for the task.
   439    Templates can be used to inject both static and dynamic configuration with
   440    data populated from environment variables, Consul and Vault.
   441  
   442  * `User` - Set the user that will run the task. It defaults to the same user
   443    the Nomad client is being run as. This can only be set on Linux platforms.
   444  
   445  ### Resources
   446  
   447  The `Resources` object supports the following keys:
   448  
   449  * `CPU` - The CPU required in MHz.
   450  
   451  * `DiskMB` - The disk required in MB.
   452  
   453  * `IOPS` - The number of IOPS required given as a weight between 10-1000.
   454  
   455  * `MemoryMB` - The memory required in MB.
   456  
   457  * `Networks` - A list of network objects.
   458  
   459  The Network object supports the following keys:
   460  
   461  * `MBits` - The number of MBits in bandwidth required.
   462  
   463  Nomad can allocate two types of ports to a task - Dynamic and Static/Reserved
   464  ports. A network object allows the user to specify a list of `DynamicPorts` and
   465  `ReservedPorts`. Each object supports the following attributes:
   466  
   467  * `Value` - The port number for static ports. If the port is dynamic, then this
   468    attribute is ignored.
   469  * `Label` - The label to annotate a port so that it can be referred in the
   470    service discovery block or environment variables.
   471  
   472  <a id="restart_policy"></a>
   473  
   474  ### Restart Policy
   475  
   476  The `RestartPolicy` object supports the following keys:
   477  
   478  * `Attempts` - `Attempts` is the number of restarts allowed in an `Interval`.
   479  
   480  * `Interval` - `Interval` is a time duration that is specified in nanoseconds.
   481    The `Interval` begins when the first task starts and ensures that only
   482    `Attempts` number of restarts happens within it. If more than `Attempts`
   483    number of failures happen, behavior is controlled by `Mode`.
   484  
   485  * `Delay` - A duration to wait before restarting a task. It is specified in
   486    nanoseconds. A random jitter of up to 25% is added to the delay.
   487  
   488  *   `Mode` - `Mode` is given as a string and controls the behavior when the task
   489      fails more than `Attempts` times in an `Interval`. Possible values are listed
   490      below:
   491  
   492      * `delay` - `delay` will delay the next restart until the next `Interval` is
   493        reached.
   494  
   495      * `fail` - `fail` will not restart the task again.
   496  
   497  ### Constraint
   498  
   499  The `Constraint` object supports the following keys:
   500  
   501  * `LTarget` - Specifies the attribute to examine for the
   502    constraint. See the table of attributes [here](/docs/runtime/interpolation.html#interpreted_node_vars).
   503  
   504  * `RTarget` - Specifies the value to compare the attribute against.
   505    This can be a literal value, another attribute or a regular expression if
   506    the `Operator` is in "regexp" mode.
   507  
   508  * `Operand` - Specifies the test to be performed on the two targets. It takes on the
   509    following values:
   510  
   511    * `regexp` - Allows the `RTarget` to be a regular expression to be matched.
   512  
   513    * `set_contains` - Allows the `RTarget` to be a comma separated list of values
   514      that should be contained in the LTarget's value.
   515  
   516    * `distinct_host` - If set, the scheduler will not co-locate any task groups on the same
   517          machine. This can be specified as a job constraint which applies the
   518          constraint to all task groups in the job, or as a task group constraint which
   519          scopes the effect to just that group. The constraint may not be
   520          specified at the task level.
   521  
   522          Placing the constraint at both the job level and at the task group level is
   523          redundant since when placed at the job level, the constraint will be applied
   524          to all task groups. When specified, `LTarget` and `RTarget` should be
   525          omitted.
   526  
   527    * `distinct_property` - If set, the scheduler selects nodes that have a
   528          distinct value of the specified property for each allocation. This can
   529          be specified as a job constraint which applies the constraint to all
   530          task groups in the job, or as a task group constraint which scopes the
   531          effect to just that group. The constraint may not be specified at the
   532          task level.
   533  
   534          Placing the constraint at both the job level and at the task group level is
   535          redundant since when placed at the job level, the constraint will be applied
   536          to all task groups. When specified, `LTarget` should be the property
   537          that should be distinct and and `RTarget` should be omitted.
   538  
   539    * Comparison Operators - `=`, `==`, `is`, `!=`, `not`, `>`, `>=`, `<`, `<=`. The
   540      ordering is compared lexically.
   541  
   542  ### Log Rotation
   543  
   544  The `LogConfig` object configures the log rotation policy for a task's `stdout` and
   545  `stderr`. The `LogConfig` object supports the following attributes:
   546  
   547  * `MaxFiles` - The maximum number of rotated files Nomad will retain for
   548    `stdout` and `stderr`, each tracked individually.
   549  
   550  * `MaxFileSizeMB` - The size of each rotated file. The size is specified in
   551    `MB`.
   552  
   553  If the amount of disk resource requested for the task is less than the total
   554  amount of disk space needed to retain the rotated set of files, Nomad will return
   555  a validation error when a job is submitted.
   556  
   557  ```json
   558  {
   559    "LogConfig": {
   560      "MaxFiles": 3,
   561      "MaxFileSizeMB": 10
   562    }
   563  }
   564  ```
   565  
   566  In the above example we have asked Nomad to retain 3 rotated files for both
   567  `stderr` and `stdout` and size of each file is 10MB. The minimum disk space that
   568  would be required for the task would be 60MB.
   569  
   570  ### Artifact
   571  
   572  Nomad downloads artifacts using
   573  [`go-getter`](https://github.com/hashicorp/go-getter). The `go-getter` library
   574  allows downloading of artifacts from various sources using a URL as the input
   575  source. The key-value pairs given in the `options` block map directly to
   576  parameters appended to the supplied `source` URL. These are then used by
   577  `go-getter` to appropriately download the artifact. `go-getter` also has a CLI
   578  tool to validate its URL and can be used to check if the Nomad `artifact` is
   579  valid.
   580  
   581  Nomad allows downloading `http`, `https`, and `S3` artifacts. If these artifacts
   582  are archives (zip, tar.gz, bz2, etc.), these will be unarchived before the task
   583  is started.
   584  
   585  The `Artifact` object supports the following keys:
   586  
   587  * `GetterSource` - The path to the artifact to download.
   588  
   589  * `RelativeDest` - An optional path to download the artifact into relative to the
   590    root of the task's directory. If omitted, it will default to `local/`.
   591  
   592  * `GetterOptions` - A `map[string]string` block of options for `go-getter`.
   593    Full documentation of supported options are available
   594    [here](https://github.com/hashicorp/go-getter/tree/ef5edd3d8f6f482b775199be2f3734fd20e04d4a#protocol-specific-options-1).
   595    An example is given below:
   596  
   597  ```json
   598  {
   599    "GetterOptions": {
   600      "checksum": "md5:c4aa853ad2215426eb7d70a21922e794",
   601  
   602      "aws_access_key_id": "<id>",
   603      "aws_access_key_secret": "<secret>",
   604      "aws_access_token": "<token>"
   605    }
   606  }
   607  ```
   608  
   609  An example of downloading and unzipping an archive is as simple as:
   610  
   611  ```json
   612  {
   613    "Artifacts": [
   614      {
   615        "GetterSource": "https://example.com/my.zip",
   616        "GetterOptions": {
   617          "checksum": "md5:7f4b3e3b4dd5150d4e5aaaa5efada4c3"
   618        }
   619      }
   620    ]
   621  }
   622  ```
   623  
   624  #### S3 examples
   625  
   626  S3 has several different types of addressing and more detail can be found
   627  [here](http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro)
   628  
   629  S3 region specific endpoints can be found
   630  [here](http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region)
   631  
   632  Path based style:
   633  
   634  ```json
   635  {
   636    "Artifacts": [
   637      {
   638        "GetterSource": "https://s3-us-west-2.amazonaws.com/my-bucket-example/my_app.tar.gz",
   639      }
   640    ]
   641  }
   642  ```
   643  
   644  or to override automatic detection in the URL, use the S3-specific syntax
   645  
   646  ```json
   647  {
   648    "Artifacts": [
   649      {
   650        "GetterSource": "s3::https://s3-eu-west-1.amazonaws.com/my-bucket-example/my_app.tar.gz",
   651      }
   652    ]
   653  }
   654  ```
   655  
   656  Virtual hosted based style
   657  
   658  ```json
   659  {
   660    "Artifacts": [
   661      {
   662        "GetterSource": "my-bucket-example.s3-eu-west-1.amazonaws.com/my_app.tar.gz",
   663      }
   664    ]
   665  }
   666  ```
   667  
   668  ### Template
   669  
   670  The `Template` block instantiates an instance of a template renderer. This
   671  creates a convenient way to ship configuration files that are populated from
   672  environment variables, Consul data, Vault secrets, or just general
   673  configurations within a Nomad task.
   674  
   675  Nomad utilizes a tool called [Consul Template][ct]. Since Nomad v0.5.3, the
   676  template can reference [Nomad's runtime environment variables][env]. For a full
   677  list of the API template functions, please refer to the [Consul Template
   678  README][ct].
   679  
   680  
   681  `Template` object supports following attributes:
   682  
   683  - `ChangeMode` - Specifies the behavior Nomad should take if the rendered
   684    template changes. The default value is `"restart"`. The possible values are:
   685  
   686    - `"noop"` - take no action (continue running the task)
   687    - `"restart"` - restart the task
   688    - `"signal"` - send a configurable signal to the task
   689  
   690  * `ChangeSignal` - Specifies the signal to send to the task as a string like
   691    "SIGUSR1" or "SIGINT". This option is required if the `ChangeMode` is
   692    `signal`.
   693  
   694  * `DestPath` - Specifies the location where the resulting template should be
   695    rendered, relative to the task directory.
   696  
   697  * `EmbeddedTmpl` -  Specifies the raw template to execute. One of `SourcePath`
   698    or `EmbeddedTmpl` must be specified, but not both. This is useful for smaller
   699    templates, but we recommend using `SourcePath` for larger templates.
   700  
   701  * `LeftDelim` - Specifies the left delimiter to use in the template. The default
   702    is "{{" for some templates, it may be easier to use a different delimiter that
   703    does not conflict with the output file itself.
   704  
   705  * `Perms` - Specifies the rendered template's permissions. File permissions are
   706    given as octal of the unix file permissions rwxrwxrwx.
   707  
   708  * `RightDelim` - Specifies the right delimiter to use in the template. The default
   709    is "}}" for some templates, it may be easier to use a different delimiter that
   710    does not conflict with the output file itself.
   711  
   712  * `SourcePath` - Specifies the path to the template to be rendered. `SourcePath`
   713    is mutually exclusive with `EmbeddedTmpl` attribute. The source can be fetched
   714    using an [`Artifact`](#artifact) resource. The template must exist on the
   715    machine prior to starting the task; it is not possible to reference a template
   716    inside of a Docker container, for example.
   717  
   718  * `Splay` - Specifies a random amount of time to wait between 0ms and the given
   719    splay value before invoking the change mode. Should be specified in
   720    nanoseconds.
   721  
   722  
   723  ```json
   724  {
   725    "Templates": [
   726      {
   727        "SourcePath": "local/config.conf.tpl",
   728        "DestPath": "local/config.conf",
   729        "EmbeddedTmpl": "",
   730        "ChangeMode": "signal",
   731        "ChangeSignal": "SIGUSR1",
   732        "Splay": 5000000000
   733      }
   734    ]
   735  }
   736  
   737  ```
   738  
   739  [ct]: https://github.com/hashicorp/consul-template "Consul Template by HashiCorp"
   740  [env]: /docs/runtime/environment.html "Nomad Runtime Environment"