Files
nomad/website/content/docs/commands/var/index.mdx
Aimee Ukasick dae496e427 Docs: SEO front matter description for search: commands section (#25175)
* Enhance front matter description for search

* acl section

* alloc section

* config section

* deployment section

* eval section

* job section

* license section

* namespace section

* node section

* node pool section

* operator section

* plugin section

* quota section

* recommendation section

* scaling section

* sentinel section

* server section

* service section

* setup section

* system section

* tls section

* var section

* volume section

* change reference to command reference

* Apply suggestions from code review

Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>

---------

Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
2025-03-19 12:02:02 -05:00

67 lines
1.9 KiB
Plaintext

---
layout: docs
page_title: nomad var reference
description: |-
The `nomad var` commands interact with Nomad variables. Create a variable specification file. Insert, update, delete, or acquire a lock over a variable. Fetch and list variables.
---
# `nomad var` command reference
The `var` command is used to interact with Nomad [variables].
## Usage
Usage: `nomad var <subcommand> [options] [args]`
Run `nomad var <subcommand> -h` for help on that subcommand. The following
subcommands are available:
- [`var init`][init] - Create a variable specification file
- [`var list`][list] - List variables the user has access to
- [`var get`][get] - Retrieve a variable
- [`var put`][put] - Insert or update a variable
- [`var purge`][purge] - Permanently delete a variable
- [`var lock`][lock] - Acquire a lock over a variable
## Examples
Create or update the variable stored at the path "secret/creds", which contains
an item named `passcode` with the value `my-long-passcode`.
```shell-session
$ nomad var put -out=table secret/creds passcode=my-long-passcode
Successfully created variable "secret/creds"!
Namespace = default
Path = secret/creds
Create Time = 2022-08-23T11:14:37-04:00
Check Index = 116
Items
passcode = my-long-passcode
```
Update a value:
```shell-session
$ nomad var get secret/creds | nomad var put -in=json -out=table -v - user=dba
Reading whole JSON variable specification from stdin
Successfully updated variable "secret/creds"!
Namespace = default
Path = secret/creds
Create Time = 2022-08-23T11:14:37-04:00
Check Index = 116
Items
passcode = my-long-passcode
user = dba
```
[variables]: /nomad/docs/concepts/variables
[init]: /nomad/docs/commands/var/init
[get]: /nomad/docs/commands/var/get
[list]: /nomad/docs/commands/var/list
[put]: /nomad/docs/commands/var/put
[purge]: /nomad/docs/commands/var/purge
[lock]: /nomad/docs/commands/var/lock