Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Agile Deployments with Puppet

5,330 views

Published on

Presentation given at by Gary Larizza at Camp Devops in Chicago ( http://www.campdevops.com ) on agile deployments with Puppet.

Learn more about Puppet: www.puppetlabs.com

Subscribe to Gary on Speakerdeck: https://speakerdeck.com/glarizza

Published in: Technology

Agile Deployments with Puppet

  1. 1. Agile Deployments with Puppet Gary Larizza Puppet Labs @glarizzaSaturday, October 22, 2011
  2. 2. http://bit.ly/garydevops Agile Deployments with Puppet Gary Larizza Puppet Labs @glarizzaSaturday, October 22, 2011
  3. 3. DevOps • Culture not tools? • Release Management? • http://slidesha.re/itweapon • http://bit.ly/toolsmatter • http://slidesha.re/devopstoolsSaturday, October 22, 2011
  4. 4. Example of ‘poor deployment’Saturday, October 22, 2011
  5. 5. Saturday, October 22, 2011
  6. 6. Developer OperationsSaturday, October 22, 2011
  7. 7. Developer OperationsSaturday, October 22, 2011
  8. 8. Developer Production OperationsSaturday, October 22, 2011
  9. 9. Developer Production Operations StagingSaturday, October 22, 2011
  10. 10. Developer Production Operations StagingSaturday, October 22, 2011
  11. 11. Developer Production Operations StagingSaturday, October 22, 2011
  12. 12. Developer Production Operations StagingSaturday, October 22, 2011
  13. 13. Developer Production Operations Staging Day(s) Build TimeSaturday, October 22, 2011
  14. 14. Developer Production Operations Staging QA Day(s) Build TimeSaturday, October 22, 2011
  15. 15. Developer Production Operations Staging QA Day(s) Build TimeSaturday, October 22, 2011
  16. 16. Developer Production Operations Staging QA Day(s) Build TimeSaturday, October 22, 2011
  17. 17. Developer Production Operations Staging QA Day(s) Week(s) Build TimeSaturday, October 22, 2011
  18. 18. Developer Production Operations Staging QA Day(s) Week(s) Build TimeSaturday, October 22, 2011
  19. 19. Developer Production UK Operations Staging QA Day(s) Week(s) Build TimeSaturday, October 22, 2011
  20. 20. Developer Production UK Operations Staging QA Day(s) Week(s) Build TimeSaturday, October 22, 2011
  21. 21. Developer Production UK Operations China Staging QA Day(s) Week(s) Build TimeSaturday, October 22, 2011
  22. 22. Developer Production UK Operations China Staging QA Day(s) Week(s) Build TimeSaturday, October 22, 2011
  23. 23. Developer Production UK Operations China Staging QA Canada Day(s) Week(s) Build TimeSaturday, October 22, 2011
  24. 24. Developer Production UK Operations China Staging QA Canada Day(s) Week(s) Build TimeSaturday, October 22, 2011
  25. 25. Developer Production UK Operations China Staging QA Canada Day(s) Week(s) ??? Build TimeSaturday, October 22, 2011
  26. 26. Rampination http://bit.ly/pconfkeynoteSaturday, October 22, 2011
  27. 27. Example of ‘Agile’Saturday, October 22, 2011
  28. 28. Saturday, October 22, 2011
  29. 29. Developer OperationsSaturday, October 22, 2011
  30. 30. Developer Production OperationsSaturday, October 22, 2011
  31. 31. DeveloperConfiguration Production Data OperationsSaturday, October 22, 2011
  32. 32. DeveloperConfiguration Production Data OperationsSaturday, October 22, 2011
  33. 33. DeveloperConfiguration Production Data OperationsSaturday, October 22, 2011
  34. 34. DeveloperConfiguration Production Data OperationsSaturday, October 22, 2011
  35. 35. DeveloperConfiguration Production Data Staging OperationsSaturday, October 22, 2011
  36. 36. DeveloperConfiguration Production Data Staging Operations 10 Minutes Build TimeSaturday, October 22, 2011
  37. 37. DeveloperConfiguration Production Data Staging Operations 10 Minutes Build TimeSaturday, October 22, 2011
  38. 38. DeveloperConfiguration Production Data Staging Operations 10 Minutes Build TimeSaturday, October 22, 2011
  39. 39. DeveloperConfiguration Production Data Staging QA Operations 10 Minutes 1-2 Hours Build TimeSaturday, October 22, 2011
  40. 40. DeveloperConfiguration Production Data Staging QA Operations 10 Minutes 1-2 Hours Build TimeSaturday, October 22, 2011
  41. 41. DeveloperConfiguration Production Data Staging QA Operations 10 Minutes 1-2 Hours Build TimeSaturday, October 22, 2011
  42. 42. Developer Reach DeveloperConfiguration Production Data Staging QA Operations 10 Minutes 1-2 Hours 3 Hours Build TimeSaturday, October 22, 2011
  43. 43. Developer Reach DeveloperConfiguration Production Data Staging QA Operations 10 Minutes 1-2 Hours 3 Hours Build TimeSaturday, October 22, 2011
  44. 44. What can Ops learn from Dev? • Do developers re-write their code at every step? • Version control • Testing frameworks • Expose ‘settings’ through configuration dataSaturday, October 22, 2011
  45. 45. Infrastructure as Code with Puppet • Configured State vs. • Define what needs to be done Running State • Model your ideal state with • Choose your level of simple resources commitmentSaturday, October 22, 2011
  46. 46. Resource Abstraction LayerSaturday, October 22, 2011
  47. 47. Resource Abstraction LayerSaturday, October 22, 2011
  48. 48. Resource Abstraction LayerSaturday, October 22, 2011
  49. 49. Resource Abstraction Layer /usr/bin/yum -y install httpdSaturday, October 22, 2011
  50. 50. Saturday, October 22, 2011
  51. 51. Bare Machine Puppet’s Task Provisioning Maintenance Configure Assigned Base Role InstallSaturday, October 22, 2011
  52. 52. Puppet Resources service { httpd:   ensure  => running,   enable   => true, hasstatus => true,   hasrestart => true, }Saturday, October 22, 2011
  53. 53. Puppet Resources Type service { httpd:   ensure  => running,   enable   => true, hasstatus => true,   hasrestart => true, }Saturday, October 22, 2011
  54. 54. Puppet Resources Type Title service { httpd:   ensure  => running,   enable   => true, hasstatus => true,   hasrestart => true, }Saturday, October 22, 2011
  55. 55. Puppet Resources Type Title service { httpd:   ensure  => running,   enable   => true, hasstatus => true,   hasrestart => true, } AttributesSaturday, October 22, 2011
  56. 56. Facter • Describes aspects of your machine - “facts” • Facts written in Ruby • Nice library of existing facts • Custom facts are easySaturday, October 22, 2011
  57. 57. Facter garys-mbp:$ facter domain => puppetlabs.lan facterversion => 1.5.8 fqdn => garys-mbp.puppetlabs.lan hardwaremodel => x86_64 hostname => garys-mbp kernel => Darwin macosx_buildversion => 10K549 macosx_productname => Mac OS X macosx_productversion => 10.6.8 macosx_productversion_major => 10.6 macosx_productversion_minor => 8 <...>Saturday, October 22, 2011
  58. 58. Custom Fact Facter.add("computername") do computername      confine :kernel => :darwin      setcode(scutil --get ComputerName.chomp) scutil ComputerName endSaturday, October 22, 2011
  59. 59. Custom Fact Facter.add("computername") do computername      confine :kernel => :darwin      setcode(scutil --get ComputerName.chomp) scutil ComputerName endSaturday, October 22, 2011
  60. 60. Custom Fact Fact name Facter.add("computername") do computername      confine :kernel => :darwin      setcode(scutil --get ComputerName.chomp) scutil ComputerName endSaturday, October 22, 2011
  61. 61. Custom Fact Fact name Facter.add("computername") do computername      confine :kernel => :darwin      setcode(scutil --get ComputerName.chomp) scutil ComputerName end Command to ExecuteSaturday, October 22, 2011
  62. 62. Custom Fact Fact name Facter.add("computername") do computername      confine :kernel => :darwin      setcode(scutil --get ComputerName.chomp) scutil ComputerName end Command to ExecuteSaturday, October 22, 2011
  63. 63. Custom Fact ENV.each do |key,val| Facter.add("env_#{key}") do    setcode do val end end endSaturday, October 22, 2011
  64. 64. Separate Data from Logic • Configuration Data adapts to environment • Easy deployment - Puppet modules do not change • Eliminate SSH access for deploymentSaturday, October 22, 2011
  65. 65. Data Separation ExamplesSaturday, October 22, 2011
  66. 66. Node Inheritance node common { $dnsserver = 8.8.8.8 $searchdomain = puppetlabs.vm } node devops inherits common { $dnsserver = 10.13.1.3 } node agent.puppetlabs.vm inherits devops { file { /etc/resolv.conf: content => "search ${searchdomain}n nameserver ${dnsserver}n", } }Saturday, October 22, 2011
  67. 67. Data Class in Module class dns::params { $dnsserver = 8.8.8.8 $searchdomain = puppetlabs.vm } class dns( $dnsserver = $dns::params::dnsserver, $searchdomain = $dns::params::searchdomain ) inherits dns::params { file { /etc/resolv.conf: content => "search ${searchdomain}n nameserver ${dnsserver}n", } }Saturday, October 22, 2011
  68. 68. Extlookup common.csv devops.csv dnsserver, 8.8.8.8 dnsserver, 10.13.1.2 searchdomain, puppetlabs.vm $extlookup_datadir = "/etc/puppetlabs/puppet/data" $extlookup_precedence = [$clientcert, $environment, $architecture, common] node agent.puppetlabs.vm { include dns } class dns { $dnsserver = extlookup(dnsserver) $searchdomain = extlookup(searchdomain) }Saturday, October 22, 2011
  69. 69. External Node Classifier --- classes: - dns parameters: searchdomain : ‘puppetlabs.vm’ dnsserver : ‘10.13.1.2’Saturday, October 22, 2011
  70. 70. Hiera • Hierarchal data lookup system • Structured data backend • YAML, JSON, and current Puppet state • http://bit.ly/hieradataSaturday, October 22, 2011
  71. 71. Saturday, October 22, 2011
  72. 72. Global DefaultsSaturday, October 22, 2011
  73. 73. Global Defaults EnvironmentSaturday, October 22, 2011
  74. 74. Global Defaults Environment RoleSaturday, October 22, 2011
  75. 75. Global Defaults Environment RoleSaturday, October 22, 2011
  76. 76. Global Defaults Environment RoleSaturday, October 22, 2011
  77. 77. Global Defaults Environment Role Resultant Data ConfigurationSaturday, October 22, 2011
  78. 78. Saturday, October 22, 2011
  79. 79. Global DefaultsSaturday, October 22, 2011
  80. 80. Global Defaults --- ntpserver: time.puppetlabs.com puppetserver: puppet.puppetlabs.com environment: productionSaturday, October 22, 2011
  81. 81. Global Defaults --- ntpserver: time.puppetlabs.com puppetserver: puppet.puppetlabs.com environment: productionSaturday, October 22, 2011
  82. 82. Global Defaults Environment --- ntpserver: time.puppetlabs.com puppetserver: puppet.puppetlabs.com environment: productionSaturday, October 22, 2011
  83. 83. Global Defaults Environment --- --- ntpserver: time.puppetlabs.com stompserver: stomp-qa.puppetlabs.com puppetserver: puppet.puppetlabs.com environment: production puppetserver: puppet-qa.puppetlabs.com environment: qaSaturday, October 22, 2011
  84. 84. Global Defaults Environment --- ntpserver: time.puppetlabs.com puppetserver: puppet-qa.puppetlabs.com environment: qa stompserver: stomp-qa.puppetlabs.comSaturday, October 22, 2011
  85. 85. Global Defaults Environment Role --- ntpserver: time.puppetlabs.com puppetserver: puppet-qa.puppetlabs.com environment: qa stompserver: stomp-qa.puppetlabs.comSaturday, October 22, 2011
  86. 86. Global Defaults Environment Role --- --- ntpserver: time.puppetlabs.com storeconfigs: true puppetserver: puppet-qa.puppetlabs.com environment: qa stompserver: stomp-qa.puppetlabs.comSaturday, October 22, 2011
  87. 87. Global Defaults Environment Role --- ntpserver: time.puppetlabs.com puppetserver: puppet-qa.puppetlabs.com environment: qa stompserver: stomp-qa.puppetlabs.com storeconfigs: trueSaturday, October 22, 2011
  88. 88. DEMO TIMESaturday, October 22, 2011
  89. 89. Devops Survey • http://bit.ly/devopssurveySaturday, October 22, 2011
  90. 90. Code is online https://github.com/glarizza/puppet-datademoSaturday, October 22, 2011
  91. 91. Gary Larizza • Twitter: @glarizza • Email: gary@puppetlabs.com • Web: http://www.puppetlabs.comSaturday, October 22, 2011

×