~gandelman-a/ubuntu/precise/facter/merge922788

« back to all changes in this revision

Viewing changes to documentation/custom.page

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2011-10-18 10:32:42 UTC
  • mfrom: (1.3.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: package-import@ubuntu.com-20111018103242-ag8i8vejfp8v7b1b
Tags: upstream-1.6.1
ImportĀ upstreamĀ versionĀ 1.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
---
2
 
inMenu: true
3
 
directoryName: Custom Facts
4
 
---
5
 
 
6
 
Facter does everything it can to make adding custom facts easy.  It will
7
 
autoload any files it finds in a ``facter/`` directory in its search
8
 
path, so you don't need to modify the package files.  Also, Facter will
9
 
search through your environment for any variables whose names start with
10
 
'FACTER_' (case insensitive) and automatically add those facts.
11
 
 
12
 
As a simple example, here is how I publish my home directory to Puppet:
13
 
 
14
 
   Facter.add("home") do
15
 
        setcode do
16
 
            ENV['HOME']
17
 
        end
18
 
    end 
19
 
 
20
 
I have ~/lib/ruby in my $RUBYLIB environment variable, so I just created
21
 
~/lib/ruby/facter and dropped the above code into a ``home.rb`` file
22
 
within that directory.