Variables interpolation in agent config file

Hello everybody!

I’m a 3-day newbie in Nomad, so, please, my apologies for the question from basics (the solution was searched for, but not able to find it).

Is there any ability to interpolate environment variables in the configuration file of the Nomad agent? Something like in the following fragment:

name = "objectinsertionX2.${NODE_ID}.global.nomad"

advertise {
  http = "${PUBLIC_IPADDR}:${VAST_TCP_PORT_4646}"

I’ve tried the following solution, but it doesn’t work:

Hi @geozavl,

This is not possible and variable interpolation is specific to Nomad job specifications not agent configurations. We expect a configuration management tool to provide this functionality when configuring the machine which Nomad will run on.

An example of why this would not be possible can be seen in your example. The Node.ID is only generated/known once the Nomad agent has started, but it needs the name configuration parameter to start.

jrasell and the Nomad team

1 Like