SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
Getting started with Puppet


                      Jeremy MATHEVET
                            12/09/2012
Topics



    Configuration management

    Puppet Installation

    Puppetmaster

    Puppet language basics

    Puppet language advanced
Configuration management

    Puppet, Chef, Cfengine
Configuration management

                           Definition



           Configuration Management is the
           process of standardizing resource
           configurations and enforcing their state
           across IT infrastructure in an automated
           yet agile manner.


                               —        Puppet Labs
Configuration management

                                 Why do we need it

         
             Heterogeneous Operating Systems
         
             Servers profusion
         
             Increasing deployment needs
              
                  Cloud
Configuration management

                                  Different solutions


          3 ways for deploying software to the SI

          Manually
                
                    Could take very long time
          By scripts
                
                    Could be quite tricky
                       
                           Multi-environment case
          By configuration management software
Configuration management

                      Configuration management software

          Pros :
                
                    Centralized management
                
                    Automated management
                
                    Mass deployment
                
                    Configuration customization
                
                    Abstraction layer
                
                    Idempotence
                
                    “DevOps ready”
Configuration management

                                      Principle


         
             A client/server
                architecture.
         
             The server has a reference
               configuration.
         
             The client queries the
               server.
         
             The client makes change in
               order to match the
               reference configuration.
Configuration management

                                  Principle




           1. Pull Request
           2. Reference configuration
           3. Operations
           4. (optionnal) Message code / error
Configuration management

                                    Principle

        Version control and security

         
             Revision control used to keep a trace of config
               revisions
                  
                      Not mandatory but hugely recommended
         
             Encrypted connection
Configuration management

                                   Principle

             What you can do

         
              File transfer
         
              File edition
         
              Service management
         
              Package management
         
              Mount points management
         
              Cron management
         
              VLAN management
         
              Command launching
         
              …
Configuration management

                                    Comparison


         3 major solutions :
         
             Puppet
                  
                      The most popular
                  
                      Easiest solution
         
             Chef
                  
                      Puppet fork
                  
                      Still young but very promising
         
             CFEngine
                  
                      The first CM software
                  
                      The most resource effective
                  
                      More complex
Configuration management

                           Comparison

          Timeline :
Configuration management

                                     Comparison

          Some differences




                 Technology         Ruby               Ruby                  C
                Configuration     Dedicated            Ruby             Dedicated
                                  langage                               langage
                Configuration                      Plain text files
                  method        Plain text files      CLI tool        Plain text files
                                                      Web UI
                   Licence         Apache             Apache               GPL
Configuration management

                                    Comparison

             Some similarities

         
              Same origin
         
              Specially designed for config
                management
         
              Client/server model
                  
                      Standalone mode possible
         
              CLI interface
         
              Need to increase your
                competence
Configuration management




           Do you have any questions ?
Puppet Installation

   Install && setup
Puppet Installation

                                             Puppet

              Some details and features

          
               Created in 2006 by Puppet Labs
          
               Latest version : 3.0.0
          
               The easiest solution
          
               Dedicated declarative language
                      
                          Inspired by Ruby
          
               Modular configuration
          
               System profiling with Facter
          
               Template support
          
               Asymmetric Key Encryption
Puppet Installation

                                           Puppet


              Prerequisite and sources

          
               Prerequisite
                      
                          Configured DNS
                      
                          Ruby

          
               Installation sources :
                      
                          Distribution repositories
                      
                          RubyGem
                      
                          Sources
Puppet Installation

                                          Puppet

            Client and server

           Puppet server : Puppetmaster
           Puppet client : Puppet (agent)


           Main steps once installed :
                  
                      Puppet agent installation on client hosts (also called a node).
                         
                             Enter the server FQDN into /etc/puppet/puppet.conf
                         
                             The agent checks every 30 mn by default
                  
                      Certificate generation
                         
                             CSR for the node generated on the puppetmaster during
                               the first agent request
Puppet Installation

                            Working with Puppetmaster

           Working with Puppet CA
            [root@puppetmaster ~]# puppetca --sign fqdn.utopia.net


                  Options                                      Definitions

            --sign            Sign the certificate request for the following host


            --list            List certificate request


            --all             Used with --sign, sign all certificate request


            --clean           Remove all files related to the host from the CA


            --print           Print the full text version of a host’s certificate


            --revoke          Remove all files related to the host from the CA
Puppet Installation




            Do you have any questions ?
Puppet




         Puppetmaster

         Puppetmaster said…
Puppetmaster

               One important thing




               Infrastructure is code.
Puppetmaster

                              Definition




               Manifest – Puppet programs are called
               « manifests » . They use the .pp file
               extension. These programs contain one or
               more class.
Puppetmaster

                             Puppet configuration tree

             Configuration files overview 1/2

         
               puppet.conf
                   
                       General Puppetmaster settings
         
               auth.conf
                   
                       General ACL
         
               fileserver.conf
                   
                       ACL for the Puppet fileserver
         
               manifests directory
                   
                       site.pp : global defaults
                          configuration
                   
                       nodes.pp : manage hosts
Puppetmaster

                               Puppet configuration tree

             Configuration files overview 2/2

         
               modules directory
                   
                       Contain one subdirectory per
                         module
                   
                       manifests/init.pp
                           
                                The module code
                   
                       The best way to use Puppet
         
               templates directory
                   
                       The default directory which contains
                         templates.
