2

I am trying to update a config file using the "File Enforce Content" in the Lines argument I have tried obtaining information about the node using ${rudder.node.hostname} this never gets replaced on the actual node though and remains the same? I am actually after the IP address of the node as well as the host name but using this to test the technique is working since the docs mention it.

Lines Parameter

[Config]
IP=${rudder.node.ipaddress}
Name=${rudder.node.hostname}

Nodes file

[Config]
IP=${rudder.node.ipaddress}
Name=${rudder.node.hostname}

Expected

[Config]
IP=10.0.0.1
Name=node1

(Just as a side note I am struggling to locate a list in the web portal or online of available replacement variables so the ip address one is probably wrong)

Dreamwalker
  • 173
  • 1
  • 7

2 Answers2

1

Variables computed by Rudder (ie rudder.node.hostname) cannot be used directly for now in techniques created with the technique editor. (I haven't manage to find the bug https://www.rudder-project.org/redmine/projects/rudder/issues, but there should be one, or you can open a new one if you want)

A workaround can be to create variable with the variable technique like the following screenshot

define rudder variable

and access the variable in technique editor like this:

${generic_variable_definition.hostname}

I think we will work soon on this issue to provide you a way to use it

0

I managed to use

${sys.host} ${sys.ipv4} ${sys.host}

The definitions I found here: CFEngine Special Variables