<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 14/09/2014 09:15, Maxime Longuet
wrote:<br>
</div>
<blockquote
cite="mid:B96401B9-0148-47B1-B3B5-33752BD946E4@itika.net"
type="cite">
<pre wrap="">
Hy,
I've a problem with enforce content file. I want use sys.ipv4 cfengine variable in content.
But we have a bug on VPS openvz, it doesn't work on cfengine 3.6 (issue has push to 3.7)
Issue : <a class="moz-txt-link-freetext" href="https://github.com/cfengine/core/pull/1819/files">https://github.com/cfengine/core/pull/1819/files</a>
Then i says, ok i'm push env variable with IP on my agent
IP_MASTER='XXX.XXX.XXX.XXX'
And when i'm search, i dont find how i can use env variable in my technique :(
If anyone has suggestion ...
Maxime
</pre>
</blockquote>
Hi Maxime,<br>
<br>
Currently, there is no solution for having environnement variable
techniques. In next version of rudder, you'll be able tu use the
variable ${rudder.node.env.IP_MASTER} to use the environment
variable IP_MASTER. The data will be fetched from the inventories,
and based on the information available at the promise generation
time.<br>
<br>
I can offer you a solution at the current time, based on a
Technique, and a file to deploy.<br>
Attached, you'll find 2 files: metadata.xml and
environmentVariable.st, that you can put on the Rudder policy
server, in the folder <br>
<i>/var/rudder/configuration-repository/techniques/systemSettings/misc</i><i>/</i><i>environmentVariable/1.0</i><br>
<br>
Add the folder in git, and commit, with the following commands, run
in <i>/var/rudder/configuration-repository/techniques/systemSettings/misc</i><br>
<i>git add environmentVariable</i><i><br>
</i><i>git commit -m "Adding a prototype technique to expose
environment variable"</i><br>
<br>
In the Web Interface, you'll need to go to the
Administration/Technique page, click on "Reload technique now". The
Technique "Expose environment variable" should appear on the left
tree; you'll need to drag and drop it on the tree on the right to be
able to use it<br>
<br>
Then you'll need to create a Directive based on it, that you would
apply to all node, as well as a Directive based on "Enforce a file
content", to create the file<br>
<i>/var/rudder/cfengine-community/env</i><br>
with the content<br>
<i>#! /bin/sh</i><i><br>
</i><i>env | sed 's/^/=/'</i><br>
<br>
And create it executable.<br>
<br>
<br>
Once these two directives are applied everywhere, you'll be able to
use your environment variables with the syntax ${env.IP_MASTER}<br>
<br>
Does it help ?<br>
<br>
Regards,<br>
Nicolas<br>
<br>
</body>
</html>