g h
unread,May 12, 2011, 4:44:17 PM5/12/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Puppet Users
I am having trouble getting custom facts to be read in my puppet
config. Also, for some reason the facter command is looking in the "./
facter" directory when I run it; so if I run facter from within my
module directory's lib folder, I can get the output.
How can I get facter to read modules?
Relevant output is below.
Thanks!
[root@puppet facter]# pwd
/etc/puppet/modules/nsc-puppet-utils/lib/facter
[root@puppet facter]# cat dns_servers.rb
q = 1
` grep '^[ \t]*nameserver' /etc/resolv.conf | awk '{print $2}' `.each
do |line|
Facter.add( "dns" + q.to_s ) do
setcode { line }
end
q = q+1
end
[root@puppet facter]# facter | grep dns
[root@puppet facter]# cd ..
[root@puppet lib]# pwd
/etc/puppet/modules/nsc-puppet-utils/lib
[root@puppet lib]# facter | grep dns
dns1 => 172.30.0.53
dns2 => 172.30.0.54
[root@puppet lib]# strace -f facter 2>&1 | grep dns_servers
stat64("./facter/dns_servers.rb", {st_mode=S_IFREG|0644,
st_size=172, ...}) = 0
open("./facter/dns_servers.rb", O_RDONLY|O_LARGEFILE) = 3
open("./facter/dns_servers.rb", O_RDONLY|O_LARGEFILE) = 3
open("./facter/dns_servers.rb", O_RDONLY|O_LARGEFILE) = 3
[root@puppet nsc-puppet-utils]# cat /etc/puppet/puppet.conf
[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
pluginsync = true
templatedir = $confdir/templates
pluginsync = true
factsync = true
[master]
modulepath = $confdir/modules
manifestdir = $confdir/manifests
manifest = $confdir/manifests/site.pp
autosign = true
[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt
# Where puppetd caches the local configuration. An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig