Push Puppet custom Facts to agent

16 views
Skip to first unread message

Nikhil Patil

unread,
Jan 31, 2019, 7:48:30 AM1/31/19
to Puppet Users
Hi All,

I have created the custom fact in ruby and placed in facterlib path on master. when i run facter -p on master i see the facter value in response. Now i want this to be pushed on all my agent from puppet master. how this can be achieved. 

Thanks & Regards
Nikhil

Bart-Jan Vrielink

unread,
Jan 31, 2019, 8:14:47 AM1/31/19
to Puppet Users

Hello,


Normally you would place custom facts in the directory lib/facter of a module (any module). When the setting pluginsync is true (and this is the default value for quite a long time), on the next puppet run this fact will be synced to the agent.


https://puppet.com/blog/introduction-pluginsync


--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/f69c0165-5a41-45a5-a2b2-8837d7374a8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Abhishek singh

unread,
Jan 31, 2019, 12:11:44 PM1/31/19
to puppet...@googlegroups.com
Hello Nikil,

Can you help me out in writing facts in ruby.?
Actually i want to run a command which is not working .

my code is :

require 'facter'
Facter.add(:xyz_version) do
  confine :kernel => "Linux"
  setcode do
    Facter::Core::Execution.execute('/bin/cat /var/xyz/installation.log | /bin/grep "CCHIDS VERSION" | /bin/grep -o  "[0-9].[0-9]"') 
  end
end

How i can rewrite in ruby?

--

Ben Ford

unread,
Jan 31, 2019, 3:09:09 PM1/31/19
to puppet...@googlegroups.com
Put your facts in a module and they'll be synced everywhere they're needed automatically. https://puppet.com/docs/puppet/5.3/plugins_in_modules.html#auto-download-of-agent-side-plug-ins-pluginsync

--
Reply all
Reply to author
Forward
0 new messages