SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
developing sysadmin -
                          sysadmining developers
                           develop your platform and your
                              application management

                                      GUUG Berlin
                                        01.11.2012
                                       Martin Alfke
                               <martin.alfke@buero20.org>

                                        © Martin Alfke - 2012

Freitag, 2. November 12
Agenda

                           puppet environments
                              puppet modules
                             puppet templates
                            puppet and augeas
                           puppet multi master
                          puppet without master


                                 © Martin Alfke - 2012

Freitag, 2. November 12
Environments


                              “admin’s and dev’s cooperate!”




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
Environments
                     •    Split up modules into several repositories

                     •    “production” is default and always there

                     •    Naming is abritrary

                     •    Master needs to know about environments

                     •    Client needs to send environment information




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
Environments
                 •        puppet.conf
                          [master]
                            [test]
                               manifest = /etc/puppet/test/manifests/site.pp
                               modulepath = /etc/puppet/test/modules
                            [mailteam]
                               manifest = /etc/puppet/mail/manifests/site.pp
                               modulepath = /etc/puppet/mail/modules

                          [agent]
                             environment = test


                           Environments - Modules - Templates - Augeas - Master - Masterless
                                                        © Martin Alfke - 2012

Freitag, 2. November 12
Environments
                 •        Each environment may have multiple modulepaths
                          [master]
                            [test]
                               manifest = /etc/puppet/test/manifests/site.pp
                               modulepath = /etc/puppet/test/modules:/data/puppet/team/test/modules
                            [mailteam]
                               manifest = /etc/puppet/mail/manifests/site.pp
                               modulepath = /etc/puppet/mail/modules:/data/puppet/team/core/modules




                           Environments - Modules - Templates - Augeas - Master - Masterless
                                                      © Martin Alfke - 2012

Freitag, 2. November 12
Modules


                              “plug things together simple”




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                   © Martin Alfke - 2012

Freitag, 2. November 12
Modules
                     •    Difference between modules and classes

                          •   Module:

                              •   strict directory naming for autoloading

                              •   each module has at least one class

                          •   Class:

                              •   available but not applied automatically


                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
Modules
                 •        directory structure
                          /etc/puppet/test/modules/    <-- modulepath
                             apache/                   <-- modulename
                             manifests/                <-- manifests path within module
                                 init.pp              <-- initial class fetched from autoloader
                                 server.pp            <-- additional class(es)
                             files/                    <-- directory for module file serving
                             templates/               <-- directory for module templates
                             lib/                     <-- directory for facts or functions
                             tests/                   <-- directory for tests during develop



                            Environments - Modules - Templates - Augeas - Master - Masterless
                                                          © Martin Alfke - 2012

Freitag, 2. November 12
Modules
                 •        class, file and template naming structure
                          /etc/puppet/test/modules/
                             apache/
                             manifests/
                                 init.pp              <-- class apache { ... }
                                 server.pp            <-- class apache::server { ... }
                             files/                    <-- “puppet:///modules/apache/<filename>”
                             templates/               <-- template(‘apache/<filename>’)
                             lib/
                             tests/



                            Environments - Modules - Templates - Augeas - Master - Masterless
                                                         © Martin Alfke - 2012

Freitag, 2. November 12
Modules
                 •        class structure
                          class apache {
                                   package { ‘apache2’: ensure => present, }
                                   file { ‘/etc/apache2/apache2.conf’:
                                      content => template(‘apache/apache2.conf.erb’),
                                   }
                                   file { ‘/etc/apache2/conf.d/charset’:
                                      source => ‘puppet:///modules/apache/charset’,
                                   }
                                   service { ‘apache2’: ensure => running, }
                          }


                            Environments - Modules - Templates - Augeas - Master - Masterless
                                                        © Martin Alfke - 2012

Freitag, 2. November 12
Modules
                 •        use classes
                          node ‘www01.domain.tld’ {
                                 class { ‘apache’: }      <-- old: include apache
                          }




                            Environments - Modules - Templates - Augeas - Master - Masterless
                                                       © Martin Alfke - 2012

