问题原文
原帖链接 · jma · CC BY-SA 3.0
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.
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?
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?
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.
已采纳解答
原帖链接 · Tombart · CC BY-SA 3.0
puppetmasteritself 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
puppetmasterstatus without providing certificates (it might be good idea to whitelist specific IPs usingallow_ip)curl -ksS -H "Accept: pson" https://puppet.example.com:8140/production/status/no_keyWhich should respond with HTTP 200:
{"is_alive":true,"version":"3.8.1"}Beside that
puppetmasterstores 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 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.
Sure, you probably don't want to debug your code in production.
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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
