Ask Your Question

how to create custom facts in puppet in RHOS server

asked 2017-07-06 02:05:33 -0500

kanchan gravatar image

I am new to puppet ..I have installed puppet server(3.6.2) and puppet agent (3.8.4)..i am trying to start with creating facts to achieve,I am following below steps: 1.added pluginsync=true under main section inside puppet.conf file in master server 2.added a file in(/var/lib/puppet/lib/facter/lastrun.rb) the content of the file is [root@sasin ~]$cat /var/lib/puppet/lib/facter/lastrun.rb require 'facter' Facter.add("lastrun") do setcode do Facter::Util::Resolution.exec('date') end end my question is if i do puppet agent -t --pluginsync from my agent server..i don't see any facts are loaded into client. How does it work? If i do sudo facter -p lastrun in master server..It works fine and displays the date

edit retag flag offensive close merge delete


hello,can i get a a answer??

kanchan gravatar imagekanchan ( 2017-07-07 02:32:08 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-07 03:51:32 -0500

Puppet 4.x

Create a YAML or JSON file in "/opt/puppetlabs/facter/facts.d" and put your facts inside, it's done !

Launch "facter" to see them. Of course, you can use your facts in your manifestrs.

edit flag offensive delete link more


hi thanks for the reply...but i don't see any puupetlabs directory inside my opt directory ..moreover i think facts.d need to be changed for external facts..pls correct if i am wrong

kanchan gravatar imagekanchan ( 2017-07-07 04:43:05 -0500 )edit

hello,can i get a answer???

kanchan gravatar imagekanchan ( 2017-07-13 02:41:09 -0500 )edit

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: 2017-07-06 02:05:33 -0500

Seen: 37 times

Last updated: Jul 07