File: custom.page

package info (click to toggle)
facter 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,744 kB
  • ctags: 1,254
  • sloc: ruby: 16,127; ansic: 1,062; sh: 48; makefile: 14
file content (22 lines) | stat: -rw-r--r-- 717 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
---
inMenu: true
directoryName: Custom Facts
---

Facter does everything it can to make adding custom facts easy.  It will
autoload any files it finds in a ``facter/`` directory in its search
path, so you don't need to modify the package files.  Also, Facter will
search through your environment for any variables whose names start with
'FACTER_' (case insensitive) and automatically add those facts.

As a simple example, here is how I publish my home directory to Puppet:

   Facter.add("home") do
     setcode do
       ENV['HOME']
     end
   end

I have ~/lib/ruby in my $RUBYLIB environment variable, so I just created
~/lib/ruby/facter and dropped the above code into a ``home.rb`` file
within that directory.