github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/commands/var/index.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: "Commands: var"
     4  description: |-
     5    The "var" command groups subcommands for interacting with Nomad variables.
     6  ---
     7  
     8  # Command: var
     9  
    10  The `var` command is used to interact with Nomad [variables].
    11  
    12  ## Usage
    13  
    14  Usage: `nomad var <subcommand> [options] [args]`
    15  
    16  Run `nomad var <subcommand> -h` for help on that subcommand. The following
    17  subcommands are available:
    18  
    19  - [`var init`][init] - Create a variable specification file
    20  - [`var list`][list] - List variables the user has access to
    21  - [`var get`][get] - Retrieve a variable
    22  - [`var put`][put] - Insert or update a variable
    23  - [`var purge`][purge] - Permanently delete a variable
    24  
    25  ## Examples
    26  
    27  Create or update the variable stored at the path "secret/creds", which contains
    28  an item named `passcode` with the value `my-long-passcode`.
    29  
    30  ```shell-session
    31  $ nomad var put -out=table secret/creds passcode=my-long-passcode
    32  Successfully created variable "secret/creds"!
    33  
    34  Namespace   = default
    35  Path        = secret/creds
    36  Create Time = 2022-08-23T11:14:37-04:00
    37  Check Index = 116
    38  
    39  Items
    40  passcode = my-long-passcode
    41  ```
    42  
    43  Update a value:
    44  ```shell-session
    45  $ nomad var get secret/creds | nomad var put -in=json -out=table -v - user=dba
    46  Reading whole JSON variable specification from stdin
    47  Successfully updated variable "secret/creds"!
    48  
    49  Namespace   = default
    50  Path        = secret/creds
    51  Create Time = 2022-08-23T11:14:37-04:00
    52  Check Index = 116
    53  
    54  Items
    55  passcode = my-long-passcode
    56  user     = dba
    57  ```
    58  
    59  [variables]: /docs/concepts/variables
    60  [init]: /docs/commands/var/init
    61  [get]: /docs/commands/var/get
    62  [list]: /docs/commands/var/list
    63  [put]: /docs/commands/var/put
    64  [purge]: /docs/commands/var/purge