Main Contents

puppet certified professional

October 5, 2012

It’s official. I’m a Puppet Certified Professional. I took the exam the day before PuppetConf.

Filed under: Puppet | Comments (0)

puppetconf 2012

September 28, 2012

I’ve been at PuppetConf for the last couple of days. As usual, it has been an amazing experience and worth the price of admission.

After seeing the presentations, I have a few things I’d like to explore when I get back to the office next week:

  1. Puppet 3.0 has been released (to the dev repos- hits prod repos on Monday apparently).
  2. Logstash
  3. rspec-puppet
  4. I want to get reinvigorated about the cloud
  5. Random tools

Puppet3.0:

I’m most excited for the native hiera support. I’m also excited to see that you can do fully-qualified variables in hiera.

Logstash:

I’ve always been a fan of centralized logging, however my current methodology is to use rsyslog + LogAnalyzer as the solution. We never use LogAnalyzer, the MySQL DB is a pain to maintain, etc. I’m going to look initially at pointing rsyslog at logstash instead, then using logstash to ship apache logs. Logstash’s graphite capabilities looks like something I want to reverse engineer so I can exploit it for logs other than just apache logs.

rspec-puppet:

I think there’s value in using TDD for puppet code, but before diving in head first I want to play around a bit and make sure that it’s something worth investing my time into.

The Cloud:

Since my departure from Walt Disney Studios in April, I haven’t done much of anything with regard to the cloud or CloudStack. I want to change that. I can’t afford to have a home lab right now to stand up a test cloud, so I’m going to attempt to leverage public cloud providers built on top of CloudStack to continue my work with automated cloud provisioning with CloudStack. Things have changed quite a bit since I originally gave my talk at PuppetCamp LA and I want to make sure it all works. I’m also considering submitting a talk for the CloudStack Collaboration Conference later this year in Las Vegas.

Random Tools:

I need to finally pull the trigger and start learning to use some new tools. At the top of my list are Vagrant, BoxGrindr, and Varnish.

TL;DR:

If you didn’t attend this year, you really missed out. Catch the slides once they have been posted and register early for next year.

Filed under: Puppet | Comments (0)

the puppet inventory service from php

September 12, 2012

Let’s say you wanted to tie into Puppet’s inventory service from a PHP app.

I wanted to do just that, so I started googling around to see if someone already done it. I found an Ubersmith plugin that had some code and a great writeup on generating the certificate, which I’ll paraphrase here.

To generate a certificate called ’somecert’ on your puppetmaster, run this:

puppet cert generate somecert
cat /var/lib/puppet/ssl/private_keys/somecert.pem /var/lib/puppet/ssl/certs/somecert.pem > /tmp/testcert.txt

Then you’ll need to copy testcert.txt off to the machine where you’ll be running the php code.

Here’s some code to run on the php server. Depending on your environment, you might need to replace the puppetmaster’s hostname. Replace server.example.com with the name of one of your puppet-controlled nodes.

<?php
 
$curl = curl_init('https://puppet:8140/production/facts/server.example.com');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSLCERT, '/tmp/testcert.txt');
curl_setopt($curl, CURLOPT_HEADER, 0);
$extraHeaders = array(
    'Accept: yaml',
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $extraHeaders);
 
$response = curl_exec($curl);
 
$parsed = yaml_parse($response);
print_r($parsed);

Note that this is razor-blade code. There’s no error checking or anything. Just a quick example to get you off the ground. I’m using the PECL Yaml library to parse the response.

Filed under: Puppet | Comments (0)