Developing IT infrastructures with Puppet

Alessandro Franceschi
Alessandro FranceschiFounder @ Lab42
Programmare Infrastrutture IT con Puppet
                                           Alessandro Franceschi / Lab42
Infrastructure progressio
cum Puppet
IT Infrastructures development with Puppet
                                  Alessandro Franceschi / Lab42
                                        CodeMotion 2012 Roma


                  Creative Commons BY-NC-SA 3.0
From Ops
to DevOps
Tempus fugit
Flexible... elastic... scalable
What’s behind these cloudy words?
Panta rei
Automation is a matter of survival
Alea iacta est
Ops like automation!
                  ( since Bourne shell ... )
Errare
humanum est
From a bunch of custom scripts
             to Standard Integrated Tools
Factotum




Have you heard about this Puppet|Chef | CfEngine stuff?
Doctum doces
Infrastructure as code
Scripta manent,
verba volant
Servers Infrastructure Change under...
                          version control!
Repetitia iuvant
Code behaves always in the same way:
                      Consistent setups
Ignorantia legis
non excusat
Code can be tested.
                  Infrastructure Code too.
Masters
of Puppet
Gratis
OpenSource from www.puppetlabs.com
Cui prodest?




   Source: www.puppetlabs.com
Divide et Impera
Many Puppet nodes                                            One Puppet Master




Clients
User: root
Process: /usr/bin/ruby /usr/sbin/puppetd -t


                                                                         Server
                                                                   User: puppet
                                 Process: /usr/bin/ruby /usr/sbin/puppetmasterd
                                                       Listen: TCP 0.0.0.0:8140
package { 'openssh-server':

Status Quo               }
                             ensure => present,
                             before => File['/etc/ssh/sshd_config'],


A declarative language   file { '/etc/ssh/sshd_config':
                             ensure => file,
                             mode   => 600,
                             source => '/root/learning-manifests/sshd_config',
                         }

                         service { 'sshd':
                             ensure     => running,
                             enable     => true,
                             subscribe => File['/etc/ssh/sshd_config'],
                         }
Veni vidi vici
Ex Aequo
Operating System Abstraction
Deus
Ex
Machina

# This File is Managed by Puppet
Mater semper
 certa est,
 pater nunquam
 O: Who changed that file?!




info: Filebucket[/var/lib/puppet/clientbucket]: Adding /etc/
resolv.conf(d7fbc1695489ce896d30b7b04d72887c)
info: //test/File[/etc/resolv.conf]: Filebucketed /etc/resolv.conf to main with sum
d7fbc1695489ce896d30b7b04d72887c

Old file is copied in:
/var/lib/puppet/clientbucket/d/7/f/b/c/1/6/9/d7fbc1695489ce896d30b7b04d72887c/content
Enough graphics, show me some


  Puppet code!
Nodes definitions
 In Puppet code:                 On an External Node Classifier (ENC)
 /etc/puppet/manifests/site.pp

 node 'prod-fep-1' {
     $status = "prod"
     include role_fep
 }

 node 'prod-fep-2' {                              The Foreman
     $status = "prod"
     include role_fep
 }

 node 'test-fep-1' {
     $status = "test"
     include role_fep
 }
                                            Puppet Dashboard
 node 'dev-fep-1' {
     $status = "dev"
     include role_fep
 }

 [...]

                                 Puppet Enterprise Console
Classes (collections of resources)
 class role_fep {
     $role="fep"

     include general # We see it in the next slide

     include apache
     include php::pear
     include php::dev
     include php::oci8
     apache::module { "rewrite": }
     apache::module { "proxy": templatefile => "proxy.conf.erb" }
     php::module { "gd": }
     php::pear::module { "apc": }
     php::pear::module { "XML_Serializer": use_package => "no" }
     php::pecl::config { "http_proxy": value => "$proxy_server" }
     [...]

     # Sample custom files
     file { ‘/data’:
         ensure => directory,
     }
     file { ‘/data/www’:
         ensure => $::operatingsystem ? {
            /(?i:Centos|RedHat|Scientific|Fedora)/ => ‘/var/www/html’,
            /(?i:Debian|Ubuntu|Mint)/              => ‘/var/www’,
         },
         require => File[‘/data’]:
     }
 }
Classes ( a baseline common to all nodes )
 class general {

     include   puppet
     include   users
     include   openssh
     include   hosts
     include   resolver
     include   sudo
     include   snmpd
     include   nrpe
     include   munin

     case $::operatingsystem {
         ubuntu,debian: {
             include apt
             include exim
         }
         centos,redhat: {
             include yum
         }
         default: { }
     }

 }
