About me
(in respect to configuration management)
clusterssh in 2005
cfengine in 2006 until 2007
puppet since 2007
never used chef, bcfg2, cfengine3,ansible,salt or your mom's favourite cfg mgmt tool... (I've heard and read about them though...)
clusterssh
i.e. execute the same command on multiple hosts and hope that all host behave the same way
easy to begin with
very manual
scalability issues ;)
MY CLUSTERSSH EXPERIENCE
managed up to ~10 at one time @ Puzzle ITC
CFENGINE (2.x)
i.e. lots of boilerplate manifest code of which knowbody knows what it does => "WTF is THIS for?!?"
idempotent
declarative ?!?
lots non-declarative functions
e.g. AppendIfNoSuchLine, really?
no progress in development
12 years old in 2007
code looks bulky and old
MY CFENGINE EXPIERENCE
managed ~60 hosts @ Puzzle ITC
puppet
i.e. Model Driven Datacenter
declarative
abstract
idempotent
a model of "resources" and "relationships"
compiled
MY PUPPET EXPERIENCE
managed ~120 nodes with ~170 Modules @ Puzzle ITC
bootstrapped puppet setup @ Die Mobiliar
15 (!) environments, now ~3000 nodes
managed webstack & deployment @
Atizo
~10 nodes, ~110 Modules
PUPPET @ SWISSTXT
platform-services for private cloud offering
~144 nodes, ~50 modules
boostrapped puppet environment @ SWISS TXT
currently ~20 nodes, ~30 modules
Puppet COMPONENTS
internal (puppet executable)
Language parser and compiler (for internal DSL)
Resource Abstraction Layer (RAL, Types and Providers)
Agent/Master (Client/Server)
PKI (PuppetCA)
external (other executables)
PuppetDB (formerly storedconfigs)
Facter for normalized node information
Hiera for external parameterization
Marionette Collective for centralized orchestration
Compiler output is a catalog
catalog is a DAG
TYPES AND PROVIDERS
MASTER/AGENT
Master is a RESTful webservice
Agents consume this webservice
Secured with SSL client authentication
PuppetCA
Every host got a SSL certificate
Certificates are signed with the PuppetCA (Puppet's own Certificate Authority)
FACTER
or how do your nodes look like?
[root@ellen ~]# facter
...
architecture => x86_64
domain => yokto.net
fqdn => ellen.yokto.net
hardwaremodel => x86_64
hostname => ellen
interfaces => eth0,lo
ipaddress => 195.141.111.126
ipaddress_eth0 => 195.141.111.126
ipaddress_lo => 127.0.0.1
is_virtual => true
kernel => Linux
kernelmajversion => 2.6
kernelversion => 2.6.32
lsbdistid => CentOS
lsbdistrelease => 6.4
lsbmajdistrelease => 6
...
available as variables anywhere in your puppet code
puppetdb
used for exported resources
declare a resource on one host, apply on another
central inventory of all facts from all nodes
Hiera
hierarchical parameter storage
MCollective
framework to build server orchestration or parallel job execution systems
PUPPET'S DSL
restricted by design
specific to the domain
managing resources, declaring relationships
declarative (not imperative/no iterators)
uses functional programming paradigms to work with collections of items (e.g.
map)
Give me code please!
class openssh::server {
package{'openssh-server':
ensure => present,
}
file{'/etc/ssh/sshd_config':
ensure => present,
source => 'puppet:///modules/openssh/sshd_config',
group => 'root',
mode => '0444',
require => Package['openssh-server'],
notify => Service['sshd'],
}
service{'sshd':
ensure => running,
enable => true,
require => [
Package['openssh-server'],
File ['/etc/ssh/sshd_config'],
],
}
}
The same without redundanT RELATIONSSHIPS OR DEFAULT VALUES
and the use of relationship operators
class openssh::server {
package{'openssh-server':
ensure => present,
} ->
file{'/etc/ssh/sshd_config':
source => 'puppet:///modules/openssh/sshd_config',
} ~>
service{'sshd':
ensure => running,
enable => true,
}
}
language constructs
MANIFESTS
IMPORT
NODES
MODULES
CLASSES
NAMESPACING AND AUTOLOADING
DEFINED TYPES
NATIVE TYPES
FUNCTIONS
manifests
every file ending in .pp and containing puppet DSL code is called a manifests
IMPORT
included a file in place and evaluate it
just like php's include
never use it it in modules
only use it to bootstrap code
nodes
defined in site.pp (common practice)
puppet's entry point
only include/declare classes (best practice)
modules
a convention to structure/group
manifests
FILES
TEMPLATES
FUNCTIONS
FACTS
TYPES and providers
classes
singletons
parameterizable
can be declared multiple times (without parameters)
but will get applied only once
can de declared only once (with parameters)
namespacing and autoloading
modulepaths
Default: $confdir/modules:/usr/share/puppet/modules
MPC:
$confdir/$environment/forge
$confdir/$environment/site
$confdir/$environment/role
$confdir/$environment/platform-services
defined types
not singletons ;)
parameterizable
can de declared multiple times (with different identifiers)
look and behave like native resources
native types
file package service
user group host
mount exec augeas
ssh_authorized_key yumrepo
functions
are executed on the server during catalog compilation
are written in ruby
e.g. template compilation
NAMESPACING AND AUTOLOADING
$modulepath/modulename/init.pp =>
class modulename {
$modulepath/modulename/server.pp =>
class modulename::server {
$modulepath/modulename/server/debian.pp =>
class modulename::server::debian {
SCOPES