Is it possible to use the environment variable inside a template?

I use a ENC, and I want to avoid the :
Warning: Local environment: "production" doesn't match server specified 
node environment "201401", switching agent to "201401".

So I decided to setup puppet.conf inside one of my classes:

        file { 'puppet.conf':
                path    => '/etc/puppet/puppet.conf',
                owner   => 'root',
                group   => 'root',
                mode    => '0644',
                content => template("puppetserver/puppet.conf.rb"),
          }

With a template to setup the right environemnt:

# cat puppet.conf.rb
[main]
    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl
    environment = <% @environment %>

[...]

But when I run puppet agent -t

Notice: /Stage[main]/Puppetserver/File[puppet.conf]/content:
--- /etc/puppet/puppet.conf     2014-01-24 13:57:38.936012378 +0100
+++ /tmp/puppet-file20140127-16572-37fj6g-0     2014-01-27 
17:42:06.854923849 +0100
@@ -10,6 +10,7 @@
     # Where SSL certificates are kept.
     # The default value is '$confdir/ssl'.
     ssldir = $vardir/ssl
+    environment =


It seems it is not able to read the environment variable. Any ideas?

thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/7f4adb4f-23e5-42df-8d91-7372786eea05%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to