Modules - Directory layout
  /etc/puppet/modules/ ($modulepath)

 apache/                      One Application, One Module, One class
 apache/manifests/
 apache/manifests/init.pp     Puppet Manifests ( code in the Puppet DSL )
 apache/manifests/module.pp

 apache/lib/
 apache/lib/puppet/
                             Puppet    extensions ( code in Ruby )
 apache/lib/puppet/parser/
 apache/lib/puppet/parser/functions
 apache/lib/puppet/provider/
 apache/lib/puppet/type/
 apache/lib/facter/

 apache/templates/            Erb Templates (files with dynamic content)
 apache/files/                Static files
 apache/spec/
 apache/spec/classes/         Rspec tests
 apache/spec/defines/

 apache/Modulefile            Module’s metadata for the Puppet Forge
 apache/README.md
Modules - Files autoloading

class autofs {

    package { autofs:
      ensure => present,
    }

    service { autofs:
      ensure => running,             Sourced (static) files are searched in:
      enable => true,                $modulepath/autofs/files/auto.homes
    }

    file { "auto.homes":
      path   => “/etc/auto.homes”,
      source => "puppet://$servername/modules/autofs/auto.homes"
    }

}

                             Templates (Ruby ERB) are searched in:
class autofs {               $modulepath/autofs/templates/auto.master.erb
    [...]

    file { "/etc/auto.master":
      content => template("autofs/auto.master.erb")
    }

}
LINKS
             for a better living



http://docs.puppetlabs.com/ - PuppetLabs documentation

http://planetpuppet.org/ - Planet Puppet - Feeds aggregator

http://puppetlabs.com/community/puppet-camp/ - PuppetCamps

https://bitly.com/wnvqaN - How to start with Puppet - Useful links

http://www.example42.com/ - Example42 Puppet modules ( disclaimer ;-)
DO UT DES



Automated Systems Setups
Coherent Infrastructure
Track and History of Change
Installations Replicability
                                                         A new language to learn
Quick propagation of changes
                                                      Effectiveness needs practice
Aligned Environments for Test/[...]/Prod
                                                   If there’s code , there are bugs
Automated monitoring
                                       Make Puppet the Enforcer not the Violator
                                             Discipline in Systems management
                                   More time to make things done (the first time)
                                        Great Power gives Great Responsibilities
ad maiora
               Questions?
                              Graphics:
@alvagante                  www.tatlin.net
1 of 30

Recommended

Puppet Systems Infrastructure Construction Kit by
Puppet Systems Infrastructure Construction KitPuppet Systems Infrastructure Construction Kit
Puppet Systems Infrastructure Construction KitAlessandro Franceschi
1.6K views22 slides
Puppet camp2021 testing modules and controlrepo by
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet
1.5K views41 slides
Modules of the twenties by
Modules of the twentiesModules of the twenties
Modules of the twentiesPuppet
848 views27 slides
Puppet Continuous Integration with PE and GitLab by
Puppet Continuous Integration with PE and GitLabPuppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLabAlessandro Franceschi
1.1K views11 slides
Puppet Camp Paris 2016 Data in Modules by
Puppet Camp Paris 2016 Data in ModulesPuppet Camp Paris 2016 Data in Modules
Puppet Camp Paris 2016 Data in ModulesMartin Alfke
1.4K views43 slides
Puppet modules: An Holistic Approach by
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachAlessandro Franceschi
3.1K views23 slides

More Related Content

What's hot

Can you upgrade to Puppet 4.x? by
Can you upgrade to Puppet 4.x?Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Martin Alfke
2.3K views43 slides
Puppet evolutions by
Puppet evolutionsPuppet evolutions
Puppet evolutionsAlessandro Franceschi
10.3K views27 slides
Essential applications management with Tiny Puppet by
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny PuppetAlessandro Franceschi
2.1K views15 slides
Puppet: From 0 to 100 in 30 minutes by
Puppet: From 0 to 100 in 30 minutesPuppet: From 0 to 100 in 30 minutes
Puppet: From 0 to 100 in 30 minutesAlessandro Franceschi
1.6K views25 slides
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016) by
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Robert Nelson
1.3K views31 slides
Auto Deploy Deep Dive – vBrownBag Style by
Auto Deploy Deep Dive – vBrownBag StyleAuto Deploy Deep Dive – vBrownBag Style
Auto Deploy Deep Dive – vBrownBag StyleRobert Nelson
10.1K views25 slides

What's hot(20)

