Files
nomad/website/content/docs/commands/var/get.mdx
Aimee Ukasick 23fd87d9c9 Docs: Commands section move "General options" to page bottom (#26001)
* sectionless files plus acl section

* alloc section

* config, deployment sections

* job section

* licence, namespace

* node, node-pool

* operator

* plugin, quota, recommendation

* scaling, sentinel, server, service, system, var, volume

* Add "ENT" label to left nav for enterprise commands

* job tag break into separate folder and files; update options header
2025-06-12 14:31:38 -05:00

68 lines
1.8 KiB
Plaintext

---
layout: docs
page_title: nomad var get reference
description: |-
The `nomad var get` command retrieves the variable at the given path from
Nomad.
---
# `nomad var get` command reference
The `var get` command is used to get the contents of an existing [variable][].
## Usage
```plaintext
nomad var get [options] <path>
```
If ACLs are enabled, this command requires a token with the `variables:read`
capability for the target variable's namespace and path. See the [ACL policy][]
documentation for details.
## Options
- `-item` `(string: "")`: Print only the value of the given item. Specifying
this option will take precedence over other formatting directives. The result
will not have a trailing newline making it ideal for piping to other
processes.
- `-out` `(enum: go-template | hcl | json | none | table )`: Format to render the
variable in. When using "go-template", you must provide the template content
with the `-template` option. Defaults to "table" when stdout is a terminal and
to "json" when stdout is redirected.
- `-template` `(string: "")` Template to render output with. Required when
output is "go-template".
- `-ui`: Open the variable page in the browser.
## Examples
Retrieve the variable stored at path "secret/creds":
```shell-session
$ nomad var get secret/creds
Namespace = default
Path = secret/creds
Create Time = 2022-08-23T11:14:37-04:00
Check Index = 116
Items
passcode = my-long-passcode
```
Return only the "passcode" item from the variable stored at "secret/creds":
```shell-session
$ nomad var get -item=passcode secret/creds
my-long-passcode
```
## General options
@include 'general_options.mdx'
[variable]: /nomad/docs/concepts/variables
[ACL Policy]: /nomad/docs/other-specifications/acl-policy#variables