Ask Your Question
2

Configuring Custom Facts?

asked 2013-06-26 10:26:03 -0500

jaisol gravatar image

updated 2013-06-26 10:27:12 -0500

Hello,

I was wondering if there is any default folder structure I can use to distribute all custom facts to all the clients without a specific module, something like {defaultpath}/lib/facter/mycustomfact.rb

or I need to create a specific module folder structure and sync it such as {modulepath}/{module}/lib/facter/mycustomfact.rb

Also, can i create several custom facts in a single file or do i need to have a rb file per custom fact? I'm asking because I created some facts in the same rb file but sometimes it pushes just one of them so ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-06-26 11:59:06 -0500

Hello !

Yes the recommended way will be to use a base class every node will get that would contain custom facts (and more)

But since facter 1.7 you can use a more lightweight approach : /etc/facter/facts.d, it's very easy to add facts that way, but again you will need a specific module tha all nodes will have.

edit flag offensive delete link more

Comments

Got it. Any idea about my second doubt? "Also, can i create several custom facts in a single file or do i need to have a rb file per custom ...(more)

jaisol gravatar imagejaisol ( 2013-06-26 14:39:10 -0500 )edit

I believe you could have multiple facts per ruby file, the limiting factor is the presence of Facter.add('FACT_NAME') . Simplified version of our own facter at work https://gist.github.com/jrottenberg/5872127

Julien R. gravatar imageJulien R. ( 2013-06-26 16:51:04 -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

Stats

Asked: 2013-06-26 10:26:03 -0500

Seen: 1,497 times

Last updated: Jun 26 '13