Can you upgrade to Puppet 4.x? by Martin Alfke
Can you upgrade to Puppet 4.x?Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?
Martin Alfke2.3K views
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016) by Robert Nelson
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Robert Nelson1.3K views
Auto Deploy Deep Dive – vBrownBag Style by Robert Nelson
Auto Deploy Deep Dive – vBrownBag StyleAuto Deploy Deep Dive – vBrownBag Style
Auto Deploy Deep Dive – vBrownBag Style
Robert Nelson10.1K views
Puppet Camp Dallas 2014: How Puppet Ops Rolls by Puppet
Puppet Camp Dallas 2014: How Puppet Ops RollsPuppet Camp Dallas 2014: How Puppet Ops Rolls
Puppet Camp Dallas 2014: How Puppet Ops Rolls
Puppet885 views
Puppet camp london-modulerewritingsmartway by Martin Alfke
Puppet camp london-modulerewritingsmartwayPuppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartway
Martin Alfke1.2K views
Our Puppet Story (Linuxtag 2014) by DECK36
Our Puppet Story (Linuxtag 2014)Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)
DECK362.9K views
Puppet for Sys Admins by Puppet
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys Admins
Puppet5.3K views
Virtual Bolt Workshop - March 16, 2020 by Puppet
Virtual Bolt Workshop - March 16, 2020Virtual Bolt Workshop - March 16, 2020
Virtual Bolt Workshop - March 16, 2020
Puppet219 views
Puppet for SysAdmins by Puppet
Puppet for SysAdminsPuppet for SysAdmins
Puppet for SysAdmins
Puppet7.2K views
Virtual Bolt Workshop - 6 May by Puppet
Virtual Bolt Workshop - 6 MayVirtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 May
Puppet220 views
Virtual Bolt Workshop, 5 May 2020 by Puppet
Virtual Bolt Workshop, 5 May 2020Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020
Puppet174 views

Similar to Developing IT infrastructures with Puppet

Puppet: Eclipsecon ALM 2013 by
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013grim_radical
1.2K views74 slides
From Dev to DevOps - Codemotion ES 2012 by
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012Carlos Sanchez
2.3K views75 slides
Puppet quick start guide by
Puppet quick start guidePuppet quick start guide
Puppet quick start guideSuhan Dharmasuriya
1.8K views19 slides
PuppetDB: Sneaking Clojure into Operations by
PuppetDB: Sneaking Clojure into OperationsPuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into Operationsgrim_radical
1.5K views109 slides
20090514 Introducing Puppet To Sasag by
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasaggarrett honeycutt
1.1K views34 slides
Puppet by
PuppetPuppet
PuppetŁukasz Jagiełło
1.1K views21 slides

Similar to Developing IT infrastructures with Puppet(20)

Puppet: Eclipsecon ALM 2013 by grim_radical
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
grim_radical1.2K views
From Dev to DevOps - Codemotion ES 2012 by Carlos Sanchez
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez2.3K views
PuppetDB: Sneaking Clojure into Operations by grim_radical
PuppetDB: Sneaking Clojure into OperationsPuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into Operations
grim_radical1.5K views
Introduction to PowerShell by Boulos Dib
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
Boulos Dib2.6K views
A Presentation about Puppet that I've made at the OSSPAC conference by ohadlevy
A Presentation about Puppet that I've made at the OSSPAC conferenceA Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conference
ohadlevy3K views
Workflow story: Theory versus practice in Large Enterprises by Puppet
Workflow story: Theory versus practice in Large EnterprisesWorkflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large Enterprises
Puppet3.1K views
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak by NETWAYS
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakWorkflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
NETWAYS504 views
From Dev to DevOps - ApacheCON NA 2011 by Carlos Sanchez
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011
Carlos Sanchez5.4K views
From Dev to DevOps by Agile Spain
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOps
Agile Spain1.8K views
Writing & Sharing Great Modules - Puppet Camp Boston by Puppet
Writing & Sharing Great Modules - Puppet Camp BostonWriting & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp Boston
Puppet1.8K views
Installaling Puppet Master and Agent by Ranjit Avasarala
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
Ranjit Avasarala1.2K views
Puppet without Root - PuppetConf 2013 by Puppet
Puppet without Root - PuppetConf 2013Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013
Puppet6.5K views
Ansible new paradigms for orchestration by Paolo Tonin
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
Paolo Tonin813 views
A Fabric/Puppet Build/Deploy System by adrian_nye
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
adrian_nye9.2K views
Tame your Infrastructure with Puppet by delimiter
Tame your Infrastructure with PuppetTame your Infrastructure with Puppet
Tame your Infrastructure with Puppet
delimiter1.7K views
Introduction to puppet - Hands on Session at HPI Potsdam by Christoph Oelmüller
Introduction to puppet - Hands on Session at HPI PotsdamIntroduction to puppet - Hands on Session at HPI Potsdam
Introduction to puppet - Hands on Session at HPI Potsdam