Freitag, 2. November 12
Modules
                 •        resources, classes, parameterized classes
                          resource_type { ‘title’:
                                  attribute => value,
                          }

                          class <title> { ... }
                          class <title> ( $variable = value) { ... }

                          class { ‘<title>’: }
                          class { ‘<title>’:
                                    variable => value,
                          }

                             Environments - Modules - Templates - Augeas - Master - Masterless
                                                             © Martin Alfke - 2012

Freitag, 2. November 12
Modules
                 •        using ruby in classes
                          /etc/puppet/test/modules/apache/manifests/init.rb

                          hostclass :apache do
                            package :apache2, :ensure => present
                            package :libapache2-php, :ensure => present
                            service :apache2, :ensure => running
                          end




                            Environments - Modules - Templates - Augeas - Master - Masterless
                                                        © Martin Alfke - 2012

Freitag, 2. November 12
Templates


                                        “code your config”




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
Templates
                     •    Ruby ERB template engine

                     •    Normally requires in-depth configuration review

                     •    Be aware of variable scoping !




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
Templates
                 •        use variables from puppet in templates
                          $ntpserver = ‘10.2.3.4’
                          file { ‘/etc/ntp.conf’:
                                    content => template(‘ntp/ntp.conf.erb’),
                          }

                          # ntp.conf.erb
                          <% if @ntpserver %>                <-- old: if has_variable(‘ntpserver’)
                          server <%= @ntpserver %>           <-- @ syntax is new. uses current scope
                          <% else %>
                          server pool.ntp.org
                          <% end %>

                            Environments - Modules - Templates - Augeas - Master - Masterless
                                                          © Martin Alfke - 2012

Freitag, 2. November 12
Augeas


                                        “clean your lenses”




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
Augeas
                     •    Make changes to single lines

                     •    Do not manage the complete configuration file in
                          puppet




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
Augeas
                 •        augeas uses lenses to split up config files
                          augtool print /files/etc/sysctl.conf
                          augtool set net.ipv4.forward 1

                          augeas { ‘set_ipv4_forward’:
                                   context => ‘/files/etc/sysctl.conf’,
                                   changes => “set net.ipv4.forward 1”,
                          }




                            Environments - Modules - Templates - Augeas - Master - Masterless
                                                          © Martin Alfke - 2012

Freitag, 2. November 12
Augeas
                     •    Attention!

                     •    Not all configuration files are supported !

                     •    Augeas needs key-value pairs

                     •    Within puppet ruby-augeas extension is required




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
Multi Master


                           “no one can serve two masters!”




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
Multi Master
                     •    Load-Balancing with SSL separation

                     •    several Data Center

                     •    do you really have more than 1000
                          nodes?




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
Multi Master
                 •        separate puppet ca and puppet master
                          puppet.conf on puppet ca (single instance)
                          [master]
                              ca = true
                          puppet.conf on puppet master
                          [master]
                              ca = false
                          puppet.conf on agent
                          [agent]
                              ca_server = <puppet ca>
                              server = <puppet master>


                            Environments - Modules - Templates - Augeas - Master - Masterless
                                                        © Martin Alfke - 2012

Freitag, 2. November 12
Multi Master
                 •        use multiple master (without ca)

                          •    apache/nginx and loadbalancing

                          •    ipvsadm




                              Environments - Modules - Templates - Augeas - Master - Masterless
                                                        © Martin Alfke - 2012

Freitag, 2. November 12
Multi Master
                 •        use multiple master (without ca)

                          •    pros:

                               •   file serving handled better

                               •   more masters compile catalogs

                          •    cons:

                               •   single ca only


                              Environments - Modules - Templates - Augeas - Master - Masterless
                                                        © Martin Alfke - 2012

