A collection of task oriented solutions in Puppet


Override a Facter fact


You want to change the value of a fact retrieved from facter.


# show the operating system we are running (retrieved from facter)
$ puppet -e 'notify { "We are running on ${::operatingsystem}": }'
notice: We are running on Fedora

# override $operatingsystem for testing purposes
$ FACTER_operatingsystem=Debian puppet -e 'notify { "We are running on ${::operatingsystem}": }'
notice: We are running on Debian


There will often be times, when writing manifests or facts, that you will want to test slightly different conditions than you are currently running under. By specifying the FACTER_factname environment variable you can tweak the value you care about while leaving everything else in the run untouched.

Although the examples given in "Solution" are simplistic this technique can be very helpful when testing branching code, like the below, within your manifests:

class server_name {

  $apache_server = $::operatingsystem ? {
    Fedora  => 'httpd',
    Debian  => 'apache2',


See also