Configuration Management systems like CFEngine, Puppet and Chef, are often adopted as part of devops toolchains. It promises us infrastructure as code a concept that leads to 'Agile' infrastructure: In this session I'd like to give: - a brief explanation of the concept and why it's useful - an overview about the similarities this has with regular code - concepts such as TDD, BDD how well can they be translated - how it fits in with continuous Integration for systems Besides the concept translation I will add links to existing tools and project that working and evolving in the space. And finally, is it really the same? Does a coding background help you? Where do the tools/concepts need improvement? After this session I'm sure you'll be ready to give it a spin and explore more and possibly share some ideas back.
No Crash Allowed - Patterns for fault tolerance : Uwe Friedrichsen
It's code but not as we know: Infrastructure as Code - Patrick Debois
1. Infrastructure as Code Patrick Debois
http://www.tumblr.com/tagged/star-trek-quotes
Wednesday 17 October 12
2. Organizer Since 2009 Europe Organizer 2010 First Europe Training 2010 Speaker
Monitoring Chapter Technical Reviewer Co-Author Veewee / Sahara / Mccloud
Libvirt - Fog Freelance consultant Engineer http://github.com/jedi4ever
Blog: http://jedi.be/blog - Twitter: @patrickdebois - #devops
Wednesday 17 October 12
3. http://cfengine.com/ http://ansible.cc/
http://puppetlabs.com/ http://palletops.com/
http://opscode.com/chef/
CONFIGURATION
MANAGEMENT SYSTEMS
Wednesday 17 October 12
4. Chef & Puppet focused
based on my experience
http://www.nerdnirvana.org/wp-content/uploads/2010/12/apology-form.jpg
Wednesday 17 October 12
5. GIVE ME THE CODE:
“LANGUAGE”
Wednesday 17 October 12
6. EXAMPLE SYNTAX
Puppet Chef
class myapache { package “apache2”
package “apache2” service “apache2 do
action [:enable , :start]
service “apache2”: end
ensure => “running”,
require => Package[“apache2”]
}
Wednesday 17 October 12
7. TERMINOLOGY
Java Puppet Chef
manifests recipes
*.java
*.pp *.rb
package module cookbook
Wednesday 17 October 12
8. TERMINOLOGY (2)
Java Puppet Chef
parametrized recipes with
singleton
classes attributes
defines, definitions,
class
classes libraries
Wednesday 17 October 12
9. SYNTAX
Puppet Chef
Limited DSL
DSL + full ruby
(by design)
Extended by Light Weight
Definitions Resource Providers /
Custom Resource Definitions
Providers, Light
providers Weight Resource
ERB & Custom Providers
Libraries
Libraries
Wednesday 17 October 12
10. LOOPING CONSTRUCTS
Puppet Chef
pass array of elements
erb template for loops do while , repeat etc.
create_resource available through
(:type, hash) native ruby
Wednesday 17 October 12
11. VARIABLES
Puppet Chef
special syntax native ruby
$bla = “aa” bla = “aa”
string interpolation string interpolation
$bla_string = “${bla}” bla_string = #{bla}
Wednesday 17 October 12
12. SINGLE CLASS
INHERITANCE
Puppet Chef
override via ‘module override via
path’ ‘cookbook’ path
+> operator “cookbook” attribute
Wednesday 17 October 12
24. Puppet Chef
http://puppet-lint.com/ http://acrmp.github.com/
foodcritic/
• FC001: Use strings in preference to symbols to access node attributes
• Must use two-space soft tabs. • FC002: Avoid string interpolation where not required
• Must not use literal tab characters. • FC003: Check whether you are running with chef server before using server-
specific features
• Must not contain trailing white space.
• FC004: Use a service resource to start and stop services
• Should not exceed an 80 character line width • FC005: Avoid repetition of resource declarations
An exception has been made for source
=>
'puppet://...' lines as • FC006: Mode should be quoted or fully specified when setting file
permissions
splitting these over multiple lines decreases the readability of the
• FC007: Ensure recipe dependencies are reflected in cookbook metadata
manifests. • FC008: Generated cookbook metadata needs updating
• Should align arrows (=>) within blocks of attributes. • FC009: Resource attribute not recognised
• FC010: Invalid search syntax
• ....
• FC011: Missing README in markdown format
• FC012: Use Markdown for README rather than RDoc
• • FC013: Use file_cache_path rather than hard-coding tmp paths
•
https://github.com/ampledata/cookbook-style-guide
http://docs.puppetlabs.com/guides/style_guide.html
Wednesday 17 October 12
36. LOGGING WITH
DIFFERENT LEVELS
Info only, no exception
Chef::Log.info('Some
useful
info')
Fatal, raising exception
Chef::Log.fatal('Something
bad')
Wednesday 17 October 12
62. execution time
number of classes
https://github.com/krux/puppet-module-graphite-report
https://github.com/imeyer/chef-handler-graphite
https://github.com/joemiller/puppet-graphite_event
Wednesday 17 October 12
63. TARGETED TESTING
IMPACT OF CHANGE
https://github.com/jonlives/knife-preflight
https://github.com/jedi4ever/puppet-cic
Wednesday 17 October 12
64. Infrastructure as Code Patrick Debois
http://www.tumblr.com/tagged/star-trek-quotes
Wednesday 17 October 12