This is a neat little Ruby script. It scrapes your PuppetDB API to generate a list of all operating systems + the used Puppet modules on that OS
Many people have big environment with different operating systems and upstream modules. Most upstream modules use rspec-puppet-facts for their tests. That means that all tests are executed for all operating systems listed in a metadata.json file of a module.
We can increase test coverage and decrease the chances of silently introduced bugs by adding the operating systems we actually use to the metadata.json. With this project we aim to disover differences between metadata.json files and the real world
We use a Ruby gem to connect to PuppetDB. The gem expects
~/.puppetlabs/client-tools/puppetdb.conf. This file is used by several
Puppet Inc tools. The content can look like this:
{
"puppetdb": {
"server_urls": "https://mypuppetdb:8081",
"cacert": "/home/bastelfreak/.puppetlabs/etc/puppet/ssl/certs/ca.pem",
"cert": "/home/bastelfreak/.puppetlabs/etc/puppet/ssl/certs/bastelfreak.pem",
"key": "/home/bastelfreak/.puppetlabs/etc/puppet/ssl/private_keys/bastelfreak.pem"
}
}Please ensure that:
- This file exists
- That the referenced certificates exist as well
- That the connection to PuppetDB works as well
We also need to install some gems:
bundle install --path .vendor/ --jobs "$(nproc)" --without r10k
If we not only want to generate a table with all modules, but also compare the real world with the individual metadata.json files, we need to provide a path to a directory that contains all modules.
If you use r10k, but don't have all modules locally, you can get them with:
r10k puppetfile install --moduledir './modules/' --puppetfile /path/to/Puppetfile --verbose info --colorYou can install r10k via your system package manager or download it from the puppet.com website. For convenience we also have it in our Gemfile. If you want to install it, please do:
bundle install --path .vendor/ --jobs "$(nproc)" --with r10k
If you want to use r10k installed through bundle, use it like this:
bundle exec r10k puppetfile install --moduledir './modules/' --puppetfile /path/to/Puppetfile --verbose info --color
To generate the full markdown table you need to execute one command!
bundle exec ruby main.rb
This will generate you the module_os_matrix_complete.md file.
You can get a bit of debug output if you set an environment variable named
DEBUG. The content of it doesn't matter.
DEBUG=foo bundle exec ruby main.rb
you need to deploy your modules to ./modules as mentioned in the
Prerequirements section. Once this was successful, the
script caches the PuppetDB catalogs because every PuppetDB API call is quite
expensive. You can delete the cache with:
rm ~/.cache/env2module-differ/cache.yaml- This project currently ignores environments and always assumes
production - It's tested on modern Ruby 2.6 / 2.7
| Modules \ OS | CentOS-7 | Fedora-31 | Archlinux | CentOS-6 | FreeBSD-12 | Debian-9 | CentOS-8 |
|---|---|---|---|---|---|---|---|
| puppetlabs-apache | used | not used | not used | used | not used | not used | not used |
| puppetlabs-apt | not used | not used | not used | used | not used | not used | not used |
| puppet-archive | used | incomplete | not used | used | not used | incomplete | not used |
| puppet-bird | used | not used | used | not used | not used | not used | not used |
| puppet-borg | used | used | used | used | not used | used | not used |
| openstack-ceph | incomplete | not used | not used | not used | not used | not used | not used |
| choria-choria | incomplete | incomplete | used | incomplete | not used | incomplete | used |
| puppet-collectd | used | not used | not used | not used | not used | not used | not used |
| KyleAnderson-consul | incomplete | not used | used | incomplete | used | used | not used |
| puppet-cron | incomplete | incomplete | used | incomplete | not used | incomplete | used |
| puppet-dhcp | not used | not used | not used | not used | used | not used | not used |
| garethr-docker | not used | not used | not used | not used | used | not used | not used |
| puppet-ferm | incomplete | incomplete | used | incomplete | used | used | used |
| theforeman-foreman | not used | not used | used | not used | not used | not used | not used |
| theforeman-foreman_proxy | not used | not used | used | not used | not used | not used | not used |
| puppetlabs-git | used | incomplete | incomplete | incomplete | used | incomplete | incomplete |
| puppet-grafana | not used | not used | used | not used | not used | not used | not used |
| puppetlabs-haproxy | used | not used | used | not used | not used | not used | not used |
| puppet-ipset | used | incomplete | used | used | used | incomplete | not used |
| camptocamp-kmod | incomplete | incomplete | used | incomplete | incomplete | incomplete | not used |
| cirrax-libvirt | not used | not used | not used | not used | not used | not used | not used |
| puppet-lldpd | used | incomplete | used | used | used | incomplete | incomplete |
You've got questions? This project doesn't work in your environment? You want to contribute? Reach out to bastelfreak in the #voxpupuli IRC channel on Freenode.
This project is licensed under the AGPL v3.