[rudder-dev] rudder variables

Nicolas Charles nicolas.charles at normation.com
Mon Apr 8 16:22:25 CEST 2013


On 08/04/2013 16:14, Michael Gliwinski wrote:
> On Monday 08 Apr 2013 12:44:32 Nicolas Charles wrote:
>> There two types of Rudder Variables :
>> - variables refering to the node : they allow to access to simple info
>> about the current node, based on the inventory
>>           ${rudder.node.id} : uuid of the node
>>           ${rudder.node.hostname} : hostname of the node
>>           ${rudder.node.admin} : login of administrator of the node
>>     and also for it policy server :
>>            ${rudder.node.policyserver.ACCESSOR}, where ACCESSOR can be
>> id, hostname, or admin
>> - variables refering to variables defined in other Rule :
>> ${rudder.rule_id.VARIABLE_NAME} will look in the rule with id rule_id
>> for the value of the variable VARIABLE_NAME (as defined in the Technique)
> Aha, I knew there must be a way of referencing data from inventory! :D  Cool!
> Is there a list of names somewhere (I can check the source)?
For the moment, there is only id, hostname and admin.
You could check the source as well; it's in 
rudder-core/src/main/scala/com/normation/rudder/services/policies/ParameterizedValueLookupService.scala
If you think some values are really important to be usable, you can list 
them, we'll see to add them


>
> Regarding ${rudder.rule_id.VARIABLE_NAME}, are these internal?  I thought you
> only define values in directives?

Yeah, but you define values in directives in Rules
For instance, let's say that the Rule "Config SSH for Prod" has the id 
12345-6789; and contains a directive based on Technique Open SSH Server.
Then, if you refer to ${rudder.12345-6789.OPENSSH_SERVER_PORTS} you'll 
get the list of ports for SSH you defined in the directive based on 
technique OpenSSH Server in Rule "Config SSH for Prod"

Nicolas


More information about the rudder-dev mailing list