List out all platform variables

From https://www.nomadproject.io/docs/runtime/interpolation.html we can see a few common variables.

Example:
${attr.platform.aws.instance-type}

How, or what command can I use, to get a list of all such possible variables?

I am especially intrested in the “nomad region” and the “nomad datacenter” variable.

Is there a way already to get it?
If yes, could the documentation be updated?

If not, could a generic functionality be added to list them? (AFK now, but I suspect it can be extracted from the Agent’s information somehow)

Answering my own question, sort of.
This seems to work for some information:

nomad node status -verbose -self 

BTW, datacenter is “DC”, and I am still not sure how to get the region. :frowning:

Any update on this? Any simple way to know which all variables exist in the system?

Hey shantanugadgil,

In the runtime environment section of the Nomad docs there are a few other (environment) variables listed, including NOMAD_REGION and NOMAD_DC. Perhaps you can use those.

I am always a bit confused between these two:


The wording “Below is a table documenting common node properties:” on the page has me confused a bit. Are there more properties? What are they? Where are they? so-on and so forth.

Also it isn’t always spelt out which syntax can be used where, i.e. which form can be used in the constraint stanza, which one in the artifact section. Most of these things “develop” over time by trial-and-error.

Starting the Nomad agent in “dev” mode, and I see the following using the command:

# nomad node status -verbose -self

cpu.arch                                
cpu.frequency                           
cpu.modelname                           
cpu.numcores                            
cpu.totalcompute                        
driver.raw_exec                         
kernel.name                             
kernel.version                          
memory.totalbytes                       
nomad.advertise.address                 
nomad.revision                          
nomad.version                           
os.name                                 
os.signals                              
os.version                              
platform.aws.ami-id                     
platform.aws.instance-type              
platform.aws.placement.availability-zone
unique.cgroup.mountpoint                
unique.hostname                         
unique.network.ip-address               
unique.platform.aws.hostname            
unique.platform.aws.instance-id         
unique.platform.aws.local-hostname      
unique.platform.aws.local-ipv4          
unique.platform.aws.public-hostname     
unique.platform.aws.public-ipv4         
unique.storage.bytesfree                
unique.storage.bytestotal               
unique.storage.volume                   

The main reason for asking the original question was that, when proposing a Nomad+Consul (+Vault) architecture for re-architecting existing applications, there is always a bright :bulb: who ends up asking something which is not already there in the docs (of course) and I wanted a fixed place to point folks to.

Thanks and Regards,
Shantanu Gadgil

Hi shantanugadgil,

Regarding region:
It looks like the region isn’t returned from /v1/nodes/<node_id>, but it is returned from /v1/agent/self:

$ http localhost:4646/v1/agent/self | jq '.config.Region'
"global"

So, as long as you’re not overriding the region with a query parameter, this will tell you what region you are talking to.

Unfortunately, in the short term, the only definitive listing of all of the fingerprinted material would be in the individual bits of fingerprinting code. For example, the AWS metadata:

And the GCP one:

We certainly can/should do more to document these; I know I’ve had to dig through these a few times myself.

Thanks, this is somewhat helpful, though it would have awesome if it was just at one place! :slight_smile: Thanks again!