Operations Brownbag
         Puppet 101




Felix Rehfeldt
inovex GmbH
System Engineer



          Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
Agenda:
     ...was machen wir hier eigentlich

●
    Was ist Puppet

●
    Was ist Puppet nicht

●
    Setup Puppet

●
    File organisation

●
    Node definitions

●
    Der Client run




09.03.12                                 2
Was ist Puppet


Tool für Configuration Management
•    geschrieben in Ruby
•    eigene Sprache für Manifests (ralsh)
•    Kommunikation via XMLRPC over HTTP


Automatisierung von Tasks
•    Installation und Management von Paketen
•    Anlegen und Verwalten von Benutzer/Gruppen/Permissions
•    Verteilen und Management von Files und Services


Facter als Schnittstelle zum System
•    Auslesen von Systemvariablen (lsb, IP's, uvm.)
•    Kann Variablen über die gesammelten Systeminformationen setzen




09.03.12
Was ist Puppet nicht



•    Puppet ist kein System dass out of the box dass macht was wir
     wollen! Es ist ein umfangreiches Framework welches einen recht
     hohen initialen Konfigurationsaufwand mit sich bringt.

•    Puppet nimmt es einem nicht ab das zu managende System zu
     verstehen. Wer nicht weiß wie ein System zu bedienen ist, sollte
     Puppet zunächst außen vor lassen.




09.03.12
Setup Puppet

Die Puppet Installation

•    apt-get install puppetmaster! Leider nicht...

       •   Nach der Standardinstallation läuft der Puppetmaster mit einem Ruby webrick
           HTTP server


•    was wir wollen..

       •   Ruby EE
       •   Apache2
       •   Phusion Passenger (mod_rails | mod_rack)
       •   Puppetmaster




09.03.12
Setup Puppet

Die erste Konfiguration

sandwichmaker:puppet felix$ vi fileserver.conf
           ...
           [files]
           172.26.26.0/24
           …


sandwichmaker:puppet felix$ vi puppet.conf
           ...
           [master]
           ssl_client_header = SSL_CLIENT_S_DN
           ssl_client_verify_header = SSL_CLIENT_VERIFY
           certname=puppetmaster.foo.org
           modulepath=/etc/puppet/modules
           ...




09.03.12
File organisation


Die Puppet module Struktur

sandwichmaker:testmodul root# tree
.
├── files
...
├── manifests
...
├── plugins
│ └── puppet
│      └── parser
│          └── functions
...
└── templates
...




09.03.12
File organisation


Eine manifest Struktur

sandwichmaker:manifests root# tree -L 2
.
├── integration
│ ├── basenodes
│ ├── nodes-available
│ └── nodes-enabled
├── prelive
│ ├── basenodes
│ ├── nodes-available
│ └── nodes-enabled
├── production
│ ├── basenodes
│ ├── nodes-available
│ └── nodes-enabled
└── site.pp




09.03.12
Node definitions

plain text nodes
 node default {
     include common
 }


 node /ftpd+/ inherits default {
     include ftp-module
 }


 node ftp01.bar.com inherits default {
     $network_config = {
         eth0 => {
             ipadd => "172.26.26.11",
             networkmask => "255.255.255.0",
             gateway => "172.26.26.1"
         }
     }
     include ftp-module
     include network
 }
09.03.12
Node definitions


LDAP Nodes

     zusätzliche Konfiguration
      • puppet.conf

           [master]
           node_terminus = ldap
           ldapserver = foo.bar.com
           ldapbase = ou=hosts,dc=bar,dc=com


     Nodes hinzufügen und editieren

           # ldapvi --add -o top -o device -o puppetClient -b cn=base,ou=hosts,cn=bar,cn=com




09.03.12
Node definitions


External Nodes

     zusätzliche Konfiguration
      • puppet.conf

           [master]
           node_terminus = exec
           external_nodes = /path/to/script.rb


     Nodes hinzufügen und editieren

     ...




09.03.12
Der Client run
… fast geschafft

Client Modi:
•    Daemon Mode
•    Listen Mode
•    Singletime run


Was macht puppet wann:
•    Wann passiert was
•    before und require
•    Was können wir machen wenn before und require nicht reichen


Bugs & Co




09.03.12
Vielen Dank für Ihre Aufmerksamkeit!




inovex GmbH

Pforzheim                           München                                 Köln
Karlsruher Straße 71                Valentin-Linhof-Str. 2                  Kaiser-Wilhelm-Ring 27-29
D-75179 Pforzheim                   D-81829 München                         D-50672 Köln



           Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.

Grundlagen puppet

  • 1.
    Operations Brownbag Puppet 101 Felix Rehfeldt inovex GmbH System Engineer Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
  • 2.
    Agenda: ...was machen wir hier eigentlich ● Was ist Puppet ● Was ist Puppet nicht ● Setup Puppet ● File organisation ● Node definitions ● Der Client run 09.03.12 2
  • 3.
    Was ist Puppet Toolfür Configuration Management • geschrieben in Ruby • eigene Sprache für Manifests (ralsh) • Kommunikation via XMLRPC over HTTP Automatisierung von Tasks • Installation und Management von Paketen • Anlegen und Verwalten von Benutzer/Gruppen/Permissions • Verteilen und Management von Files und Services Facter als Schnittstelle zum System • Auslesen von Systemvariablen (lsb, IP's, uvm.) • Kann Variablen über die gesammelten Systeminformationen setzen 09.03.12
  • 4.
    Was ist Puppetnicht • Puppet ist kein System dass out of the box dass macht was wir wollen! Es ist ein umfangreiches Framework welches einen recht hohen initialen Konfigurationsaufwand mit sich bringt. • Puppet nimmt es einem nicht ab das zu managende System zu verstehen. Wer nicht weiß wie ein System zu bedienen ist, sollte Puppet zunächst außen vor lassen. 09.03.12
  • 5.
    Setup Puppet Die PuppetInstallation • apt-get install puppetmaster! Leider nicht... • Nach der Standardinstallation läuft der Puppetmaster mit einem Ruby webrick HTTP server • was wir wollen.. • Ruby EE • Apache2 • Phusion Passenger (mod_rails | mod_rack) • Puppetmaster 09.03.12
  • 6.
    Setup Puppet Die ersteKonfiguration sandwichmaker:puppet felix$ vi fileserver.conf ... [files] 172.26.26.0/24 … sandwichmaker:puppet felix$ vi puppet.conf ... [master] ssl_client_header = SSL_CLIENT_S_DN ssl_client_verify_header = SSL_CLIENT_VERIFY certname=puppetmaster.foo.org modulepath=/etc/puppet/modules ... 09.03.12
  • 7.
    File organisation Die Puppetmodule Struktur sandwichmaker:testmodul root# tree . ├── files ... ├── manifests ... ├── plugins │ └── puppet │ └── parser │ └── functions ... └── templates ... 09.03.12
  • 8.
    File organisation Eine manifestStruktur sandwichmaker:manifests root# tree -L 2 . ├── integration │ ├── basenodes │ ├── nodes-available │ └── nodes-enabled ├── prelive │ ├── basenodes │ ├── nodes-available │ └── nodes-enabled ├── production │ ├── basenodes │ ├── nodes-available │ └── nodes-enabled └── site.pp 09.03.12
  • 9.
    Node definitions plain textnodes node default { include common } node /ftpd+/ inherits default { include ftp-module } node ftp01.bar.com inherits default { $network_config = { eth0 => { ipadd => "172.26.26.11", networkmask => "255.255.255.0", gateway => "172.26.26.1" } } include ftp-module include network } 09.03.12
  • 10.
    Node definitions LDAP Nodes zusätzliche Konfiguration • puppet.conf [master] node_terminus = ldap ldapserver = foo.bar.com ldapbase = ou=hosts,dc=bar,dc=com Nodes hinzufügen und editieren # ldapvi --add -o top -o device -o puppetClient -b cn=base,ou=hosts,cn=bar,cn=com 09.03.12
  • 11.
    Node definitions External Nodes zusätzliche Konfiguration • puppet.conf [master] node_terminus = exec external_nodes = /path/to/script.rb Nodes hinzufügen und editieren ... 09.03.12
  • 12.
    Der Client run …fast geschafft Client Modi: • Daemon Mode • Listen Mode • Singletime run Was macht puppet wann: • Wann passiert was • before und require • Was können wir machen wenn before und require nicht reichen Bugs & Co 09.03.12
  • 13.
    Vielen Dank fürIhre Aufmerksamkeit! inovex GmbH Pforzheim München Köln Karlsruher Straße 71 Valentin-Linhof-Str. 2 Kaiser-Wilhelm-Ring 27-29 D-75179 Pforzheim D-81829 München D-50672 Köln Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.