2

I'm new to puppet. I read a bunch, managed to write a simple (and probably clumsy) manifest to configure a host together with a similarly simple fabric script to deal with pre-puppet setup. Great, so time to be more serious. I configured a puppet master under apache2. (I'm on ubuntu 14.04 with packages at version 3.8 thanks to the deb from puppet labs...)

So far, so good, but I'm stuck on a couple points now despite much searching and playing. Ultimately, this comes down to how to set up regression tests so that I believe I can always recreate my infra.

  1. The puppet master is running under apache2. I assume it's healthy, in so much as it doesn't complain and I'm serving on 8140. But I'd love a better way to confirm that than absence of errors. Is there a way to enquire about the master's health?

  2. I would like to be able to do automated testing. For the agents (individual hosts in my (tiny) fleet) I can bring up vagrant vm's, tell them their name is X, and then do a puppet apply. So then I can see if the host comes up the way I expect for host X. Then I can run a script on the vm that checks whatever I think the host should actually be doing. But I'd like to automate that, yet I oddly haven't found common recipes for doing so. I bet this isn't something I need to invent. Any pointers?

  3. In a similar vein, I'd like to do automated testing for the master as well. So this is (1) and (2) together, since I'm not sure how to test the master.

Thanks for any pointers.

3
  1. puppetmaster itself does not provide much information. If you add following to /etc/puppet/auth.conf:

    path ~ ^/status/no_key$
    auth off
    allow *
    

    You should be able to query puppetmaster status without providing certificates (it might be good idea to whitelist specific IPs using allow_ip)

    curl -ksS -H "Accept: pson" https://puppet.example.com:8140/production/status/no_key
    

    Which should respond with HTTP 200:

    {"is_alive":true,"version":"3.8.1"}
    

    Beside that puppetmaster stores a lot of information in YAML, typically in /var/lib/puppet/reports/. But those reports are not really human-friendly. So, you're probably looking for something like puppet-dashboard, which used to be part of official Puppet distribution, now developed as an open-source project.

puppet dashboard

  1. Puppet modules are typically tested using rspec-puppet, which is an extension of common Ruby test framework. You're probably looking for Beaker, which combines Vagrant boxes and rspec-puppet testing. Have a look at this tutorial.

  2. Sure, you probably don't want to debug your code in production. error propagation

    There are several options how to address this issue. One of them is using workflows with r10k or roles/profiles approach. Or you could just spin up a set of Vagrant boxes, test locally, then deploy. It's definitely good idea to manage versions of used puppet modules e.g. using puppet-librarian or r10k. Puppet is evolving, so the list of preferred tools might change over time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.