Puppetmaster

                          Puppet configuration files

           puppet.conf


                         [main]
                         logdir=/var/log/puppet
                         vardir=/var/lib/puppet
                         ssldir=/var/lib/puppet/ssl
                         rundir=/var/run/puppet
                         factpath=$vardir/lib/facter
                         templatedir=$confdir/templates
                         server=debiantest.decilex.net
                         downcasefacts = true
Puppetmaster

                            Puppet configuration files

             manifests/nodes.pp


         
               Skeleton :
                                           node basenode {
               
                   node ‘fqdn’ { include   include ssh
                     module}               include ntp
                                           }

         
               Node declaration
                                           node 'test.utopia.net' inherits basenode {
         
               Module inclusion            include nagios
               
                   Inheritance             }
Puppetmaster

                       Puppet configuration files

           Reading order


                                manifests/site.pp




                               manifests/nodes.pp




                     modules/$nomdumodule/manifests/init.pp




                           modules/$nomdumodule/files/
Puppetmaster




           Do you have any questions ?
Puppet




         Puppet language basics

            Puppet, Chef, Cfengine
Puppet language basics

                               The declarative language


              About the language

          
               With Puppet, we declare how the node
                 must be.
          
               Everything you want to manage have to
                 be explicitly declared.
          
               A Puppet program is called a manifest
                    
                         Central manifest : site.pp
                    
                         Puppet load modules manifests
          
               Into manifests, we define classes.
                
                    We write resources inside these
                      classes
Puppet language basics

                               The declarative language

              Resources

          
               The fundamental unit of modeling
          
               Like a “function”
                    
                         Inside, a series of attributes and their values
          
               Resources types and attributes are predefined by Puppet
          
               List of available resources
                    
                         http://docs.puppetlabs.com/references/stable/type.html
          
               Skeleton
                
                    Ressource-name { ‘title’ : attribute = value }
Puppet language basics

                                       Resources


              File

          
               Manage files
                                            file { '/etc/passwd':
                     
                         Content                 owner => 'root',
                                                 group => 'root',
                     
                         Permissions             mode => '0644',
                     
                         Ownership               source => ‘puppet:///base/passwd‘
                     
                                               }

          
               Source attribute
                     
                         Copy a file from the Puppetmaster to the node
                     
                         puppet:/// followed by the relative source of the file
                           placed in /etc/puppet/modules/module-name/files/
Puppet language basics

                                        Resources

              Package                                package { ‘openssh-server’:
                                                        ensure => installed
                                                     }
          
               Manage packages
                   
                         Wide provider support       package { ‘openssh-server’:
                                                        ensure => latest
                             
                                 APT                 }
                             
                                 Aptitude            package { ‘openssh-server’:
                             
                                 YUM                    ensure => absent
                                                     }
                             
                                 And more..
                   
                         Install, upgrade, uninstall packages
                   
                         The last or defined package version
Puppet language basics

                                           Resources

              Service

          
               Manage services
                   
                         Wide provider support      service { ‘snmpd’:
                             
                                 Init                   ensure => running,
                                                        enable => true,
                             
                                 Systemd                hasrestart => true,
                             
                                 Upstart                hasstatus => true
                                                    }
                             
                                 And more…
                   
                         Start, stop, restart, start on boot (enable) services
Puppet language basics




           Do you have any questions ?
Puppet




         Puppet language advanced

               Dive into Puppet
Puppet language advanced

                                         Facter

             The system profiler

         
              Software used by Puppet             ~ # facter
                                                  architecture => i386
         
              Installed on nodes                  domain => utopia.net
                                                  facterversion => 1.5.7
         
              Collect various data, "facts",
                                                  fqdn => debiantest.utopia.net
                on node                           hardwaremodel => i686
         
              Many facts already defined by       hostname => debiantest
                Facter                            id => root
                                                  […]
               
                   Possibility to create your
                     own facts
Puppet language advanced

                                      Variables

             Variables into classes
         
              Begin by $
                                         case $operatingsystem {
         
              Can use facts or you           centos, redhat: { $service_name = 'ntpd' }
                own defined                  debian, ubuntu: { $service_name = 'ntp' }
                variables                  }
         
              Often used with            service { 'ntp':
                 conditional                name => $service_name,
                 statements                 ensure => running,
                                            enable => true
                   
                       Case statement    }
                   
                       If statement
Puppet language advanced

                              Conditional statements

             If/Elsif/Else Statement      if $variable {
                                               file { '/some/file': ensure => present }
                                             } else {
         
              Based on                         file { '/some/other/file': ensure => present }
                                             }
                   
                       the truth value
                          of a variable
                   
                       the value of an
                          expression      if $server == 'mongrel' {
                                               include mongrel
                   
                       The truth of an       } elsif $server == 'nginx' {
                         arithmetic            include nginx
                         expression          } else {
                                               include thin
                                             }


                                          if $ram > 1024 {
                                               $maxclient = 500
                                             }
