"Hacking The Data out of Puppet" by Dan Bode, Business Development at Puppet Labs
Watch videos from PuppetConf 2012 here: www.puppetlabs.com/community/videos/puppetconf
Speaker Bio: Dan has worked in the technology industry as a consultant and software developer for almost a decade. He has spent most of the last 4 years building infrastructure automation solutions and teaching people how to use Puppet. He currently works in the Business Development at PuppetLabs where he spends his time researching technologies and figuring out how they can be integrated with Puppet to provide value.
Learn more about puppet: http://bit.ly/QQoAP1
6. Facter, who am I?
Hi! your facts are:
kernel=linux
ipaddress=10.0.0.3
Agent
macaddress=…
# puppetconf # puppetize @ puppetlabs
7. facts
Hi Mr. Master,
I need a catalog. Here
Agent
are my facts
http://www.dgcomputers.org/testimonials.php
# puppetconf # puppetize @ puppetlabs
8. facts
Thanks for you facts.
Agent
store them in
I’ll just
PuppetDB
PuppetDB
# puppetconf # puppetize @ puppetlabs
9. Mr. ENC, is this host
defined as an external Yep, he should be an
node?
apache server. Here is
the definition
nodes
ENC
Agent
PuppetDB
facts
# puppetconf # puppetize @ puppetlabs
10. catalog
Just compiled your
Agent
One sec while
catalog. PuppetDB
I store it in PuppetDB.
facts
# puppetconf # puppetize @ puppetlabs
11. Here is your
catalog. Send me
a report and let
me know how it
went!
catalog
Agent
PuppetDB
catalog
facts
# puppetconf # puppetize @ puppetlabs
12. I hate to be a
bother, but can
you compute
the md5sums of
a few files?
catalog
Agent
PuppetDB
catalog
facts
# puppetconf # puppetize @ puppetlabs
13. report
Just finished applying.
Agent
are the results.
Here PuppetDB
catalog
facts
# puppetconf # puppetize @ puppetlabs
32. Inspecting the catalog:
• What types are in the catalog?
irb> catalog.resources.collect do |r| r.type end.uniq
• Gimme a resource:
irb>catalog.resource(‘Package[httpd]’)
# puppetconf # puppetize @ puppetlabs
33. Rspec Puppet:
let :facts do
{:operatingsystem => ‘Redhat’}
end
let :params do
{:bind_address => ‘0.0.0.0’
end
it { should contain_file(‘/tmp/foo.conf’) }
# puppetconf # puppetize @ puppetlabs
38. Hacking reports
Everything in Puppet is a state transition
User[‘dan’] : absent -> present
User[‘dan’][‘shell’] -> ‘/sbin/nologin’ -> /bin/bash
# puppetconf # puppetize @ puppetlabs
39. Setting up the agent:
[agent]
report=true
# puppetconf # puppetize @ puppetlabs
40. Archive reports in your
yamldir
[master]
reports = store
# puppetconf # puppetize @ puppetlabs
41. Puppet reports
$ cd `puppet config print reportdir`
$ ls
node1 node2 node3
$ ls node1
# puppetconf # puppetize @ puppetlabs
42. Every report from every run
ever
$ ls node1
201206060256.yaml 201206060303.yaml
201206060519.yaml 201206122349.yaml
201206122354.yaml 201206130002.yaml
# puppetconf # puppetize @ puppetlabs