CodeMash 2013 Day 3, Session 1

CodeMash

# Puppet for Developers
Eric Hankinson

## Automating your infrastructure
If your infrastructure is code, you can make it testable and version control it. Automation ensures that it truly is repeatable.
Puppet isn’t just for *nix-based OSes – it works on Windows, too.
Removing manual processes removes the chances for errors.

## Puppet Model
There is a Configuration language.
Puppet master and nodes or standalone.
Resources are the parts of your system.
Facter is another piece that lets you define facts (OS version, ipaddresses, etc.)
Nodes are called agents.

## Puppet Language Basics
You can include other scripts and require dependencies
There is support for variables and conditionals
The language appears to be a DSL with some aspects stolen from Java, Ruby, and JavaScript. _I’ll need to research that further._
Lots of slides of code but the spoken words are more vague. The slides of code are mostly just wallpaper.
There are templating capabilties that you can use to pump out configuration files for your services.
You can use inheritence to define a general machine configuration and then specify specifics for each machine of that type (so a web server config with overrides for the ip addresses)
You can build custom parsers to do things like pulling your password and secrets from some other source (you wouldn’t want to check in a secret)

## Custom Modules
There is a Puppet Forge that has lots of already defined custom modules for a lot of existing tools. Not a lot of Windows content, though.
To create a module: puppet module generate leandog-fatcat
Term before the dash is the company name, term after is the module name. Company name is required, so you have to have a dash.
There is an expected folder structure generated that you can use to put the appropriate items in
There is a module file you need to create that has the metadata about the module.
rspec-puppet allows you to use rspec to test your puppet modules
puppet module build will build your module so that you can deploy and use it.
http://forge.puppetlabs.com is a repository of puppet modules – it does not contain the module code but provides a list. You are supposed to put a link to your github repo where the module lives

## Vagrant
Vagrant manages virtual machines
Can manage VMWare or VirtualBox VMs
Puppet and Vagrant work well together

Advertisements