Freitag, 2. November 12
Multi Master
                 •        avoid multiple masters

                          •    use templates !

                               •   templates are generated on the master during
                                   catalog compilation

                               •   files needs to get fetched by the nodes

                          •    use mod_passenger


                              Environments - Modules - Templates - Augeas - Master - Masterless
                                                        © Martin Alfke - 2012

Freitag, 2. November 12
without Master


                                 “you shall have no master”




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
without Master
                     •    Pre-compile catalogs

                     •    Run puppet apply locally




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
without Master
                     •    Very large environment (>15.000 nodes)

                     •    Multiple locations world wide




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
without Master
                     •    Compile catalogs for all nodes on master

                          •   puppet master compile <fqdn>

                     •    Copy catalogs to nodes to execute them

                          •   puppet apply --catalog <catalog file name>




                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
without Master
                          •   Pros:

                              •   no dedicated master, catalog compilation may
                                  take place everywhere

                          •   Cons:

                              •   no modules !!

                              •   fileserving has to be done locally (e.g. NFS
                                  mount)

                          Environments - Modules - Templates - Augeas - Master - Masterless
                                                    © Martin Alfke - 2012

Freitag, 2. November 12
developing sysadmin -
                          sysadmining developers

                              Wait ! There is more !



                                      Martin Alfke
                              <martin.alfke@buero20.org>

                                       © Martin Alfke - 2012

Freitag, 2. November 12
ENC and Hiera


                              “data, data, data”




                          ENC and Hiera - Puppet DB - Dashboard
                                       © Martin Alfke - 2012

Freitag, 2. November 12
ENC and Hiera
                     •    External Nodes Classifier

                          •   executable with one parameter (fqdn)

                          •   can be anything

                              •   get info from filesystem: cat $1.yaml

                              •   get info from inventory database




                                     ENC and Hiera - Puppet DB - Dashboard
                                                  © Martin Alfke - 2012

Freitag, 2. November 12
ENC and Hiera
                     •      ENC in puppet
                          /etc/puppet/puppet.conf
                          [master]
                                  node_terminus = exec
                                  external_nodes = /etc/puppet/bin/my_great_enc.exe




                                       ENC and Hiera - Puppet DB - Dashboard
                                                      © Martin Alfke - 2012

Freitag, 2. November 12
ENC and Hiera
                 •        /etc/puppet/bin/my_great_enc.exe www1.domain.tld
                           ---
                           parameters:
                               location: de-ber2
                           classes:
                               ntp:
                                  ntpserver: 10.2.2.2
                               apache:
                               mysql:
                           environment: production



                                       ENC and Hiera - Puppet DB - Dashboard
                                                        © Martin Alfke - 2012

Freitag, 2. November 12
ENC and Hiera
                     •    Hiera - hierarchial data structure

                          •   built in into Puppet 3.x

                          •   add-on in Puppet 2.7.x




                                    ENC and Hiera - Puppet DB - Dashboard
                                                 © Martin Alfke - 2012

Freitag, 2. November 12
ENC and Hiera
                     •      Hiera configuration
                          /etc/puppet/hiera.yaml
                          :hierarchy:
                                   - %{operatingsystem}
                                   - common
                                   - %{datacenter}
                                   - %{serverfunction}
                          :backends:
                                   - yaml
                          :yaml:
                                   :datadir: ‘/etc/puppet/hieradata’


                                          ENC and Hiera - Puppet DB - Dashboard
                                                           © Martin Alfke - 2012

Freitag, 2. November 12
ENC and Hiera
                     •      Hiera data
                          /etc/puppet/hieradata/debian.yaml
                          ---
                          ssh_packages: 	

 - ‘openssh-server’
                                            - ‘openssh-client’
                                            - ‘openssh-blacklist’

                          /etc/puppet/hieradata/centos.yaml
                          ---
                          ssh_packages: - ‘openssh’
                                           - ‘openssh-clients’
                                           - ‘openssh-server’

                                          ENC and Hiera - Puppet DB - Dashboard
                                                           © Martin Alfke - 2012

