diff --git a/README.md b/README.md index b908a6f..431629e 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,12 @@ that the node is still active. This filtered list should contain only machines that have not been decommissioned in PuppetDB (important as compiling their catalogs would also reactive them and their exports otherwise). +When you are comparing between different versions of Puppet using two Master servers +you are going to need to copy facts from the old Master to the new one in order to be +able to compile catalogs on the new Master. This is useful when upgrading Puppet version. + +To upload facts to PuppetDB on a Master see the [Upload facts](#upload-facts-to-puppetdb) script. + ## Usage @@ -178,6 +184,37 @@ viewed in markdown using the Rakefile in this directory. A web viewer is also available at [https://github.com/camptocamp/puppet-catalog-diff-viewer](https://github.com/camptocamp/puppet-catalog-diff-viewer) +## See also + +### Upload facts to PuppetDB + +Standalone Ruby script `upload_facts.rb` that is used to upload yaml files with facts to +PuppetDB. This is useful when you are upgradering Puppet version and uses two different +Puppet Masters for this. Then you can use this script to upload facts from the old Master +to the new one. The script can also be used to just refresh the facts in PuppetDB from +the old Master. These facts are required to be able to compile the catalogs on the new +Master. + +The script uses yaml-files in the same format as stored on the Puppet Master when real +agents report their facts at the beginning of a Puppet Agent execution. + +The script is developed to be executed on the Puppet Master, so the yaml-facts files +should be copied to the new Master using scp or similar, preferably to the +`$(puppet config print vardir)/yaml/facts` directory. + +Then all files in the directory can be uploaded to PuppetDB by using this command: + +```shell +$ ./upload_facts.rb $(puppet config print vardir)/yaml/facts/*.yaml +``` + +The script is available at [https://github.com/JohnEricson/upload_facts](https://github.com/JohnEricson/upload_facts). + +It's been verified to work with uploading facts from Puppet Masters running Puppet +version 3 to Masters running version 5. It uses the [`/puppet/v3/facts/` API](https://puppet.com/docs/puppet/6.17/http_api/http_facts.html) +which is available in version 3 and >= 5 of Puppet. This API was removed in Puppet 4 but +added again in 5. + ## Authors R.I.Pienaar / www.devco.net / @ripienaar Zack Smith / @acidprime