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 3 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
34 changes: 34 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,34 @@ 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 3 to 5 Masters.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 to 5 or 3 and 5? Iirc the required API was removed in Puppet 4 and added again in 5.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right! I'll suggest clarifying the text like this:

Suggested change
It's been verified to work with uploading facts from Puppet 3 to 5 Masters.
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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, let's go with that then



## Authors
R.I.Pienaar <rip@devco.net> / www.devco.net / @ripienaar
Zack Smith <zack@puppetlabs.com> / @acidprime
Expand Down