Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Puppet

Jose Castro
November 25, 2011

 Puppet

Configuration management tool

Jose Castro

November 25, 2011
Tweet

Other Decks in Technology

Transcript

  1. Introduction Installation Configuration References Puppet: Configuration management tool Master on

    Free Software 2011-2012 Jose Castro http://gsyc.urjc.es/~jfcastro [email protected] @jfcastroluis 24 de noviembre de 2011 1 / 22 Jose Castro Puppet: Configuration management tool
  2. Introduction Installation Configuration References c 2011 Jose Castro This work

    is licensed under a Creative Commons Attribution 3.0 License http://creativecommons.org/licenses/by/3.0 2 / 22 Jose Castro Puppet: Configuration management tool
  3. Introduction Installation Configuration References Context Overview Components Table of Contents

    1 Introduction Context Overview Components 2 Installation Packages install Master config Agent connection 3 Configuration Node definition Resource definition Module definition Even more 4 References 3 / 22 Jose Castro Puppet: Configuration management tool
  4. Introduction Installation Configuration References Context Overview Components Context Sysadmins tasks

    are often repetitive: deploying hosts creating users managing applications configuring daemons monitoring services ... We are always trying automating them with scripts but become complex poorly documented customized to each enviroment rarely scale to large platforms “ssh in a for loop is not a solution” — Luke Kanies, Puppet devel 4 / 22 Jose Castro Puppet: Configuration management tool
  5. Introduction Installation Configuration References Context Overview Components Overview Puppet is

    a configuration management framework and tools with an object-oriented model Ruby-based GPLv2 and Apache (for 2.7.0 and later) Luke Kanies began developing tool in 2001 In 2005 he founded PuppetLabs 0.25.5 to 2.6.0 version Linux, FreeBSD, OpenBSD, Solaris, AIX, HP UX, MacOS... 5 / 22 Jose Castro Puppet: Configuration management tool
  6. Introduction Installation Configuration References Context Overview Components Components (I) Deployment

    Configuration language and resource abstraction layer Transactional layer 6 / 22 Jose Castro Puppet: Configuration management tool
  7. Introduction Installation Configuration References Context Overview Components Components (II) Deployment

    master agent agent agent ... master runs a daemon listens on port 8140 serves a configuration catalog agents connect to master via SSL connection retrieve any configuration from catalog can run as daemon or manually triggered Puppet can also run in a stand-alone mode 7 / 22 Jose Castro Puppet: Configuration management tool
  8. Introduction Installation Configuration References Context Overview Components Components (III) Configuration

    language and resource abstraction layer Package example package { ’vim’: provider => apt, ensure => present, } configuration items are named resources statements about the state of configuration sysadmin doesn’t care how this state is achieved agents use Facter to get information about themself agents manage providers depending on system type 8 / 22 Jose Castro Puppet: Configuration management tool
  9. Introduction Installation Configuration References Context Overview Components Components (and IV)

    Transactional layer The process of host configuration has these steps: Compile the configuration Transfer the compiled configuration to agents Apply the configuration on agents Report the results to the master 9 / 22 Jose Castro Puppet: Configuration management tool
  10. Introduction Installation Configuration References Packages install Master config Agent connection

    Table of Contents 1 Introduction Context Overview Components 2 Installation Packages install Master config Agent connection 3 Configuration Node definition Resource definition Module definition Even more 4 References 10 / 22 Jose Castro Puppet: Configuration management tool
  11. Introduction Installation Configuration References Packages install Master config Agent connection

    Packages install Debian and Ubuntu: # apt-get install puppetmaster facter # apt-get install puppet facter Red Hat: # yum install puppet-server facter # yum install puppet facter FreeBSD: # pkg add -r puppet OpenSolaris: # pkg install -q SUNWruby18 # gem install puppet facter 11 / 22 Jose Castro Puppet: Configuration management tool
  12. Introduction Installation Configuration References Packages install Master config Agent connection

    Master config /etc/puppet/puppet.conf [master] certname=puppet.example.com /etc/hosts x.x.x.x puppet.example.com puppet /etc/puppet/manifests/site.pp # mkdir /etc/puppet/manifests # touch /etc/puppet/manifests/site.pp 12 / 22 Jose Castro Puppet: Configuration management tool
  13. Introduction Installation Configuration References Packages install Master config Agent connection

    Master running Daemon # service puppetmaster start Process # puppet master –no-daemonize initiates Puppet environments creates a local Certificate Authority creates cretificates and keys for master open a connection waiting for clients 13 / 22 Jose Castro Puppet: Configuration management tool
  14. Introduction Installation Configuration References Packages install Master config Agent connection

    Agent connection Agent running # puppet agent –server=puppet.example.com –no-daemonize –verbose Master signing # puppet cert –list # puppet cert –sign node1.example.com 14 / 22 Jose Castro Puppet: Configuration management tool
  15. Introduction Installation Configuration References Node definition Resource definition Module definition

    Even more Table of Contents 1 Introduction Context Overview Components 2 Installation Packages install Master config Agent connection 3 Configuration Node definition Resource definition Module definition Even more 4 References 15 / 22 Jose Castro Puppet: Configuration management tool
  16. Introduction Installation Configuration References Node definition Resource definition Module definition

    Even more Node definition site.pp import ’nodes.pp’ $puppetserver = ’puppet.example.com’ nodes.pp node ’node1.example.com’ { include sudo package { ’vim’: ensure => present } } There are two types of collection we can include in a node: Classes – a basic collection of resources Modules – an advanced and portable collection of resources 16 / 22 Jose Castro Puppet: Configuration management tool
  17. Introduction Installation Configuration References Node definition Resource definition Module definition

    Even more Resource definition Resource type { title: attribute => value, } 17 / 22 Jose Castro Puppet: Configuration management tool
  18. Introduction Installation Configuration References Node definition Resource definition Module definition

    Even more Module definition Module structure # mkdir -p /etc/puppet/modules/sudo/{manifests,files,templates} # touch /etc/puppet/modules/sudo/manifest/init.pp manifests – configuration files files – files to send to nodes templates – templates to generate files 18 / 22 Jose Castro Puppet: Configuration management tool
  19. Introduction Installation Configuration References Node definition Resource definition Module definition

    Even more Even more Templates Inheritance Environments Scheduling SCM to manage modules 19 / 22 Jose Castro Puppet: Configuration management tool
  20. Introduction Installation Configuration References Table of Contents 1 Introduction Context

    Overview Components 2 Installation Packages install Master config Agent connection 3 Configuration Node definition Resource definition Module definition Even more 4 References 20 / 22 Jose Castro Puppet: Configuration management tool
  21. Introduction Installation Configuration References References Books Pro Puppet (James Turnbull

    and Jeffrey McCune) – APress Management Infraestructures with Puppet (James Loope) – O’Reilly Puppet 2.7 Cookbook (John Arundel) – Packt Online Doc http://docs.puppetlabs.com http://www.puppetcookbook.com More #puppet on Freenode http://groups.google.com/group/puppet-users 21 / 22 Jose Castro Puppet: Configuration management tool
  22. Introduction Installation Configuration References Puppet: Configuration management tool Master on

    Free Software 2011-2012 Jose Castro http://gsyc.urjc.es/~jfcastro [email protected] @jfcastroluis 24 de noviembre de 2011 22 / 22 Jose Castro Puppet: Configuration management tool