A collection of task oriented solutions in Puppet


Deploy External Facts from a module


You want to deploy external facts from a module.


$ find $module_name
$module_name/facts.d               # put external facts in this directory
$module_name/facts.d/process_count # external fact

# then run puppet to deploy the fact
$ puppet <your> <client> <options>
Notice: /File[/opt/puppetlabs/puppet/cache/facts.d/process_count]/ensure: defined content as '{md5}5bda41ca91cd90a420f62b952fecf1e2'

# and then use facter to check the external fact is working
$ facter -p process_count


In modern puppet (versions 3.4+) deploying external facts is as simple as placing them in the <MODULE>/facts.d/ directory and running puppet to copy the facts to each puppet client.

While the normal use case is as easy as the example above there are a few details to consider. Firstly the permissions of the external fact. You'll want to make it executible in the module directory on the puppet master so it has the correct permissions, and can be run, on the client.

Secondly, if you are using an older puppet, version 3.3 and below, then pluginsync will not know how to deploy external facts and you'll need to manage the file using a standard file resource. This also means the facts value will not be available to puppet on the run that deploys the fact itself.

Lastly, in the same way as a normal fact, the external fact will be deployed to -every- puppet client, not just the ones that use the module.

See also