Tools for IoT
Puppet
Chef
Overview
Why Puppet?
Introduction to Puppet
Puppet in a nutshell
Puppet's modules
CERN openlab Presentation 2011 2
Why Puppet?
The Challenge:
Manage a large number of systems
At least four “coffee” breaks per day
Watch YouTube
Go home early
CERN openlab Presentation 2011 3
Why Puppet?
Scenario:
Massive hardware failure of systems.
New servers are installed but need to be
configured.
CERN openlab Presentation 2011 4
Why Puppet?
The Manual Way:
Do everything by hand
5 servers OK
10 servers OK
100 servers NO
CERN openlab Presentation 2011 5
Why Puppet?
The Puppet Way:
Puppet package is pre-installed on the site
platform
Change hostnames
Puppet brings each system to the desired
end state
CERN openlab Presentation 2011 6
Puppet
Puppet is slower, but most widely used and support
for multiple OSes. Puppet is a configuration
management system that provides a way to define
the state of IT infrastructure, and enables automatic
enforcement of the correct state.
CERN openlab
Introduction to Puppet
What Is Puppet?
In author's own words:
“Puppet is a system for automating system
administration tasks.”
An open-source project written in Ruby and
released under Apache 2.0 (after v2.7.0)
A declarative language for describing
system configuration
Cross-platform – Linux, Unix, Windows
CERN openlab Presentation 2011 8
Introduction to Puppet
How Puppet Works?
A client/server based application
The server is called “puppetmaster”
The client is called “node” or “puppet”
SSL identity verification
Puppet enforce new configurations to the
system
Idempotency
Detect current state of the system
Change if only needed
Run on regular basis
CERN openlab Presentation 2011 9
Introduction to Puppet
CERN openlab Presentation 2011 10
Introduction to Puppet
Installation and configuration of
Puppet
If installed with default package manager
you will automatically get prerequisites
Puppet and Facter from source tar balls
(about Facter later)
During installation the “/etc/puppet”
directory will be created.
Puppet's configuration files on the server
puppet.conf (used by client's puppet)
auth.conf (used by puppetmaster)
fileserver.conf (used by puppetmaster)
autosign.conf (used
CERN openlab Presentation 2011 by puppetmaster) 11
Puppet in a nutshell
Puppet's language
Resources (file, service, user) – describe
configurations using attributes(ensure,
mode, source)
(Parameterized) Class – a named
collection of resources
Definition – abstract description of class
with the idea to be used multiple times
Recipe/Manifest – sample puppet
code(*.pp)
Variables, Arrays, Hashes, Selectors and
If/else, case statements
CERN openlab Presentation 2011 12
Puppet in a nutshell
Example:
package { "ntp":
ensure => installed,
}
service { "ntp":
ensure => running,
require => Package[“ntp”],
}
$file = “/etc/sample”
file { $file:
ensure => present,
source => “puppet:///example/$hostname”,
}
CERN openlab Presentation 2011 13
Puppet in a nutshell
Facter
Holds a stash of predefined variables
Custom facts could be added
Prefixed with “$” or “$::” (explicit)
architecture => amd64
domain => example.com
facterversion => 1.5.7
fqdn => client.example.com
hardwareisa => unknown
hardwaremodel => x86_64
hostname => client
CERN openlab Presentation 2011 14
Puppet in a nutshell
Templates
Flat files which contains Embedded
Ruby(ERB) variables
Version=<%= pkg_version %>
And called in a class
content => template(“version-temp.erb”)
Variable declaration on in the same class
or in node declaration
$pkg_version = “1.2.3”
CERN openlab Presentation 2011 15
Puppet's modules
Modules
Stored at “/etc/puppet/modules” by default
Collection of classes, definitions and
resources
Puppet search automatically for modules
Simplifies system administration
CERN openlab Presentation 2011 16
Puppet's modules
Module Structure
MODULE_PATH/
└──downcased_module_name/
├──files/
├──manifests/
│ ├──init.pp
├──templates/
└──README
CERN openlab Presentation 2011 17
Chef
Chef is complex, but fast and powerful, it is an
automation platform that transforms
infrastructure into code.
Many DevOps choose to adopt Chef because it
grant them to treat their system like object
because with ease of use comes a lack of
robustness.
Chef is similar to Puppet in terms of overall
concept, in that there’s a master server and
agents installed on managed nodes, but it differs
in actual deployment.
CERN openlab Presentation 2011 18
Extensive Ruby syntax for configuration “recipes”: this
brings a higher learning curve, but more power
Web user interface is standard and free.
Architecture is more complex: you need a Chef server,
Chef agents and a Chef workstation for configuration
and management.
Large library of existing recipes of mixed quality.
Simple cross-platform and self-contained installation
procedure.
Faster performance.