A collection of task oriented solutions in Puppet


Deploy Custom Facts from a module


You want to deploy a custom fact from a module.


$ find custom_fact/
custom_fact/lib/facter/             # put custom facts in this directory
custom_fact/lib/facter/ulimit.rb    # custom fact

# then run puppet to deploy the fact
$ puppet <your> <client> <options>
Info: Retrieving plugin
Notice: /File[/opt/puppetlabs/puppet/cache/lib/facter/ulimit.rb]/ensure: defined content as '{md5}86827131cd2c311606762b8b042019fd'

# and then use facter to check the custom fact is working

$ facter -p ulimit | head
  max_cpu_time => {
    soft => "unlimited",
    hard => "unlimited",
    unit => "seconds"


Deploying custom facts is as easy as placing them in the <MODULE>/lib/facter/ directory. Pluginsync will ensure they are copied to the correct location when the puppet client runs.

Please note that when using a Puppet master setup, facts run on the client, not on the server, and so values are based on the clients environment. If you need to run code on the master then you probably want a function.

See also