Freitag, 2. November 12
ENC and Hiera
                     •      Hiera usage
                          /etc/puppet/modules/ssh/manifests/init.pp
                          class ssh {
                                   $ssh_packages = hiera(‘ssh_packages’)
                                   package { “${ssh_packages}”: ensure => present }
                          }




                                        ENC and Hiera - Puppet DB - Dashboard
                                                        © Martin Alfke - 2012

Freitag, 2. November 12
PuppetDB


                                “getting it all”




                          ENC and Hiera - Puppet DB - Dashboard
                                       © Martin Alfke - 2012

Freitag, 2. November 12
PuppetDB
                     •    Used for storeconfigs and exported resources

                     •    Schema for PostgreSQL

                     •    Will get more features soon




                                  ENC and Hiera - Puppet DB - Dashboard
                                               © Martin Alfke - 2012

Freitag, 2. November 12
Dashboard


                          “management needs graphs”




                            ENC and Hiera - Puppet DB - Dashboard
                                         © Martin Alfke - 2012

Freitag, 2. November 12
Dashboard
                     •    Open Source Dashboard is dead end

                     •    PuppetLabs is working on two other tools




                                  ENC and Hiera - Puppet DB - Dashboard
                                               © Martin Alfke - 2012

Freitag, 2. November 12
developing sysadmin -
                          sysadmining developers

                                    Questions?



                                      Martin Alfke
                              <martin.alfke@buero20.org>

                                       © Martin Alfke - 2012

Freitag, 2. November 12

Contenu connexe

Tendances

2007 Fsoss Drupal Under The Hood
2007 Fsoss Drupal Under The Hood2007 Fsoss Drupal Under The Hood
2007 Fsoss Drupal Under The HoodJames Walker
 
Puppet Enterprise for the Network
Puppet Enterprise for the NetworkPuppet Enterprise for the Network
Puppet Enterprise for the NetworkPuppet
 
Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Martin Alfke
 
Decoupled Libraries for PHP
Decoupled Libraries for PHPDecoupled Libraries for PHP
Decoupled Libraries for PHPPaul Jones
 
Webinar: Zend framework Getting to grips (ZF1)
Webinar: Zend framework Getting to grips (ZF1)Webinar: Zend framework Getting to grips (ZF1)
Webinar: Zend framework Getting to grips (ZF1)Ryan Mauger
 
Zend framework: Getting to grips (ZF1)
Zend framework: Getting to grips (ZF1)Zend framework: Getting to grips (ZF1)
Zend framework: Getting to grips (ZF1)Ryan Mauger
 
Essential applications management with Tiny Puppet
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny PuppetAlessandro Franceschi
 
Asset management with Zend Framework 2
Asset management with Zend Framework 2Asset management with Zend Framework 2
Asset management with Zend Framework 2Stefano Valle
 
JavaScript Coding with Class
JavaScript Coding with ClassJavaScript Coding with Class
JavaScript Coding with Classdavidwalsh83
 
CapitalCamp Features
CapitalCamp FeaturesCapitalCamp Features
CapitalCamp FeaturesPhase2
 
5050 dev nation
5050 dev nation5050 dev nation
5050 dev nationArun Gupta
 
Portland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPortland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPuppet
 
