Ask Your Question

custom fact from module

asked 2016-04-22 06:15:29 -0600

jdripper gravatar image


I'm quite new to puppet.

I am trying to add a custom fact from a module. My debug output looks like this :

puppet agent --test --debug --server=masterserver > /tmp/pout.txt
[root@haproxy1 ~]# grep tmproduct /tmp/pout.txt

Debug: /File[/opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb]/seluser: Found seluser default 'system_u' for /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Debug: /File[/opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb]/selrole: Found selrole default 'object_r' for /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Debug: /File[/opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb]/seltype: Found seltype default 'lib_t' for /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Debug: /File[/opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb]/selrange: Found selrange default 's0' for /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Debug: Loading facts from /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Info: Facter: loading custom facts from /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb.
Debug: Facter: fact "tmproduct" has resolved to "sys".

Which seems to look good. However when I try facter it doens't seem to be there : facter | grep -i tmproduct Gives me nothing.

cat /opt/puppetlabs/puppet/cache/lib/facter/tmproduct.rb
Facter.add(:tmproduct) do
        setcode do
                fqdn = Facter.value(:fqdn)
                fqdn = fqdn.split('.')
                if fqdn.length > 1

Any ideas on what I'm doing wrong ?


edit retag flag offensive close merge delete


Forgot to add, I'm on puppet 4.4

jdripper gravatar imagejdripper ( 2016-04-22 06:28:10 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-22 16:27:35 -0600

lupin gravatar image

Do a facter -p tmpproduct , -p shows the custom facts.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-04-22 06:15:29 -0600

Seen: 449 times

Last updated: Apr 22 '16