Puppet Facts
Version 1 (Ohad Levy, 09/16/2009 09:01 am)
| 1 | 1 | {{toc}} |
|
|---|---|---|---|
| 2 | 1 | ||
| 3 | 1 | h1. Puppet Facts |
|
| 4 | 1 | ||
| 5 | 1 | h2. Using Puppet Storeconfigs |
|
| 6 | 1 | ||
| 7 | 1 | Puppet storeconfigs option will ensure that your puppetmaster processes will actually update the database, therefore, |
|
| 8 | 1 | you should just see the facts while browsing foreman. |
|
| 9 | 1 | ||
| 10 | 1 | In order to prepare your system for [[Unattended installations]] you should probably run: |
|
| 11 | 1 | <pre> |
|
| 12 | 1 | rake puppet:migrate:populate_hosts RAILS_ENV=production |
|
| 13 | 1 | </pre> |
|
| 14 | 1 | ||
| 15 | 1 | This will create all required settings from your facts. |
|
| 16 | 1 | ||
| 17 | 1 | ||
| 18 | 1 | h2. Not using Puppet storeconfigs |
|
| 19 | 1 | ||
| 20 | 1 | h3. Running Foreman on the same machine as the puppetmaster |
|
| 21 | 1 | ||
| 22 | 1 | 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: |
|
| 23 | 1 | <pre> |
|
| 24 | 1 | rake puppet:import:hosts_and_facts RAILS_ENV=production |
|
| 25 | 1 | </pre> |
|
| 26 | 1 | ||
| 27 | 1 | this will import your facts (only new facts) every time you run the script. |
|
| 28 | 1 | ||
| 29 | 1 | h3. But I have many puppet masters, or Foreman is on another server |
|
| 30 | 1 | ||
| 31 | 1 | h4. local file system access to fact yaml files |
|
| 32 | 1 | ||
| 33 | 1 | The previously mentioned script accepts a _dir_ parameter, which means you can tell it to import facts from any directory. |
|
| 34 | 1 | if you store your fact yaml on some network share, or if you want to mount your puppetmaster you can: |
|
| 35 | 1 | <pre> |
|
| 36 | 1 | rake puppet:import:hosts_and_facts dir=/my/dir/with/yaml/files RAILS_ENV=production |
|
| 37 | 1 | </pre> |
|
| 38 | 1 | ||
| 39 | 1 | 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 |
|
| 40 | 1 | ||
| 41 | 1 | h4. Pushing facts through HTTP directly to Foreman |
|
| 42 | 1 | ||
| 43 | 1 | Foreman accepts remote puppetmaster sending their nodes facts through http, making it effective way to send facts over WAN. |
|
| 44 | 1 | ||
| 45 | 1 | the *extras/puppet/push_facts.rb* script is meant to run on each of your puppetmasters. |
|
| 46 | 1 | it will scan over all of the new fact files (from its last run) and will send them to foreman. |
|
| 47 | 1 | ||
| 48 | 1 | You will need to edit the script and set the Foreman URL (based on where Foreman is located in your setup). |
|
| 49 | 1 | ||
| 50 | 1 | You can probably run this script in cron as well, 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. |