13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS 13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS DrupalMumbai
 
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...
Java EE 6 = Less Code + More Power (Tutorial)  [5th IndicThreads Conference O...Java EE 6 = Less Code + More Power (Tutorial)  [5th IndicThreads Conference O...
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...IndicThreads
 

Tendances (17)

Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
2007 Fsoss Drupal Under The Hood
2007 Fsoss Drupal Under The Hood2007 Fsoss Drupal Under The Hood
2007 Fsoss Drupal Under The Hood
 
Puppet Enterprise for the Network
Puppet Enterprise for the NetworkPuppet Enterprise for the Network
Puppet Enterprise for the Network
 
Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?
 
Anatomy of a reusable module
Anatomy of a reusable moduleAnatomy of a reusable module
Anatomy of a reusable module
 
Decoupled Libraries for PHP
Decoupled Libraries for PHPDecoupled Libraries for PHP
Decoupled Libraries for PHP
 
Webinar: Zend framework Getting to grips (ZF1)
Webinar: Zend framework Getting to grips (ZF1)Webinar: Zend framework Getting to grips (ZF1)
Webinar: Zend framework Getting to grips (ZF1)
 
Zend framework: Getting to grips (ZF1)
Zend framework: Getting to grips (ZF1)Zend framework: Getting to grips (ZF1)
Zend framework: Getting to grips (ZF1)
 
Essential applications management with Tiny Puppet
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny Puppet
 
Asset management with Zend Framework 2
Asset management with Zend Framework 2Asset management with Zend Framework 2
Asset management with Zend Framework 2
 
Download It
Download ItDownload It
Download It
 
JavaScript Coding with Class
JavaScript Coding with ClassJavaScript Coding with Class
JavaScript Coding with Class
 
CapitalCamp Features
CapitalCamp FeaturesCapitalCamp Features
CapitalCamp Features
 
5050 dev nation
5050 dev nation5050 dev nation
5050 dev nation
 
Portland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPortland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modules
 
13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS 13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS
 
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...
Java EE 6 = Less Code + More Power (Tutorial)  [5th IndicThreads Conference O...Java EE 6 = Less Code + More Power (Tutorial)  [5th IndicThreads Conference O...
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...
 

Similaire à developing sysadmin, sysadmining developersGuug devops puppet

Puppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - GenevaPuppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - GenevaAlessandro Franceschi
 
Oracle Solaris 11 - Best for Enterprise Applications
Oracle Solaris 11 - Best for Enterprise ApplicationsOracle Solaris 11 - Best for Enterprise Applications
Oracle Solaris 11 - Best for Enterprise Applicationsglynnfoster
 
Puppet | Custom Modules & Using the Forge
Puppet | Custom Modules & Using the ForgePuppet | Custom Modules & Using the Forge
Puppet | Custom Modules & Using the ForgeAaron Bernstein
 
Creating Better Builds with Gradle
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with GradleAndres Almiray
 
Drupal module development training delhi
Drupal module development training delhiDrupal module development training delhi
Drupal module development training delhiunitedwebsoft
 
The Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result CacheThe Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result CacheSteven Feuerstein
 
Webinar - Managing Files with Puppet
Webinar - Managing Files with PuppetWebinar - Managing Files with Puppet
Webinar - Managing Files with PuppetOlinData
 
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Phase2
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricksjimi-c
 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10Arto Santala
 
Terraform training - Modules 🎒
Terraform training - Modules 🎒Terraform training - Modules 🎒
Terraform training - Modules 🎒StephaneBoghossian1
 
Scaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global OrganizationScaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global OrganizationPuppet
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnAppOlinData
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules uploadRyan Cuprak
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Dhinakaran Mani
 

Similaire à developing sysadmin, sysadmining developersGuug devops puppet (20)

Puppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - GenevaPuppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - Geneva
 
Oracle Solaris 11 - Best for Enterprise Applications
Oracle Solaris 11 - Best for Enterprise ApplicationsOracle Solaris 11 - Best for Enterprise Applications
Oracle Solaris 11 - Best for Enterprise Applications
 
Puppet | Custom Modules & Using the Forge
Puppet | Custom Modules & Using the ForgePuppet | Custom Modules & Using the Forge
Puppet | Custom Modules & Using the Forge
 
Creating Better Builds with Gradle
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with Gradle
 
Drupal module development training delhi
Drupal module development training delhiDrupal module development training delhi
Drupal module development training delhi
 
The Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result CacheThe Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result Cache
 
Webinar - Managing Files with Puppet
Webinar - Managing Files with PuppetWebinar - Managing Files with Puppet
Webinar - Managing Files with Puppet
 
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
 
Extending ansible
Extending ansibleExtending ansible
Extending ansible
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10
 
Terraform training - Modules 🎒
Terraform training - Modules 🎒Terraform training - Modules 🎒
Terraform training - Modules 🎒
 
Apache Maven basics
Apache Maven basicsApache Maven basics
Apache Maven basics
 
Scaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global OrganizationScaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global Organization
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
Drupal development
Drupal development Drupal development
Drupal development
 
Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7
 

Plus de Martin Alfke

CfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdfCfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdfMartin Alfke
 
HashiTalksDACH-Terraform-Managing training instances in the Cloud
HashiTalksDACH-Terraform-Managing training instances in the CloudHashiTalksDACH-Terraform-Managing training instances in the Cloud
HashiTalksDACH-Terraform-Managing training instances in the CloudMartin Alfke
 
PuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdfPuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdfMartin Alfke
 
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GITPuppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GITMartin Alfke
 
DevOps - How to get technical buy in
DevOps - How to get technical buy inDevOps - How to get technical buy in
DevOps - How to get technical buy inMartin Alfke
 
ADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized worldADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized worldMartin Alfke
 
OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?Martin Alfke
 
PuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and ProvidesPuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and ProvidesMartin Alfke
 
Puppet Camp Paris 2016 Data in Modules
Puppet Camp Paris 2016 Data in ModulesPuppet Camp Paris 2016 Data in Modules
Puppet Camp Paris 2016 Data in ModulesMartin Alfke
 
Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014Martin Alfke
 
GUUG Hamburg OpenNebula
GUUG Hamburg OpenNebulaGUUG Hamburg OpenNebula
GUUG Hamburg OpenNebulaMartin Alfke
 
Puppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartwayPuppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartwayMartin Alfke
 
Puppet future parser
Puppet future parserPuppet future parser
Puppet future parserMartin Alfke
 
Gluster fs buero20_presentation
Gluster fs buero20_presentationGluster fs buero20_presentation
Gluster fs buero20_presentationMartin Alfke
 
Puppet buero20 presentation
Puppet buero20 presentationPuppet buero20 presentation
Puppet buero20 presentationMartin Alfke
 

Plus de Martin Alfke (17)

CfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdfCfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdf
 
HashiTalksDACH-Terraform-Managing training instances in the Cloud
HashiTalksDACH-Terraform-Managing training instances in the CloudHashiTalksDACH-Terraform-Managing training instances in the Cloud
HashiTalksDACH-Terraform-Managing training instances in the Cloud
 
PuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdfPuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdf
 
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GITPuppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
 
DevOps - How to get technical buy in
DevOps - How to get technical buy inDevOps - How to get technical buy in
DevOps - How to get technical buy in
 
ADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized worldADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized world
 
OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?
 
PuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and ProvidesPuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and Provides
 
Puppet Camp Paris 2016 Data in Modules
Puppet Camp Paris 2016 Data in ModulesPuppet Camp Paris 2016 Data in Modules
Puppet Camp Paris 2016 Data in Modules
 
Power of Puppet 4
Power of Puppet 4Power of Puppet 4
Power of Puppet 4
 
Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014
 
GUUG Hamburg OpenNebula
GUUG Hamburg OpenNebulaGUUG Hamburg OpenNebula
GUUG Hamburg OpenNebula
 
Puppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartwayPuppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartway
 
One
OneOne
One
 
Puppet future parser
Puppet future parserPuppet future parser
Puppet future parser
 
Gluster fs buero20_presentation
Gluster fs buero20_presentationGluster fs buero20_presentation
Gluster fs buero20_presentation
 
Puppet buero20 presentation
Puppet buero20 presentationPuppet buero20 presentation
Puppet buero20 presentation
 

developing sysadmin, sysadmining developersGuug devops puppet

  • 1. developing sysadmin - sysadmining developers develop your platform and your application management GUUG Berlin 01.11.2012 Martin Alfke <martin.alfke@buero20.org> © Martin Alfke - 2012 Freitag, 2. November 12
  • 2. Agenda puppet environments puppet modules puppet templates puppet and augeas puppet multi master puppet without master © Martin Alfke - 2012 Freitag, 2. November 12
  • 3. Environments “admin’s and dev’s cooperate!” Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 4. Environments • Split up modules into several repositories • “production” is default and always there • Naming is abritrary • Master needs to know about environments • Client needs to send environment information Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 5. Environments • puppet.conf [master] [test] manifest = /etc/puppet/test/manifests/site.pp modulepath = /etc/puppet/test/modules [mailteam] manifest = /etc/puppet/mail/manifests/site.pp modulepath = /etc/puppet/mail/modules [agent] environment = test Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 6. Environments • Each environment may have multiple modulepaths [master] [test] manifest = /etc/puppet/test/manifests/site.pp modulepath = /etc/puppet/test/modules:/data/puppet/team/test/modules [mailteam] manifest = /etc/puppet/mail/manifests/site.pp modulepath = /etc/puppet/mail/modules:/data/puppet/team/core/modules Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 7. Modules “plug things together simple” Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 8. Modules • Difference between modules and classes • Module: • strict directory naming for autoloading • each module has at least one class • Class: • available but not applied automatically Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 9. Modules • directory structure /etc/puppet/test/modules/ <-- modulepath apache/ <-- modulename manifests/ <-- manifests path within module init.pp <-- initial class fetched from autoloader server.pp <-- additional class(es) files/ <-- directory for module file serving templates/ <-- directory for module templates lib/ <-- directory for facts or functions tests/ <-- directory for tests during develop Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 10. Modules • class, file and template naming structure /etc/puppet/test/modules/ apache/ manifests/ init.pp <-- class apache { ... } server.pp <-- class apache::server { ... } files/ <-- “puppet:///modules/apache/<filename>” templates/ <-- template(‘apache/<filename>’) lib/ tests/ Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 11. Modules • class structure class apache { package { ‘apache2’: ensure => present, } file { ‘/etc/apache2/apache2.conf’: content => template(‘apache/apache2.conf.erb’), } file { ‘/etc/apache2/conf.d/charset’: source => ‘puppet:///modules/apache/charset’, } service { ‘apache2’: ensure => running, } } Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 12. Modules • use classes node ‘www01.domain.tld’ { class { ‘apache’: } <-- old: include apache } Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 13. Modules • resources, classes, parameterized classes resource_type { ‘title’: attribute => value, } class <title> { ... } class <title> ( $variable = value) { ... } class { ‘<title>’: } class { ‘<title>’: variable => value, } Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 14. Modules • using ruby in classes /etc/puppet/test/modules/apache/manifests/init.rb hostclass :apache do package :apache2, :ensure => present package :libapache2-php, :ensure => present service :apache2, :ensure => running end Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 15. Templates “code your config” Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 16. Templates • Ruby ERB template engine • Normally requires in-depth configuration review • Be aware of variable scoping ! Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 17. Templates • use variables from puppet in templates $ntpserver = ‘10.2.3.4’ file { ‘/etc/ntp.conf’: content => template(‘ntp/ntp.conf.erb’), } # ntp.conf.erb <% if @ntpserver %> <-- old: if has_variable(‘ntpserver’) server <%= @ntpserver %> <-- @ syntax is new. uses current scope <% else %> server pool.ntp.org <% end %> Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 18. Augeas “clean your lenses” Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 19. Augeas • Make changes to single lines • Do not manage the complete configuration file in puppet Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 20. Augeas • augeas uses lenses to split up config files augtool print /files/etc/sysctl.conf augtool set net.ipv4.forward 1 augeas { ‘set_ipv4_forward’: context => ‘/files/etc/sysctl.conf’, changes => “set net.ipv4.forward 1”, } Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 21. Augeas • Attention! • Not all configuration files are supported ! • Augeas needs key-value pairs • Within puppet ruby-augeas extension is required Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 22. Multi Master “no one can serve two masters!” Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 23. Multi Master • Load-Balancing with SSL separation • several Data Center • do you really have more than 1000 nodes? Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 24. Multi Master • separate puppet ca and puppet master puppet.conf on puppet ca (single instance) [master] ca = true puppet.conf on puppet master [master] ca = false puppet.conf on agent [agent] ca_server = <puppet ca> server = <puppet master> Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 25. Multi Master • use multiple master (without ca) • apache/nginx and loadbalancing • ipvsadm Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 26. Multi Master • use multiple master (without ca) • pros: • file serving handled better • more masters compile catalogs • cons: • single ca only Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 27. Multi Master • avoid multiple masters • use templates ! • templates are generated on the master during catalog compilation • files needs to get fetched by the nodes • use mod_passenger Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 28. without Master “you shall have no master” Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 29. without Master • Pre-compile catalogs • Run puppet apply locally Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 30. without Master • Very large environment (>15.000 nodes) • Multiple locations world wide Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 31. without Master • Compile catalogs for all nodes on master • puppet master compile <fqdn> • Copy catalogs to nodes to execute them • puppet apply --catalog <catalog file name> Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 32. without Master • Pros: • no dedicated master, catalog compilation may take place everywhere • Cons: • no modules !! • fileserving has to be done locally (e.g. NFS mount) Environments - Modules - Templates - Augeas - Master - Masterless © Martin Alfke - 2012 Freitag, 2. November 12
  • 33. developing sysadmin - sysadmining developers Wait ! There is more ! Martin Alfke <martin.alfke@buero20.org> © Martin Alfke - 2012 Freitag, 2. November 12
  • 34. ENC and Hiera “data, data, data” ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 35. ENC and Hiera • External Nodes Classifier • executable with one parameter (fqdn) • can be anything • get info from filesystem: cat $1.yaml • get info from inventory database ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 36. ENC and Hiera • ENC in puppet /etc/puppet/puppet.conf [master] node_terminus = exec external_nodes = /etc/puppet/bin/my_great_enc.exe ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 37. ENC and Hiera • /etc/puppet/bin/my_great_enc.exe www1.domain.tld --- parameters: location: de-ber2 classes: ntp: ntpserver: 10.2.2.2 apache: mysql: environment: production ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 38. ENC and Hiera • Hiera - hierarchial data structure • built in into Puppet 3.x • add-on in Puppet 2.7.x ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 39. ENC and Hiera • Hiera configuration /etc/puppet/hiera.yaml :hierarchy: - %{operatingsystem} - common - %{datacenter} - %{serverfunction} :backends: - yaml :yaml: :datadir: ‘/etc/puppet/hieradata’ ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 40. ENC and Hiera • Hiera data /etc/puppet/hieradata/debian.yaml --- ssh_packages: - ‘openssh-server’ - ‘openssh-client’ - ‘openssh-blacklist’ /etc/puppet/hieradata/centos.yaml --- ssh_packages: - ‘openssh’ - ‘openssh-clients’ - ‘openssh-server’ ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 41. ENC and Hiera • Hiera usage /etc/puppet/modules/ssh/manifests/init.pp class ssh { $ssh_packages = hiera(‘ssh_packages’) package { “${ssh_packages}”: ensure => present } } ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 42. PuppetDB “getting it all” ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 43. PuppetDB • Used for storeconfigs and exported resources • Schema for PostgreSQL • Will get more features soon ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 44. Dashboard “management needs graphs” ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 45. Dashboard • Open Source Dashboard is dead end • PuppetLabs is working on two other tools ENC and Hiera - Puppet DB - Dashboard © Martin Alfke - 2012 Freitag, 2. November 12
  • 46. developing sysadmin - sysadmining developers Questions? Martin Alfke <martin.alfke@buero20.org> © Martin Alfke - 2012 Freitag, 2. November 12