Puppet language advanced

                                        Expressions

             Operators
         
              Operators usable in if statements
                   
                       Boolean expressions
                            
                                And, or, not
                   
                       Comparison expressions
                            
                                == =! < > <= > >=
                   
                       Arithmetic expressions
                            
                                + - / * >> (left shift) << (right shift)
                   
                       Regular expressions
                            
                                =~ !~
                   
                       “in” expressions
                       
                           allows to find if the left operand is in the right one.
Puppet language advanced

                                      Templates

             Personalized text files

                                             file {"hosts":
         
              Permit to have                    path => "/etc/hosts",
                personalized                    owner => root,
                configuration per node          group => root,
                                                mode => 644,
                   
                       Use ERB language         content => template("base/hosts.erb")
                   
                       Retrieve and use      }
                         facts
                                             <%= ipadress %> <%fqdn> <%hostname>
                   
                       Use file resource
                           
                               ERB file
                                 placed in
                                 module
                                 template
                                 directory
Puppet language advanced

                                Resources relationship

             Relationship meta-parameters
         
              before
                   
                        Resource is applied before the target resource
         
              require
                   
                        Resource is applied after the target resource
         
              notify
                   
                        Like before + The target resource will refresh if the
                           notifying resource changes
         
              subscribe
                   
                        Like require + The subscribing resource will refresh if the
                           target resource changes.
Puppet language advanced

                                Resources relationship

           Ordering relationship

           package { 'openssh-server':
               ensure => present,
               before => File['/etc/ssh/sshd_config'],
             }


           file { '/etc/ssh/sshd_config':
                ensure => file,
                mode => 600,
                source => 'puppet:///modules/sshd/sshd_config',
                require => Package['openssh-server'],
              }




          These two examples are mutually-exclusive
