Puppet Facts » History » Version 14

Version 13 (Ohad Levy, 07/25/2012 02:47 PM) → Version 14/16 (Dominic Cleal, 02/19/2013 11:10 AM)


h1. Puppet Facts

h2. Content has been promoted Hello, This page tries to summarize the many ways you can get your facts visible in Foreman.

If you are planning using
Foreman Manual as your Puppet [[External Nodes]] Classifier, the *recommended* approach would be using the ENC script, which both updates your facts, and fetch the information at the same time.

h2. If You Are Using Puppet Storeconfigs

The content *Note:* starting from version 0.2, this page has been incorporated into is no longer required.
Foreman will automatically refresh
the official host facts once a puppet report comes in if you setup Foreman manual to use the same database as storeconfigs in the _database.yml_ file.

Earlier versions should follow:

Puppet storeconfigs option will ensure that your puppetmaster processes will actually update the database, therefore,
you should just see the facts while browsing foreman.

In order to prepare your system for [[Unattended installations]] you should probably run:
rake puppet:migrate:populate_hosts RAILS_ENV=production

This will create all required settings from your facts.

h3. Missing facts when using storeconfigs

If nodes are finishing their catalog runs, although the hosts operating system description is missing. Ensure that your /etc/puppet/puppet.conf contains the dbadapter under the [master] section. Add the following and either wait for a node to check in again, or manually run it with puppetd --test for this information to be updated.


dbuser= puppetuser
dbpassword= puppetpass

h2. Not using Puppet storeconfigs

h3. Running Foreman
on the main "": web site. same machine as the puppetmaster

If you run Foreman on the same machine as your puppetmaster and you have only one puppet master, you probably want to create a simple cronjob:
rake puppet:import:hosts_and_facts RAILS_ENV=production

this will import your facts (only new facts) every time you run the script.

h3. But I have many puppet masters, or Foreman is on another server

h4. Pushing facts through HTTP directly to Foreman

Foreman accepts remote puppetmaster sending their nodes facts through http, making it effective way to send facts over WAN.

the "script": is meant to run on each of your puppetmasters.
it will scan over all of the new fact files (from its last run) and will send them to foreman.

You will need to edit the script and set the Foreman URL (based on where Foreman is located in your setup).

You should run this script in a cronjob, if you have many puppet masters, you might consider adding a simple sleep argument (as mentioned inside the script header), this will avoid all of your puppetmasters hammering your database at the same time.

h4. local file system access to fact yaml files

The previously mentioned
You rake task accepts a _dir_ parameter, which means you can access tell it here: to import facts from any directory.
if you store your fact yaml on some network share, or if you want to mount your puppetmaster you can:
rake puppet:import:hosts_and_facts dir=/my/dir/with/yaml/files RAILS_ENV=production

* "*Foreman manual: Importing Facts*":

The archived version of
However, I would not recommend this page is "still available":/projects/foreman/wiki/Puppet_Facts?version=13 option if you have any network latency or if it requires you to run an NFS (or sshfs) etc