I'm trying to add an environment variable as fact like this :
#export $FACTER_test="infof"
#facter | grep test
test => infof
But my fact don't synchronize with puppet master. I don't see it in /
var/puppet/yaml/clientfile.yaml
If I want this works, I've need to start puppet like this :
#puppetd -vt --factsync
but factsync's setting only works with test's setting
I've recently seen that adding custom fact method has changed so I've
followed the wiki "plugin in module" to create my own fact.
I successfully create this fact :
# home.rb
Facter.add("home") do
setcode do
ENV['HOME']
end
end
And try unsuccessfully this one :
# salle.rb
Facter.add("salle") do
setcode do
ENV['FACTER_test']
end
end
Puppet refuse to synchronize my own environments variables unless I
run the deamon manually :
#puppetd -vt --factsync
With my settings, Custom fact works but no with custom environments
variables
What's wrong ?
Serge FELIX
On puppet master :
------------------
# puppet.conf
[puppetmasterd]
modulepath = /etc/puppet/modules
------------------
------------------
#fileserver.conf
[files]
path /etc/puppet/files
#[facts]
# I comment this according to the "plugin in module" new method
# path /etc/puppet/modules/custom/plugins/facter
[plugins]
[modules]
----------------------
On client :
---------------------
#puppet.conf
[main]
server = toto.toto.fr
# Where Puppet stores dynamic and growing data.
# The default value is '/var/puppet'.
vardir = /var/lib/puppet
# 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
# I comment this according to the "plugin in module" new method
# pluginsync = true
factpath = $vardir/lib/facter
-------------------------
Where are you setting `FACTER_test'?
=scott
All my custom facts works when I run puppetd with -vt --factsync
If I start it normally, only the fact with ENV['HOME'] works.
I run puppet 0.24.8
thanks
If you want puppetd to inherit environment variables, set them in the puppetd init script.
I really don't see any value to gain by setting facts this way, but that's another discussion.
-scott
I want to target a pool of machines that have an environment variable
in common.
The FAQ says :
"Facter has a special types of facts that can be set from environment
variables. Any environment variable with a prefix of FACTER will be
taken by Facter and converted into a fact"
This works well in local but there is no synchronize with puppetmaster
unless I run the client with : puppetd -vt --factsync
It make me crazy
I need to specify which environments variables are passed to rc script
via the file /etc/conf.d/env_whitelist