More from Alessandro Franceschi

DevOps - Evoluzione della specie - DevOps Heroes.pdf by
DevOps - Evoluzione della specie - DevOps Heroes.pdfDevOps - Evoluzione della specie - DevOps Heroes.pdf
DevOps - Evoluzione della specie - DevOps Heroes.pdfAlessandro Franceschi
31 views30 slides
Tiny Puppet Can Install Everything. Prove me wrong! by
Tiny Puppet Can Install Everything. Prove me wrong!Tiny Puppet Can Install Everything. Prove me wrong!
Tiny Puppet Can Install Everything. Prove me wrong!Alessandro Franceschi
43 views20 slides
ReUse Your (Puppet) Modules! by
ReUse Your (Puppet) Modules!ReUse Your (Puppet) Modules!
ReUse Your (Puppet) Modules!Alessandro Franceschi
992 views45 slides
Ten years of [Puppet] installations. What now? by
Ten years of [Puppet] installations. What now?Ten years of [Puppet] installations. What now?
Ten years of [Puppet] installations. What now?Alessandro Franceschi
585 views26 slides
Raise the bar! Reloaded by
Raise the bar! ReloadedRaise the bar! Reloaded
Raise the bar! ReloadedAlessandro Franceschi
3.2K views23 slides
Raise the bar! by
Raise the bar!Raise the bar!
Raise the bar!Alessandro Franceschi
1.4K views19 slides

Recently uploaded

Kyo - Functional Scala 2023.pdf by
Kyo - Functional Scala 2023.pdfKyo - Functional Scala 2023.pdf
Kyo - Functional Scala 2023.pdfFlavio W. Brasil
457 views92 slides
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...ShapeBlue
166 views28 slides
Ransomware is Knocking your Door_Final.pdf by
Ransomware is Knocking your Door_Final.pdfRansomware is Knocking your Door_Final.pdf
Ransomware is Knocking your Door_Final.pdfSecurity Bootcamp
96 views46 slides
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueShapeBlue
263 views23 slides
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueShapeBlue
138 views15 slides
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...ShapeBlue
145 views17 slides

Recently uploaded(20)

How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue166 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue263 views
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue138 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue145 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue180 views
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue194 views
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue by ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueCloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
ShapeBlue135 views
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue130 views
Initiating and Advancing Your Strategic GIS Governance Strategy by Safe Software
Initiating and Advancing Your Strategic GIS Governance StrategyInitiating and Advancing Your Strategic GIS Governance Strategy
Initiating and Advancing Your Strategic GIS Governance Strategy
Safe Software176 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson160 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue203 views
Business Analyst Series 2023 - Week 4 Session 8 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8
DianaGray10123 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue159 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE79 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc170 views
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T by ShapeBlue
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
ShapeBlue152 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue218 views

