Scalable systems management with puppet


Published on

TeraGrid ’10- Nick Jones and Stephen McNally

Scalable systems management with puppet

  1. 1. Scalable Systems Management with Puppet Nick Jones and Stephen McNally HPC Operations Group August 2, 2010
  2. 2. National Institute for Computational Sciences <ul><li>NICS is a collaboration between UT and ORNL </li></ul><ul><li>Awarded the NSF Track 2B ($65M) </li></ul><ul><li>Phased deployment of Cray XT systems </li></ul><ul><li>Staffed with 25 FTEs, funding for 15 more </li></ul><ul><li>Total JICS funding ~$92M </li></ul>
  3. 3. #4 Top500 June 2010
  4. 4. Topics <ul><li>Challenges that System Administrators Face </li></ul><ul><li>Why Puppet? </li></ul><ul><li>Puppet Installation and Configuration </li></ul><ul><li>Managing Your Infrastructure with Puppet </li></ul><ul><li>Advanced Puppet Topics </li></ul><ul><li>Hands On Exercises </li></ul>
  5. 5. Wireless <ul><li>GlobalMeetingWireless </li></ul><ul><li>Passcode: TG10 </li></ul>
  6. 6. Challenges that System Administrators Face
  7. 7. What do Systems Administrators do? <ul><li>Watch YouTube </li></ul><ul><li>Eat Fritos and Mountain Dew </li></ul><ul><li>Have big warm fuzzy secret heart </li></ul><ul><li>Rearrange Netflix queue </li></ul>
  8. 8. Case Studies : Your Prototypical SysAdmin <ul><li>Has to manage lots of servers </li></ul><ul><li>Responsible for installation, maintenance, updates……the whole shebang </li></ul><ul><li>Let’s call him (or her) “Geppetto” </li></ul>
  9. 9. Case Study 1 : Sudo <ul><li>Organization gets new interns </li></ul><ul><li>Need to give interns sudo privileges on appropriate machines </li></ul>
  10. 10. Case Study 1 : Sudo <ul><li>The old way: </li></ul><ul><ul><li>Edit the sudoers file on one server </li></ul></ul><ul><ul><li>Use scp, pdsh, rsync or some combination of the above to deploy to necessary systems </li></ul></ul><ul><li>Pitfalls: </li></ul><ul><ul><li>What if you have different distros, and they store the sudoers file in different locations? </li></ul></ul><ul><ul><li>How do you detect errors? </li></ul></ul>
  11. 11. Case Study 1 : Sudo <ul><li>The Puppet way: </li></ul><ul><ul><li>Edit the sudoers file on one server </li></ul></ul><ul><ul><li>Every other server automatically pulls down the updated Puppet file and installs it into the proper location for its distro </li></ul></ul><ul><li>Advantages: </li></ul><ul><ul><li>Easy </li></ul></ul><ul><ul><li>Centralized </li></ul></ul><ul><ul><li>Logged </li></ul></ul>
  12. 12. Case Study 2 : iptables <ul><li>Need to collaborate with outside group </li></ul><ul><li>Must allow them SSH access to internal network </li></ul>
  13. 13. Case Study 2 : iptables <ul><li>The old way: </li></ul><ul><ul><li>Update the iptables rules to allow access from the right ip ranges </li></ul></ul><ul><ul><li>Copy the rules to each machine </li></ul></ul><ul><ul><li>Restart iptables on each machine, and check that the rule worked </li></ul></ul>
  14. 14. Case Study 2 : iptables <ul><li>The Puppet way: </li></ul><ul><ul><li>Update the iptables rule to allow access from the right ip ranges </li></ul></ul><ul><ul><li>Tell Puppet to ensure that the iptables service is running </li></ul></ul><ul><ul><li>Each client machine automatically pulls the updated iptables rule </li></ul></ul><ul><ul><li>Each client intelligently knows that iptables must be restarted after a rule update, and it does this automatically using dependencies </li></ul></ul>
  15. 15. Case Study 3 : Doomsday <ul><li>Centralized web server goes down due to hardware failure </li></ul><ul><li>Must get the website back up quickly </li></ul>
  16. 16. Case Study 3 : Doomsday <ul><li>The old way: </li></ul><ul><ul><li>Multiple sysadmins get stressed out </li></ul></ul><ul><ul><li>Reinstall the server and reconfigure by hand </li></ul></ul><ul><ul><li>Restore Apache configs by hand from tape or other backup (you did backup right?) </li></ul></ul>
  17. 17. Case Study 3 : Doomsday <ul><li>The Puppet way: </li></ul><ul><ul><li>Take any other spare server </li></ul></ul><ul><ul><li>Change the MAC address in DHCP to the new server </li></ul></ul><ul><ul><li>Puppet automatically enforces and deploys the new configuration on the new server </li></ul></ul><ul><ul><li>Installs and updates all necessary configurations, including ensuring that the proper services are running </li></ul></ul>
  18. 18. Why Puppet?
  19. 19. What is Puppet? <ul><li>Puppet is a configuration management utility </li></ul><ul><li>Puppet is not the only configuration management utility </li></ul>
  20. 20. Puppet Competitors <ul><li>cFengine </li></ul><ul><li>Bcfg2 </li></ul><ul><li>Chef </li></ul><ul><li>… ..and the list goes on </li></ul>
  21. 21. Puppet vs cFengine <ul><li>cFengine focuses on managing textfiles </li></ul><ul><li>Puppet focuses on managing constructs like users, services, and packages </li></ul>
  22. 22. Puppet vs cFengine <ul><li>Puppet is model driven </li></ul><ul><ul><li>The lowest layer is responsible for resource modeling </li></ul></ul><ul><ul><li>Eg. User on Solaris vs User on Linux </li></ul></ul><ul><li>The language handles high level relationships </li></ul><ul><ul><li>Think users instead of /etc/passwd </li></ul></ul>
  23. 23. Puppet Language <ul><li>Puppet uses Ruby </li></ul><ul><li>Puppet’s Language is declarative </li></ul><ul><li>You specify the configuration – Puppet handles the implementation </li></ul><ul><ul><li>Must use detailed specification </li></ul></ul><ul><ul><li>Need things like dependencies to get the full power of Puppet </li></ul></ul>
  24. 24. Layers Image: Official Puppet Documentation
  25. 25. How does Puppet work? Image: Official Puppet Documentation
  26. 26. Idempotency <ul><li>Puppet configurations are idempotent – they can safely be run multiple times </li></ul><ul><li>By default, Puppet runs every 30 minutes </li></ul><ul><li>Unlike say --- kickstart --- Puppet can detect the current state of the system </li></ul><ul><li>Won’t make changes unless necessary </li></ul>
  27. 27. Cross Platform Abstraction <ul><li>Puppet doesn’t care about specifics unique to your system </li></ul><ul><li>All handled automatically (facter!) </li></ul><ul><li>Manage users, files, packages, etc. the same way regardless of OS or distro </li></ul>
  28. 28. Providers <ul><li>Providers fulfill resources </li></ul><ul><ul><li>Example: package management </li></ul></ul><ul><ul><li>Both ‘yum’ and ‘apt’ are valid package managers </li></ul></ul><ul><li>Puppet uses ‘providers’ to abstract package management away from the user </li></ul>
  29. 29. Facter <ul><li>How does Puppet know about your system? </li></ul><ul><ul><li>Using the Ruby library Facter </li></ul></ul><ul><ul><li>Facter supports a large number of predefined facts </li></ul></ul><ul><ul><li>Custom facts can be defined </li></ul></ul>-bash-3.2$ facter architecture => x86_64 domain => facterversion => 1.5.7 fqdn => hardwareisa => x86_64 hardwaremodel => x86_64 hostname => example id => jones interfaces => eth0,eth0_kraken_una,eth1 … .and more
  30. 30. Linux <ul><li>Centos </li></ul><ul><li>Debian 3.1 and later </li></ul><ul><li>Fedora Core 2-6 </li></ul><ul><li>Fedora 7 and later </li></ul><ul><li>Gentoo Linux </li></ul><ul><li>Mandriva Corporate Server 4 </li></ul><ul><li>RHEL 3 and Later </li></ul><ul><li>Oracle Linux </li></ul><ul><li>SuSe Linux 8 and later </li></ul><ul><li>Ubuntu 7.04 and later </li></ul>
  31. 31. BSD/*nix/Windows <ul><li>FreeBSD 4.7 and later </li></ul><ul><li>OpenBSD 4.1 and later </li></ul><ul><li>Mac OS X </li></ul><ul><li>Solaris 2.6 </li></ul><ul><li>Solaris 7 and later </li></ul><ul><li>Windows Support (in beta) </li></ul>
  32. 32. Installing Puppet Table credit: Turnbull, Pulling Strings with Puppet
  33. 33. Installing Puppet Table credit: Turnbull, Pulling Strings with Puppet
  34. 34. Installing Puppet Table credit: Turnbull, Pulling Strings with Puppet
  35. 36. Puppet Installation and Configuration
  36. 37. Manual Installation of Puppet Puppet is a client / server based application Puppet clients are often referred to as nodes, clients, or hosts The Puppet server is often referred to as the puppetmaster Not:
  37. 38. Manual Installation of Puppet Currently Reductive Labs offers support for the following operating systems: Linux : CentOS, Debian, Fedora, Gentoo, Mandriva, RHEL, Oracle Linux, SUSE, and Ubuntu BSD : FreeBSD, and OpenBSD Other Unix : Mac OS-X, and Sun Solaris Windows : None currently Source:
  38. 39. Manual Installation of Puppet <ul><li>The Puppet client must be installed on every system – even your Puppetmaster </li></ul><ul><li>Most platforms will use the default package manager to install Puppet </li></ul><ul><li>If you use a package management system (i.e. - yum) you will automatically get most prerequisite libraries </li></ul><ul><li>Facter is not installed by default when using the package manager </li></ul><ul><li>Reductive Labs provides source tar balls in case you want to torture yourself </li></ul>
  39. 40. Installing Puppet on CentOS / RHEL Ensure that your package manager (yum) is configured to communicate with the EPEL repo. # rpm -Uvh # yum repolist Should list epel in the left hand column
  40. 41. Installing Puppet on CentOS / RHEL # yum install -y puppet (installs the client) # yum install -y puppet-server (installs the server) # yum install -y facter # yum install -y ruby-doc (optional if you want –help to work with ruby commands) These installs will also process other dependencies such as ruby and ruby-libs
  41. 42. Configure Puppet on CentOS / RHEL <ul><li>Once yum installation is complete you must configure Puppet </li></ul><ul><li>The /etc/puppet directory will be created after installation </li></ul><ul><li>Create a simple manifest in /etc/puppet/manifests/ called site.pp </li></ul><ul><li>The puppetmaster daemon needs a syntactically correct file to run </li></ul><ul><li>Example: </li></ul><ul><li>node default { </li></ul><ul><li>} </li></ul>
  42. 43. Configure Puppet on CentOS / RHEL <ul><li>The default config file is located at /etc/puppet/puppet.conf </li></ul><ul><li>It is initially created with a basic set of options </li></ul><ul><li>These options control the behavior of the Puppet suite </li></ul>
  43. 44. Configure Puppet on CentOS / RHEL <ul><li>Sample puppet.conf file (to see all values use # puppet –genconfig): </li></ul><ul><li># cat /etc/puppet/puppet.conf </li></ul><ul><li>[main] </li></ul><ul><ul><ul><li>vardir = /var/lib/puppet </li></ul></ul></ul><ul><ul><ul><li>logdir = /var/log/puppet </li></ul></ul></ul><ul><ul><ul><li>rundir = /var/run/puppet </li></ul></ul></ul><ul><ul><ul><li>ssldir = $vardir/ssl </li></ul></ul></ul><ul><ul><ul><li>tagmap = /etc/puppet/tagmail.conf </li></ul></ul></ul><ul><ul><ul><li>reportfrom = </li></ul></ul></ul><ul><ul><ul><li>[puppetd] </li></ul></ul></ul><ul><ul><ul><li>classfile = $vardir/classes.txt </li></ul></ul></ul><ul><ul><ul><li>localconfig = $vardir/localconfig </li></ul></ul></ul><ul><ul><ul><li>report = true </li></ul></ul></ul><ul><ul><ul><li>[puppetmasterd] </li></ul></ul></ul><ul><ul><ul><li>reports = tagmail </li></ul></ul></ul><ul><ul><ul><li>autosign = /etc/puppet/autosign.conf </li></ul></ul></ul>
  44. 45. Configure Puppet on CentOS / RHEL <ul><li>The puppet client config looks for a system named “puppet” </li></ul><ul><li>Add an entry to DNS for the puppet master (recommended) </li></ul><ul><li>puppet IN CNAME puppetmaster </li></ul><ul><li>You could also change the config to point to a specific system (not recommended) </li></ul><ul><li>Start the puppetmaster daemon </li></ul><ul><li># /etc/init.d/puppetmaster start && tail –f /var/log/messages </li></ul><ul><li>Ensure the puppetmaster daemon starts on boot </li></ul><ul><li># /sbin/chkconfig puppetmaster on 2345 </li></ul><ul><li>Basic puppetmaster installation is complete </li></ul>
  45. 46. Configure Puppet on CentOS / RHEL <ul><li>To complete the configuration we must configure the client to run on the puppetmaster </li></ul><ul><li>Manually start the puppet client once to test </li></ul><ul><li># /etc/init.d/puppet once -v </li></ul><ul><li>This will generate a certificate request to the puppetmaster </li></ul><ul><li># puppetca --list (will show the waiting certificate requests) </li></ul><ul><li>Multiple ways to resolve this </li></ul><ul><ul><li>Setup puppetmaster to automatically sign all certificates </li></ul></ul><ul><ul><li>Setup puppetmaster to only sign specific certificates </li></ul></ul><ul><ul><li>Perform manual certificate signing each time </li></ul></ul><ul><li>We use option #2 </li></ul>
  46. 47. Setup Certificate Autosign Option #1 <ul><li>To setup automatic certificate signing you must specify so in the /etc/puppet/autosign.conf file </li></ul><ul><li>An example of autosign.conf file that accepts every new certificate request </li></ul><ul><li># cat /etc/puppet/autosign.conf </li></ul><ul><li>* </li></ul><ul><li>Pro’s – will automatically sign certs, when reinstalling a system the autosign.conf file doesn’t need to be updated </li></ul><ul><li>Con’s – security risk, not good to automate the certificate signing mechanism </li></ul>
  47. 48. Setup Certificate Autosign Option #2 <ul><li>To setup restrictive automatic signing we will use the /etc/puppet/autosign.conf file </li></ul><ul><li>Example autosign.conf file </li></ul><ul><li># cat /etc/puppet/autosign.conf </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li>Pro’s – adds additional control to certificate signing, provides greater security than option #1, is a good balance of security and automation </li></ul><ul><li>Con’s – the autosign.conf file must be kept up to date </li></ul>
  48. 49. Setup Certificate Autosign Option #3 <ul><li>Manual certificate signing doesn’t require the autosign.conf file </li></ul><ul><li>Once the certificate request has been made you should be able to see a list of the waiting requests on the puppetmaster by using: </li></ul><ul><li># puppetca --list </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li>To sign a specific request run the following: </li></ul><ul><li># puppetca --sign </li></ul>
  49. 50. Setup Certificate Autosign Option #3 <ul><li>You may verify the signed cert by running: </li></ul><ul><li># puppetca --list --all </li></ul><ul><li>+ </li></ul><ul><li>The “+” sign denotes a signed certificate </li></ul><ul><li>Pro’s – most secure way to sign certificates </li></ul><ul><li>Con’s – can get cumbersome when scaling your puppet installation </li></ul>
  50. 51. Configure Puppet on CentOS / RHEL <ul><li>After the certificate is accepted you can retest by starting the puppet client </li></ul><ul><li># /etc/init.d/puppet once –v </li></ul><ul><li>In syslog you will see entries similar to the following: </li></ul><ul><li>puppetd[18704]: Starting Puppet client version 0.25.4 </li></ul><ul><li>puppetmasterd[18047]: Compiled catalog for in 0.25 seconds </li></ul><ul><li>puppetd[18704]: Finished catalog run in 2.96 seconds </li></ul><ul><li>Puppet client should start and should finish the catalog run without any errors </li></ul>
  51. 52. Installation is complete! Basic Puppet installation is complete! (seriously, we aren’t joking)
  52. 53. BREAK
  53. 54. Managing Your Infrastructure with Puppet
  54. 55. NICS Puppet Infrastructure /etc/puppet files/ manifests/ modules/ auth.conf autosign.conf fileserver.conf puppet.conf tagmail.conf byhost/ classes/ nodes.pp site.pp host1 / host2 / host3 / class1.pp class2.pp mod1 / manifests/ files/ templates/ init.pp Files Folders Placeholder Names
  55. 56. Sample site.pp <ul><li>There are many ways to configure your Puppet environment </li></ul><ul><li>Here’s one way to setup your /etc/puppet/manifests/site.pp file: </li></ul><ul><li>#site.pp </li></ul><ul><li>import “classes/*.pp” #This will import every .pp #file in the classes directory </li></ul><ul><li>import nodes #This will import the nodes.pp file that #lives in /etc/puppet/manifests </li></ul><ul><li>You can also set enterprise wide environment variables here instead of specifically defining them within each node </li></ul><ul><li>Environment variables can be used in templates </li></ul>
  56. 57. Classes vs. Modules <ul><li>Why use the classes directory and the modules directory? </li></ul><ul><li>Classes are more global and usually contain many different modules </li></ul><ul><li>Modules are the smallest unit of measure that Puppet builds from </li></ul><ul><li>Here are some sample classes that we use: </li></ul><ul><li>badservices.pp, cluster.pp, disable_accounts.pp, diskcheck.pp, homedirs.pp, hpss.pp, infrastructure.pp, ipmi.pp, packages.pp, python_env.pp, rootmail.pp, security.pp, snmp.pp, subversion.pp, yumconfig.pp, yumreposerver.pp </li></ul>
  57. 58. Building Puppet Modules <ul><li>We store all of our modules in /etc/puppet/modules </li></ul><ul><li>This is referenced in our /etc/puppet/puppet.conf file under the puppetmaster section </li></ul><ul><li>Here are some of the modules we have created over time: </li></ul><ul><li>accounts, iptables, named, oncalldb, postfix, rt, syslogng, amie_gold, cron, openssl, postgresql, dhcpd, grid_tools, lustre, moab, networking, otp, psacct, subversion, drupal, nfs, passwd, puppet, sudo, cacti, httpd, mysql, pbstools, splunk, sysctl, console, infiniband, ldap, mailman, nagios, ntp, php, ssh, syslog </li></ul><ul><li>You don’t have to create all of your modules up front </li></ul><ul><li>Work on one application (module) at a time until everything is in Puppet </li></ul>
  58. 59. Building Puppet Modules <ul><li>This method of storing modules separately in /etc/puppet/modules assists in management </li></ul><ul><li>We can store module specific files within the module instead of all together </li></ul><ul><li>If you’re working on a module, you can stay in that module until you are finished and ready to test </li></ul><ul><li>Inside each module, we have two main directories: manifests and files </li></ul><ul><li>The file directory houses the module specific files </li></ul><ul><li>The manifest is where the module’s definition lives (init.pp) </li></ul>
  59. 60. Sample module init.pp <ul><li>Below is a simple example of the named (DNS) class: </li></ul><ul><li>class named { </li></ul><ul><li>package { </li></ul><ul><li>bind: ensure => installed; </li></ul><ul><li>bind-chroot: ensure => installed; </li></ul><ul><li>} </li></ul><ul><li>service { &quot;named&quot;: </li></ul><ul><li>enable => true, </li></ul><ul><li>ensure => running, </li></ul><ul><li>require => [ Package[&quot;bind&quot;], Package[&quot;bind-chroot&quot;] ]; </li></ul><ul><li>} </li></ul><ul><li>file { &quot;/var/named/chroot/etc/rndc.key&quot;: </li></ul><ul><li>path => &quot;/var/named/chroot/etc/rndc.key&quot;, </li></ul><ul><li>source => &quot;puppet:///named/var/named/chroot/etc/rndc.key&quot;, </li></ul><ul><li>require => [ Package[&quot;bind&quot;], Package[&quot;bind-chroot&quot;] ]; </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  60. 61. Module Files <ul><li>What goes in the files directory? </li></ul><ul><li>These files can be anything from configuration files to custom scripts </li></ul><ul><li>Gives the system administrator the ability to control any file </li></ul><ul><li>This doubles as a security measure and as a standardization practice </li></ul><ul><li>We store our files in the same directory structure as the final configuration </li></ul><ul><li>The “puppet” user must be able to read the files </li></ul><ul><li>Simplifies system administration </li></ul>
  61. 62. Sample Infrastructure Class <ul><li>Our infrastructure.pp class uses several different modules </li></ul><ul><li>class infrastructure { </li></ul><ul><li>include puppet </li></ul><ul><li>include yumconfig </li></ul><ul><li>include syslog </li></ul><ul><li>include security </li></ul><ul><li>if $ntp_server { </li></ul><ul><li>include ntp::server </li></ul><ul><li>} else { </li></ul><ul><li>include ntp </li></ul><ul><li>} </li></ul><ul><li>include ldap </li></ul><ul><li>include console </li></ul><ul><li>include badservices </li></ul><ul><li>} </li></ul>
  62. 63. What is a template? <ul><li>Puppet templates are flat files containing Embedded Ruby (ERB) variables </li></ul><ul><li>An example ssh_config template follows: </li></ul><ul><li>Protocol <%= ssh_Protocol %> </li></ul><ul><li><% if ssh_ListenAddress != &quot;&quot; %> </li></ul><ul><li>ListenAddress <%= ssh_ListenAddress %> </li></ul><ul><li><% end -%> </li></ul><ul><li>SyslogFacility <%= ssh_SyslogFacility %> </li></ul><ul><li>RSAAuthentication <%= ssh_RSAAuthentication %> </li></ul><ul><li>PubkeyAuthentication <%= ssh_PubkeyAuthentication %> </li></ul><ul><li>UsePAM <%= ssh_UsePAM %> </li></ul><ul><li>AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY </li></ul><ul><li>AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT </li></ul><ul><li>AcceptEnv LC_IDENTIFICATION LC_ALL </li></ul><ul><li>X11Forwarding <%= ssh_X11Forwarding %> </li></ul><ul><li>NoneEnabled no </li></ul>
  63. 64. ERB variable declaration <ul><li>Ruby ERB variables can be set in different places </li></ul><ul><li>They can be specified in the class that calls them: </li></ul><ul><li>class resolv { </li></ul><ul><li>$searchpath = &quot;; </li></ul><ul><li>$nameservers = [&quot;;, &quot;;] </li></ul><ul><li>file { &quot;resolv.conf&quot;: </li></ul><ul><li>name => &quot;/etc/resolv.conf&quot;, </li></ul><ul><li>content => template(&quot;resolv-template.erb&quot;) </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  64. 65. ERB variable declaration <ul><li>Or you can set them for each node in /etc/puppet/manifests/nodes.pp </li></ul><ul><li>node server1 { </li></ul><ul><li>$searchpath = &quot;; </li></ul><ul><li>$nameservers = [&quot;;, &quot;;] </li></ul><ul><li>include resolv </li></ul><ul><li>} </li></ul><ul><li>node server2 { </li></ul><ul><li>$searchpath = &quot;; </li></ul><ul><li>$nameservers = [&quot;;, &quot;;] </li></ul><ul><li>include resolv </li></ul><ul><li>} </li></ul>
  65. 66. Hands on Exercises <ul><li>Install and configure Puppet client/server </li></ul><ul><li>Create a basic MySQL client module </li></ul><ul><li>Create a basic MySQL server module </li></ul>
  66. 67. Install and Configure Puppet client / server <ul><li>Using the handouts install and configure the Puppetmaster and Puppet client </li></ul><ul><li>These systems are CentOS 5.5 virtual machines </li></ul><ul><li>Login and pw will be given </li></ul>
  67. 68. Create a module <ul><li>Now that we have Puppet up and running, create a MySQL client module using the handout </li></ul><ul><li>Once you have created the MySQL client module, we would then like to work through creating a MySQL server module </li></ul>
  68. 69. Advanced Puppet Topics
  69. 70. Module Dependency <ul><li>Module dependencies can serialize module installation </li></ul><ul><li>Handy when an application needs to have certain files in place before installing the rest </li></ul><ul><li>Puppet runs in a “shotgun” manner </li></ul><ul><li>Different pieces of each class are installed a completely different times </li></ul><ul><li>This is where module dependency comes in </li></ul><ul><li>Example: YUM repositories and application specific installs </li></ul>
  70. 71. Intra-module dependencies <ul><li>Most of the time dependencies are in the context of the same module </li></ul><ul><li>The application must be installed before it is configured </li></ul><ul><li>class rt { </li></ul><ul><li>package {&quot;rt3&quot;: </li></ul><ul><li>ensure => installed, </li></ul><ul><li>} </li></ul><ul><li>file { </li></ul><ul><li>&quot;/etc/rt3/;: </li></ul><ul><li>source => &quot;puppet:///rt/etc/rt3/;, </li></ul><ul><li>ensure => present, </li></ul><ul><li>owner => apache, group => apache, mode => 640, </li></ul><ul><li>require => Package[rt3]; </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  71. 72. Inter-module dependencies <ul><li>The more complex your Puppet environment becomes the greater the need for inter-module dependencies are. </li></ul><ul><li>This is where a specific resource defined in module “A” is dependent on a resource in module “B” </li></ul><ul><li>class rt { </li></ul><ul><li>package { </li></ul><ul><li>&quot;rt3&quot;: </li></ul><ul><li>ensure => installed, </li></ul><ul><li>require => Yumrepo[epel]; </li></ul><ul><li>&quot;mod_fcgid&quot;: </li></ul><ul><li>ensure => installed; </li></ul><ul><li>&quot;perl-Authen-PAM&quot;: </li></ul><ul><li>ensure => installed; </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  72. 73. Module Inheritance <ul><li>Inherit statements do exactly what they sound like they do </li></ul><ul><li>Come in handy when you only need to change something specific for a node or two </li></ul><ul><li>class ntp::verne inherits ntp { </li></ul><ul><li>file { &quot;/etc/sysconfig/ntpd&quot;: </li></ul><ul><li>ensure => file, </li></ul><ul><li>source => &quot;puppet:///verne/etc/sysconfig/ntpd&quot;, </li></ul><ul><li>owner => root, </li></ul><ul><li>group => root, </li></ul><ul><li>mode => 0644, </li></ul><ul><li>notify => [ Service[ntpd], ], </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  73. 74. Optimize your MySQL modules for use with dependencies <ul><li>HINT - The MySQL server module should have an inheritance from the MySQL client module </li></ul>
  74. 75. Proper Cluster Management <ul><li>Clusters should be managed with “classes” not “modules” </li></ul><ul><li>Here’s an example of our /etc/puppet/manifests/cluster.pp </li></ul><ul><li>class cluster { </li></ul><ul><li>include puppet </li></ul><ul><li>include yumconfig </li></ul><ul><li>include syslog </li></ul><ul><li>include sysctl </li></ul><ul><li>include ntp </li></ul><ul><li>include homedirs </li></ul><ul><li>include ldap </li></ul><ul><li>include console </li></ul><ul><li>include psacct </li></ul><ul><li>include security </li></ul><ul><li>} </li></ul>
  75. 76. Proper Cluster Management <ul><li>More recent version of Puppet support ruby regex </li></ul><ul><li>Here’s an example of how to efficiently manage a cluster of 10 </li></ul><ul><li>node /^clusternode[0-9]+/ { </li></ul><ul><li>$disable_ipv6 = False </li></ul><ul><li>include cluster </li></ul><ul><li>include kernel-utils </li></ul><ul><li>boot_kernel { &quot;2.6.18-164.15.1.el5&quot;: } </li></ul><ul><li>} </li></ul><ul><li>To test out your ruby regex use: </li></ul><ul><li> </li></ul>
  76. 77. Questions?? Nick Jones [email_address] Stephen McNally [email_address]