Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add link to upload_facts.rb script and documentation how to use it in Puppet upgrades to README #30

Merged
merged 4 commits into from
Jul 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 <rip@devco.net> / www.devco.net / @ripienaar
Zack Smith <zack@puppetlabs.com> / @acidprime
Expand Down