Puppet Facts » History » Version 8
- Table of contents
- Puppet Facts
Using Puppet Storeconfigs¶
Note: starting from version 0.2, this is no longer required.
Foreman will automatically refresh the host facts once a puppet report comes in if you setup Foreman 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.
Not using Puppet storeconfigs¶
Running Foreman on the 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.
But I have many puppet masters, or Foreman is on another server¶
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.
local file system access to fact yaml files¶
The previously mentioned rake task accepts a dir parameter, which means you can tell it 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
However, I would not recommend this option if you have any network latency or if it requires you to run an NFS (or sshfs) etc