Puppet language advanced

                               Resources relationship

           Notification relationship

           file { '/etc/ssh/sshd_config':
                ensure => file,
                mode => 600,
                source => 'puppet:///modules/sshd/sshd_config',
                notify => Service['sshd']
              }


           service { 'sshd':
               ensure => running,
               enable => true,
               subscribe => File['/etc/ssh/sshd_config‘]
             }


            These two examples are mutually-exclusive
Puppet language advanced

                                   Resources relationship

             Chaining and refreshing

         
               Ordering resources
                     
                         The resource on the left is applied
                           before the resource on the right.
                     
                         ->
         
               Refreshing
                     
                         Kind of trigger
                     
                         Restart a service after a file update
                     
                         ~>

             # ntp.conf is applied first, and will notify the ntpd service if it changes:
             File['/etc/ntp.conf'] ~> Service['ntpd']
Puppet language advanced




           Do you have any questions ?
Puppet


                                Summary


         Configuration
         Configuration                             Puppetmaster
                                                   Puppetmaster
         management
          management       Puppet installation
                           Puppet installation




                                            Puppet Language
                                            Puppet Language
              Puppet language
              Puppet language                  advanced
                                               advanced
                  basics
                  basics
Contact

            Jeremy MATHEVET
                 @Jeyg




Content under Creative Commons BY 3.0 License

Weitere ähnliche Inhalte

Was ist angesagt?

Gcm#4 アメリカの長編アニメーションの 色とライティング
Gcm#4  アメリカの長編アニメーションの 色とライティングGcm#4  アメリカの長編アニメーションの 色とライティング
Gcm#4 アメリカの長編アニメーションの 色とライティングGREE/Art
 
2015年度GPGPU実践基礎工学 第9回 GPUのアーキテクチャ
2015年度GPGPU実践基礎工学 第9回 GPUのアーキテクチャ2015年度GPGPU実践基礎工学 第9回 GPUのアーキテクチャ
2015年度GPGPU実践基礎工学 第9回 GPUのアーキテクチャ智啓 出川
 
Unity 2018-2019を見据えたDeNAのUnity開発のこれから [DeNA TechCon 2019]
Unity 2018-2019を見据えたDeNAのUnity開発のこれから [DeNA TechCon 2019]Unity 2018-2019を見据えたDeNAのUnity開発のこれから [DeNA TechCon 2019]
Unity 2018-2019を見据えたDeNAのUnity開発のこれから [DeNA TechCon 2019]DeNA
 
サーバー未経験者がソーシャルゲームを通して知ったサーバーの事
サーバー未経験者がソーシャルゲームを通して知ったサーバーの事サーバー未経験者がソーシャルゲームを通して知ったサーバーの事
サーバー未経験者がソーシャルゲームを通して知ったサーバーの事Manabu Koga
 
WebRTC UserMedia Catalog: いろんなユーザメディア(MediaStream)を使ってみよう
WebRTC UserMedia Catalog: いろんなユーザメディア(MediaStream)を使ってみようWebRTC UserMedia Catalog: いろんなユーザメディア(MediaStream)を使ってみよう
WebRTC UserMedia Catalog: いろんなユーザメディア(MediaStream)を使ってみようmganeko
 
サーバーのおしごと
サーバーのおしごとサーバーのおしごと
サーバーのおしごとYugo Shimizu
 
ビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそう
ビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそうビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそう
ビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそうUnity Technologies Japan K.K.
 
Addressables で大量のリソース管理・困りどころと解消法
Addressables で大量のリソース管理・困りどころと解消法Addressables で大量のリソース管理・困りどころと解消法
Addressables で大量のリソース管理・困りどころと解消法Kenta Nagai
 
ゲーム開発とMVC
ゲーム開発とMVCゲーム開発とMVC
ゲーム開発とMVCTakashi Komada
 
UNREAL ENGINE 基本操作編
UNREAL ENGINE  基本操作編UNREAL ENGINE  基本操作編
UNREAL ENGINE 基本操作編Yuuki Ogino
 
ゲーム開発者のための C++11/C++14
ゲーム開発者のための C++11/C++14ゲーム開発者のための C++11/C++14
ゲーム開発者のための C++11/C++14Ryo Suzuki
 
Java開発の強力な相棒として今すぐ使えるGroovy
Java開発の強力な相棒として今すぐ使えるGroovyJava開発の強力な相棒として今すぐ使えるGroovy
Java開発の強力な相棒として今すぐ使えるGroovyYasuharu Nakano
 
Manajemen server web dengan WHM/cpanel, Virtualmin
Manajemen server web dengan WHM/cpanel, VirtualminManajemen server web dengan WHM/cpanel, Virtualmin
Manajemen server web dengan WHM/cpanel, VirtualminImam Suharjo
 
【Unity道場】物理シミュレーション完全マスター
【Unity道場】物理シミュレーション完全マスター【Unity道場】物理シミュレーション完全マスター
【Unity道場】物理シミュレーション完全マスターUnity Technologies Japan K.K.
 
Design patterns avec Symfony
Design patterns avec SymfonyDesign patterns avec Symfony
Design patterns avec SymfonyMohammed Rhamnia
 
【Unity道場 博多スペシャル 2017】Textmesh proを使いこなす
【Unity道場 博多スペシャル 2017】Textmesh proを使いこなす【Unity道場 博多スペシャル 2017】Textmesh proを使いこなす
【Unity道場 博多スペシャル 2017】Textmesh proを使いこなすUnity Technologies Japan K.K.
 
Android 5.0 Camera2 APIs
Android 5.0 Camera2 APIsAndroid 5.0 Camera2 APIs
Android 5.0 Camera2 APIsBalwinder Kaur
 
VRM-VCIが広げるVR世界間ポータビリティ
VRM-VCIが広げるVR世界間ポータビリティVRM-VCIが広げるVR世界間ポータビリティ
VRM-VCIが広げるVR世界間ポータビリティVirtualCast, Inc.
 
Terrain Rendering using GPU-Based Geometry Clipmaps
Terrain Rendering usingGPU-Based Geometry ClipmapsTerrain Rendering usingGPU-Based Geometry Clipmaps
Terrain Rendering using GPU-Based Geometry Clipmapsnone299359
 

Was ist angesagt? (20)

Gcm#4 アメリカの長編アニメーションの 色とライティング
Gcm#4  アメリカの長編アニメーションの 色とライティングGcm#4  アメリカの長編アニメーションの 色とライティング
Gcm#4 アメリカの長編アニメーションの 色とライティング
 
2015年度GPGPU実践基礎工学 第9回 GPUのアーキテクチャ
2015年度GPGPU実践基礎工学 第9回 GPUのアーキテクチャ2015年度GPGPU実践基礎工学 第9回 GPUのアーキテクチャ
2015年度GPGPU実践基礎工学 第9回 GPUのアーキテクチャ
 
Unity 2018-2019を見据えたDeNAのUnity開発のこれから [DeNA TechCon 2019]
Unity 2018-2019を見据えたDeNAのUnity開発のこれから [DeNA TechCon 2019]Unity 2018-2019を見据えたDeNAのUnity開発のこれから [DeNA TechCon 2019]
Unity 2018-2019を見据えたDeNAのUnity開発のこれから [DeNA TechCon 2019]
 
サーバー未経験者がソーシャルゲームを通して知ったサーバーの事
サーバー未経験者がソーシャルゲームを通して知ったサーバーの事サーバー未経験者がソーシャルゲームを通して知ったサーバーの事
サーバー未経験者がソーシャルゲームを通して知ったサーバーの事
 
WebRTC UserMedia Catalog: いろんなユーザメディア(MediaStream)を使ってみよう
WebRTC UserMedia Catalog: いろんなユーザメディア(MediaStream)を使ってみようWebRTC UserMedia Catalog: いろんなユーザメディア(MediaStream)を使ってみよう
WebRTC UserMedia Catalog: いろんなユーザメディア(MediaStream)を使ってみよう
 
サーバーのおしごと
サーバーのおしごとサーバーのおしごと
サーバーのおしごと
 
ビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそう
ビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそうビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそう
ビジュアルスクリプティングで始めるUnity入門1日目 プレイヤーを動かそう
 
UE4 MultiPlayer Online Deep Dive: 実践編1 (Byking様ご講演) #UE4DD
UE4 MultiPlayer Online Deep Dive: 実践編1 (Byking様ご講演)  #UE4DDUE4 MultiPlayer Online Deep Dive: 実践編1 (Byking様ご講演)  #UE4DD
UE4 MultiPlayer Online Deep Dive: 実践編1 (Byking様ご講演) #UE4DD
 
Addressables で大量のリソース管理・困りどころと解消法
Addressables で大量のリソース管理・困りどころと解消法Addressables で大量のリソース管理・困りどころと解消法
Addressables で大量のリソース管理・困りどころと解消法
 
ゲーム開発とMVC
ゲーム開発とMVCゲーム開発とMVC
ゲーム開発とMVC
 
UNREAL ENGINE 基本操作編
UNREAL ENGINE  基本操作編UNREAL ENGINE  基本操作編
UNREAL ENGINE 基本操作編
 
ゲーム開発者のための C++11/C++14
ゲーム開発者のための C++11/C++14ゲーム開発者のための C++11/C++14
ゲーム開発者のための C++11/C++14
 
Java開発の強力な相棒として今すぐ使えるGroovy
Java開発の強力な相棒として今すぐ使えるGroovyJava開発の強力な相棒として今すぐ使えるGroovy
Java開発の強力な相棒として今すぐ使えるGroovy
 
Manajemen server web dengan WHM/cpanel, Virtualmin
Manajemen server web dengan WHM/cpanel, VirtualminManajemen server web dengan WHM/cpanel, Virtualmin
Manajemen server web dengan WHM/cpanel, Virtualmin
 
【Unity道場】物理シミュレーション完全マスター
【Unity道場】物理シミュレーション完全マスター【Unity道場】物理シミュレーション完全マスター
【Unity道場】物理シミュレーション完全マスター
 
Design patterns avec Symfony
Design patterns avec SymfonyDesign patterns avec Symfony
Design patterns avec Symfony
 
【Unity道場 博多スペシャル 2017】Textmesh proを使いこなす
【Unity道場 博多スペシャル 2017】Textmesh proを使いこなす【Unity道場 博多スペシャル 2017】Textmesh proを使いこなす
【Unity道場 博多スペシャル 2017】Textmesh proを使いこなす
 
Android 5.0 Camera2 APIs
Android 5.0 Camera2 APIsAndroid 5.0 Camera2 APIs
Android 5.0 Camera2 APIs
 
VRM-VCIが広げるVR世界間ポータビリティ
VRM-VCIが広げるVR世界間ポータビリティVRM-VCIが広げるVR世界間ポータビリティ
VRM-VCIが広げるVR世界間ポータビリティ
 
Terrain Rendering using GPU-Based Geometry Clipmaps
Terrain Rendering usingGPU-Based Geometry ClipmapsTerrain Rendering usingGPU-Based Geometry Clipmaps
Terrain Rendering using GPU-Based Geometry Clipmaps
 

Ähnlich wie Getting started with Puppet

Rudder - Configuration management benefits for everyone (FOSDEM 2012)
Rudder - Configuration management benefits for everyone (FOSDEM 2012)Rudder - Configuration management benefits for everyone (FOSDEM 2012)
Rudder - Configuration management benefits for everyone (FOSDEM 2012)RUDDER
 
Configuration management benefits for everyone - Rudder @ FLOSSUK Spring Conf...
Configuration management benefits for everyone - Rudder @ FLOSSUK Spring Conf...Configuration management benefits for everyone - Rudder @ FLOSSUK Spring Conf...
Configuration management benefits for everyone - Rudder @ FLOSSUK Spring Conf...RUDDER
 
Configuration management: automating and rationalizing server setup with CFEn...
Configuration management: automating and rationalizing server setup with CFEn...Configuration management: automating and rationalizing server setup with CFEn...
Configuration management: automating and rationalizing server setup with CFEn...Jonathan Clarke
 
Configuration management: automating and rationalizing server setup with CFEn...
Configuration management: automating and rationalizing server setup with CFEn...Configuration management: automating and rationalizing server setup with CFEn...
Configuration management: automating and rationalizing server setup with CFEn...RUDDER
 
IBM PureFlex System Live Demo Outline: A scenario
IBM PureFlex System Live Demo Outline: A scenarioIBM PureFlex System Live Demo Outline: A scenario
IBM PureFlex System Live Demo Outline: A scenarioIBM India Smarter Computing
 
XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...
XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...
XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...XebiaLabs
 
Nagios Conference 2012 - Andreas Ericsson - Merlin
Nagios Conference 2012 - Andreas Ericsson - MerlinNagios Conference 2012 - Andreas Ericsson - Merlin
Nagios Conference 2012 - Andreas Ericsson - MerlinNagios
 
Ss Wrap Up Session 13 Aug
Ss Wrap Up Session 13 AugSs Wrap Up Session 13 Aug
Ss Wrap Up Session 13 AugWSO2
 
SOA Summer School: Best of SOA Summer School – Encore Session
SOA Summer School: Best of SOA Summer School – Encore Session SOA Summer School: Best of SOA Summer School – Encore Session
SOA Summer School: Best of SOA Summer School – Encore Session WSO2
 
Continuous Delivery in the AWS Cloud
Continuous Delivery in the AWS CloudContinuous Delivery in the AWS Cloud
Continuous Delivery in the AWS CloudNigel Fernandes
 
Continuous Delivery in the Cloud
Continuous Delivery in the CloudContinuous Delivery in the Cloud
Continuous Delivery in the CloudFabio Lessa
 
Open Source Licenses and Tools
Open Source Licenses and ToolsOpen Source Licenses and Tools
Open Source Licenses and Toolsg2ix
 
LAST Conference - Dev-Ops and Continuous Delivery
LAST Conference - Dev-Ops and Continuous DeliveryLAST Conference - Dev-Ops and Continuous Delivery
LAST Conference - Dev-Ops and Continuous DeliveryNigel Fernandes
 
Configuration management 101 - A tale of disaster recovery using CFEngine 3
Configuration management 101 - A tale of disaster recovery using CFEngine 3Configuration management 101 - A tale of disaster recovery using CFEngine 3
Configuration management 101 - A tale of disaster recovery using CFEngine 3RUDDER
 
OOW 09 EBS Application Change Management Pack
OOW 09 EBS Application Change Management PackOOW 09 EBS Application Change Management Pack
OOW 09 EBS Application Change Management Packjucaab
 
System Center 2012 - January Licensing Update
System Center 2012 - January Licensing UpdateSystem Center 2012 - January Licensing Update
System Center 2012 - January Licensing UpdateSoftchoice Corporation
 
Plugin Overview I and II
Plugin Overview I and IIPlugin Overview I and II
Plugin Overview I and IIdotCMS
 
Chef for DevOps - an Introduction
Chef for DevOps - an IntroductionChef for DevOps - an Introduction
Chef for DevOps - an IntroductionSanjeev Sharma
 
Newvem Community - Cloud Management
Newvem Community - Cloud ManagementNewvem Community - Cloud Management
Newvem Community - Cloud ManagementAndreas Chatzakis
 

Ähnlich wie Getting started with Puppet (20)

Rudder - Configuration management benefits for everyone (FOSDEM 2012)
Rudder - Configuration management benefits for everyone (FOSDEM 2012)Rudder - Configuration management benefits for everyone (FOSDEM 2012)
Rudder - Configuration management benefits for everyone (FOSDEM 2012)
 
Configuration management benefits for everyone - Rudder @ FLOSSUK Spring Conf...
Configuration management benefits for everyone - Rudder @ FLOSSUK Spring Conf...Configuration management benefits for everyone - Rudder @ FLOSSUK Spring Conf...
Configuration management benefits for everyone - Rudder @ FLOSSUK Spring Conf...
 
Configuration management: automating and rationalizing server setup with CFEn...
Configuration management: automating and rationalizing server setup with CFEn...Configuration management: automating and rationalizing server setup with CFEn...
Configuration management: automating and rationalizing server setup with CFEn...
 
Configuration management: automating and rationalizing server setup with CFEn...
Configuration management: automating and rationalizing server setup with CFEn...Configuration management: automating and rationalizing server setup with CFEn...
Configuration management: automating and rationalizing server setup with CFEn...
 
IBM PureFlex System Live Demo Outline: A scenario
IBM PureFlex System Live Demo Outline: A scenarioIBM PureFlex System Live Demo Outline: A scenario
IBM PureFlex System Live Demo Outline: A scenario
 
XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...
XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...
XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...
 
Nagios Conference 2012 - Andreas Ericsson - Merlin
Nagios Conference 2012 - Andreas Ericsson - MerlinNagios Conference 2012 - Andreas Ericsson - Merlin
Nagios Conference 2012 - Andreas Ericsson - Merlin
 
Ss Wrap Up Session 13 Aug
Ss Wrap Up Session 13 AugSs Wrap Up Session 13 Aug
Ss Wrap Up Session 13 Aug
 
SOA Summer School: Best of SOA Summer School – Encore Session
SOA Summer School: Best of SOA Summer School – Encore Session SOA Summer School: Best of SOA Summer School – Encore Session
SOA Summer School: Best of SOA Summer School – Encore Session
 
Continuous Delivery in the AWS Cloud
Continuous Delivery in the AWS CloudContinuous Delivery in the AWS Cloud
Continuous Delivery in the AWS Cloud
 
Continuous Delivery in the Cloud
Continuous Delivery in the CloudContinuous Delivery in the Cloud
Continuous Delivery in the Cloud
 
Open Source Licenses and Tools
Open Source Licenses and ToolsOpen Source Licenses and Tools
Open Source Licenses and Tools
 
LAST Conference - Dev-Ops and Continuous Delivery
LAST Conference - Dev-Ops and Continuous DeliveryLAST Conference - Dev-Ops and Continuous Delivery
LAST Conference - Dev-Ops and Continuous Delivery
 
Configuration management 101 - A tale of disaster recovery using CFEngine 3
Configuration management 101 - A tale of disaster recovery using CFEngine 3Configuration management 101 - A tale of disaster recovery using CFEngine 3
Configuration management 101 - A tale of disaster recovery using CFEngine 3
 
OOW 09 EBS Application Change Management Pack
OOW 09 EBS Application Change Management PackOOW 09 EBS Application Change Management Pack
OOW 09 EBS Application Change Management Pack
 
System Center 2012 - January Licensing Update
System Center 2012 - January Licensing UpdateSystem Center 2012 - January Licensing Update
System Center 2012 - January Licensing Update
 
Plugin Overview I and II
Plugin Overview I and IIPlugin Overview I and II
Plugin Overview I and II
 
Decoding SDN
Decoding SDNDecoding SDN
Decoding SDN
 
Chef for DevOps - an Introduction
Chef for DevOps - an IntroductionChef for DevOps - an Introduction
Chef for DevOps - an Introduction
 
Newvem Community - Cloud Management
Newvem Community - Cloud ManagementNewvem Community - Cloud Management
Newvem Community - Cloud Management
 

Kürzlich hochgeladen

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

Getting started with Puppet

  • 1. Getting started with Puppet Jeremy MATHEVET 12/09/2012
  • 2. Topics  Configuration management  Puppet Installation  Puppetmaster  Puppet language basics  Puppet language advanced
  • 3. Configuration management Puppet, Chef, Cfengine
  • 4. Configuration management Definition Configuration Management is the process of standardizing resource configurations and enforcing their state across IT infrastructure in an automated yet agile manner. — Puppet Labs
  • 5. Configuration management Why do we need it  Heterogeneous Operating Systems  Servers profusion  Increasing deployment needs  Cloud
  • 6. Configuration management Different solutions 3 ways for deploying software to the SI Manually  Could take very long time By scripts  Could be quite tricky  Multi-environment case By configuration management software
  • 7. Configuration management Configuration management software Pros :  Centralized management  Automated management  Mass deployment  Configuration customization  Abstraction layer  Idempotence  “DevOps ready”
  • 8. Configuration management Principle  A client/server architecture.  The server has a reference configuration.  The client queries the server.  The client makes change in order to match the reference configuration.
  • 9. Configuration management Principle 1. Pull Request 2. Reference configuration 3. Operations 4. (optionnal) Message code / error
  • 10. Configuration management Principle Version control and security  Revision control used to keep a trace of config revisions  Not mandatory but hugely recommended  Encrypted connection
  • 11. Configuration management Principle What you can do  File transfer  File edition  Service management  Package management  Mount points management  Cron management  VLAN management  Command launching  …
  • 12. Configuration management Comparison 3 major solutions :  Puppet  The most popular  Easiest solution  Chef  Puppet fork  Still young but very promising  CFEngine  The first CM software  The most resource effective  More complex
  • 13. Configuration management Comparison Timeline :
  • 14. Configuration management Comparison Some differences Technology Ruby Ruby C Configuration Dedicated Ruby Dedicated langage langage Configuration Plain text files method Plain text files CLI tool Plain text files Web UI Licence Apache Apache GPL
  • 15. Configuration management Comparison Some similarities  Same origin  Specially designed for config management  Client/server model  Standalone mode possible  CLI interface  Need to increase your competence
  • 16. Configuration management Do you have any questions ?
  • 17. Puppet Installation Install && setup
  • 18. Puppet Installation Puppet Some details and features  Created in 2006 by Puppet Labs  Latest version : 3.0.0  The easiest solution  Dedicated declarative language  Inspired by Ruby  Modular configuration  System profiling with Facter  Template support  Asymmetric Key Encryption
  • 19. Puppet Installation Puppet Prerequisite and sources  Prerequisite  Configured DNS  Ruby  Installation sources :  Distribution repositories  RubyGem  Sources
  • 20. Puppet Installation Puppet Client and server Puppet server : Puppetmaster Puppet client : Puppet (agent) Main steps once installed :  Puppet agent installation on client hosts (also called a node).  Enter the server FQDN into /etc/puppet/puppet.conf  The agent checks every 30 mn by default  Certificate generation  CSR for the node generated on the puppetmaster during the first agent request
  • 21. Puppet Installation Working with Puppetmaster Working with Puppet CA [root@puppetmaster ~]# puppetca --sign fqdn.utopia.net Options Definitions --sign Sign the certificate request for the following host --list List certificate request --all Used with --sign, sign all certificate request --clean Remove all files related to the host from the CA --print Print the full text version of a host’s certificate --revoke Remove all files related to the host from the CA
  • 22. Puppet Installation Do you have any questions ?
  • 23. Puppet Puppetmaster Puppetmaster said…
  • 24. Puppetmaster One important thing Infrastructure is code.
  • 25. Puppetmaster Definition Manifest – Puppet programs are called « manifests » . They use the .pp file extension. These programs contain one or more class.
  • 26. Puppetmaster Puppet configuration tree Configuration files overview 1/2  puppet.conf  General Puppetmaster settings  auth.conf  General ACL  fileserver.conf  ACL for the Puppet fileserver  manifests directory  site.pp : global defaults configuration  nodes.pp : manage hosts
  • 27. Puppetmaster Puppet configuration tree Configuration files overview 2/2  modules directory  Contain one subdirectory per module  manifests/init.pp  The module code  The best way to use Puppet  templates directory  The default directory which contains templates.
  • 28. Puppetmaster Puppet configuration files puppet.conf [main] logdir=/var/log/puppet vardir=/var/lib/puppet ssldir=/var/lib/puppet/ssl rundir=/var/run/puppet factpath=$vardir/lib/facter templatedir=$confdir/templates server=debiantest.decilex.net downcasefacts = true
  • 29. Puppetmaster Puppet configuration files manifests/nodes.pp  Skeleton : node basenode {  node ‘fqdn’ { include include ssh module} include ntp }  Node declaration node 'test.utopia.net' inherits basenode {  Module inclusion include nagios  Inheritance }
  • 30. Puppetmaster Puppet configuration files Reading order manifests/site.pp manifests/nodes.pp modules/$nomdumodule/manifests/init.pp modules/$nomdumodule/files/
  • 31. Puppetmaster Do you have any questions ?
  • 32. Puppet Puppet language basics Puppet, Chef, Cfengine
  • 33. Puppet language basics The declarative language About the language  With Puppet, we declare how the node must be.  Everything you want to manage have to be explicitly declared.  A Puppet program is called a manifest  Central manifest : site.pp  Puppet load modules manifests  Into manifests, we define classes.  We write resources inside these classes
  • 34. Puppet language basics The declarative language Resources  The fundamental unit of modeling  Like a “function”  Inside, a series of attributes and their values  Resources types and attributes are predefined by Puppet  List of available resources  http://docs.puppetlabs.com/references/stable/type.html  Skeleton  Ressource-name { ‘title’ : attribute = value }
  • 35. Puppet language basics Resources File  Manage files file { '/etc/passwd':  Content owner => 'root', group => 'root',  Permissions mode => '0644',  Ownership source => ‘puppet:///base/passwd‘  }  Source attribute  Copy a file from the Puppetmaster to the node  puppet:/// followed by the relative source of the file placed in /etc/puppet/modules/module-name/files/
  • 36. Puppet language basics Resources Package package { ‘openssh-server’: ensure => installed }  Manage packages  Wide provider support package { ‘openssh-server’: ensure => latest  APT }  Aptitude package { ‘openssh-server’:  YUM ensure => absent }  And more..  Install, upgrade, uninstall packages  The last or defined package version
  • 37. Puppet language basics Resources Service  Manage services  Wide provider support service { ‘snmpd’:  Init ensure => running, enable => true,  Systemd hasrestart => true,  Upstart hasstatus => true }  And more…  Start, stop, restart, start on boot (enable) services
  • 38. Puppet language basics Do you have any questions ?
  • 39. Puppet Puppet language advanced Dive into Puppet
  • 40. Puppet language advanced Facter The system profiler  Software used by Puppet ~ # facter architecture => i386  Installed on nodes domain => utopia.net facterversion => 1.5.7  Collect various data, "facts", fqdn => debiantest.utopia.net on node hardwaremodel => i686  Many facts already defined by hostname => debiantest Facter id => root […]  Possibility to create your own facts
  • 41. Puppet language advanced Variables Variables into classes  Begin by $ case $operatingsystem {  Can use facts or you centos, redhat: { $service_name = 'ntpd' } own defined debian, ubuntu: { $service_name = 'ntp' } variables }  Often used with service { 'ntp': conditional name => $service_name, statements ensure => running, enable => true  Case statement }  If statement
  • 42. Puppet language advanced Conditional statements If/Elsif/Else Statement if $variable { file { '/some/file': ensure => present } } else {  Based on file { '/some/other/file': ensure => present } }  the truth value of a variable  the value of an expression if $server == 'mongrel' { include mongrel  The truth of an } elsif $server == 'nginx' { arithmetic include nginx expression } else { include thin } if $ram > 1024 { $maxclient = 500 }
  • 43. Puppet language advanced Expressions Operators  Operators usable in if statements  Boolean expressions  And, or, not  Comparison expressions  == =! < > <= > >=  Arithmetic expressions  + - / * >> (left shift) << (right shift)  Regular expressions  =~ !~  “in” expressions  allows to find if the left operand is in the right one.
  • 44. Puppet language advanced Templates Personalized text files file {"hosts":  Permit to have path => "/etc/hosts", personalized owner => root, configuration per node group => root, mode => 644,  Use ERB language content => template("base/hosts.erb")  Retrieve and use } facts <%= ipadress %> <%fqdn> <%hostname>  Use file resource  ERB file placed in module template directory
  • 45. Puppet language advanced Resources relationship Relationship meta-parameters  before  Resource is applied before the target resource  require  Resource is applied after the target resource  notify  Like before + The target resource will refresh if the notifying resource changes  subscribe  Like require + The subscribing resource will refresh if the target resource changes.
  • 46. Puppet language advanced Resources relationship Ordering relationship package { 'openssh-server': ensure => present, before => File['/etc/ssh/sshd_config'], } file { '/etc/ssh/sshd_config': ensure => file, mode => 600, source => 'puppet:///modules/sshd/sshd_config', require => Package['openssh-server'], } These two examples are mutually-exclusive
  • 47. Puppet language advanced Resources relationship Notification relationship file { '/etc/ssh/sshd_config': ensure => file, mode => 600, source => 'puppet:///modules/sshd/sshd_config', notify => Service['sshd'] } service { 'sshd': ensure => running, enable => true, subscribe => File['/etc/ssh/sshd_config‘] } These two examples are mutually-exclusive
  • 48. Puppet language advanced Resources relationship Chaining and refreshing  Ordering resources  The resource on the left is applied before the resource on the right.  ->  Refreshing  Kind of trigger  Restart a service after a file update  ~> # ntp.conf is applied first, and will notify the ntpd service if it changes: File['/etc/ntp.conf'] ~> Service['ntpd']
  • 49. Puppet language advanced Do you have any questions ?
  • 50. Puppet Summary Configuration Configuration Puppetmaster Puppetmaster management management Puppet installation Puppet installation Puppet Language Puppet Language Puppet language Puppet language advanced advanced basics basics
  • 51. Contact Jeremy MATHEVET @Jeyg Content under Creative Commons BY 3.0 License