Developing IT infrastructures with Puppet

  • 1. Programmare Infrastrutture IT con Puppet Alessandro Franceschi / Lab42
  • 2. Infrastructure progressio cum Puppet IT Infrastructures development with Puppet Alessandro Franceschi / Lab42 CodeMotion 2012 Roma Creative Commons BY-NC-SA 3.0
  • 4. Tempus fugit Flexible... elastic... scalable What’s behind these cloudy words?
  • 5. Panta rei Automation is a matter of survival
  • 6. Alea iacta est Ops like automation! ( since Bourne shell ... )
  • 7. Errare humanum est From a bunch of custom scripts to Standard Integrated Tools
  • 8. Factotum Have you heard about this Puppet|Chef | CfEngine stuff?
  • 10. Scripta manent, verba volant Servers Infrastructure Change under... version control!
  • 11. Repetitia iuvant Code behaves always in the same way: Consistent setups
  • 12. Ignorantia legis non excusat Code can be tested. Infrastructure Code too.
  • 15. Cui prodest? Source: www.puppetlabs.com
  • 16. Divide et Impera Many Puppet nodes One Puppet Master Clients User: root Process: /usr/bin/ruby /usr/sbin/puppetd -t Server User: puppet Process: /usr/bin/ruby /usr/sbin/puppetmasterd Listen: TCP 0.0.0.0:8140
  • 17. package { 'openssh-server': Status Quo } ensure => present, before => File['/etc/ssh/sshd_config'], A declarative language file { '/etc/ssh/sshd_config': ensure => file, mode => 600, source => '/root/learning-manifests/sshd_config', } service { 'sshd': ensure => running, enable => true, subscribe => File['/etc/ssh/sshd_config'], }
  • 20. Deus Ex Machina # This File is Managed by Puppet
  • 21. Mater semper certa est, pater nunquam O: Who changed that file?! info: Filebucket[/var/lib/puppet/clientbucket]: Adding /etc/ resolv.conf(d7fbc1695489ce896d30b7b04d72887c) info: //test/File[/etc/resolv.conf]: Filebucketed /etc/resolv.conf to main with sum d7fbc1695489ce896d30b7b04d72887c Old file is copied in: /var/lib/puppet/clientbucket/d/7/f/b/c/1/6/9/d7fbc1695489ce896d30b7b04d72887c/content
  • 22. Enough graphics, show me some Puppet code!
  • 23. Nodes definitions In Puppet code: On an External Node Classifier (ENC) /etc/puppet/manifests/site.pp node 'prod-fep-1' { $status = "prod" include role_fep } node 'prod-fep-2' { The Foreman $status = "prod" include role_fep } node 'test-fep-1' { $status = "test" include role_fep } Puppet Dashboard node 'dev-fep-1' { $status = "dev" include role_fep } [...] Puppet Enterprise Console
  • 24. Classes (collections of resources) class role_fep { $role="fep" include general # We see it in the next slide include apache include php::pear include php::dev include php::oci8 apache::module { "rewrite": } apache::module { "proxy": templatefile => "proxy.conf.erb" } php::module { "gd": } php::pear::module { "apc": } php::pear::module { "XML_Serializer": use_package => "no" } php::pecl::config { "http_proxy": value => "$proxy_server" } [...] # Sample custom files file { ‘/data’: ensure => directory, } file { ‘/data/www’: ensure => $::operatingsystem ? { /(?i:Centos|RedHat|Scientific|Fedora)/ => ‘/var/www/html’, /(?i:Debian|Ubuntu|Mint)/ => ‘/var/www’, }, require => File[‘/data’]: } }
  • 25. Classes ( a baseline common to all nodes ) class general { include puppet include users include openssh include hosts include resolver include sudo include snmpd include nrpe include munin case $::operatingsystem { ubuntu,debian: { include apt include exim } centos,redhat: { include yum } default: { } } }
  • 26. Modules - Directory layout /etc/puppet/modules/ ($modulepath) apache/ One Application, One Module, One class apache/manifests/ apache/manifests/init.pp Puppet Manifests ( code in the Puppet DSL ) apache/manifests/module.pp apache/lib/ apache/lib/puppet/ Puppet extensions ( code in Ruby ) apache/lib/puppet/parser/ apache/lib/puppet/parser/functions apache/lib/puppet/provider/ apache/lib/puppet/type/ apache/lib/facter/ apache/templates/ Erb Templates (files with dynamic content) apache/files/ Static files apache/spec/ apache/spec/classes/ Rspec tests apache/spec/defines/ apache/Modulefile Module’s metadata for the Puppet Forge apache/README.md
  • 27. Modules - Files autoloading class autofs { package { autofs: ensure => present, } service { autofs: ensure => running, Sourced (static) files are searched in: enable => true, $modulepath/autofs/files/auto.homes } file { "auto.homes": path => “/etc/auto.homes”, source => "puppet://$servername/modules/autofs/auto.homes" } } Templates (Ruby ERB) are searched in: class autofs { $modulepath/autofs/templates/auto.master.erb [...] file { "/etc/auto.master": content => template("autofs/auto.master.erb") } }
  • 28. LINKS for a better living http://docs.puppetlabs.com/ - PuppetLabs documentation http://planetpuppet.org/ - Planet Puppet - Feeds aggregator http://puppetlabs.com/community/puppet-camp/ - PuppetCamps https://bitly.com/wnvqaN - How to start with Puppet - Useful links http://www.example42.com/ - Example42 Puppet modules ( disclaimer ;-)
  • 29. DO UT DES Automated Systems Setups Coherent Infrastructure Track and History of Change Installations Replicability A new language to learn Quick propagation of changes Effectiveness needs practice Aligned Environments for Test/[...]/Prod If there’s code , there are bugs Automated monitoring Make Puppet the Enforcer not the Violator Discipline in Systems management More time to make things done (the first time) Great Power gives Great Responsibilities
  • 30. ad maiora Questions? Graphics: @alvagante www.tatlin.net