Code but not as we know it - Infrastructure as code

13,518 views
13,240 views

Published on

An overview on the similarities between ordinary code/practices vs infrastructure as code.

Expect a lot of tools, and links to further exploration.

0 Comments
55 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
13,518
On SlideShare
0
From Embeds
0
Number of Embeds
688
Actions
Shares
0
Downloads
245
Comments
0
Likes
55
Embeds 0
No embeds

No notes for slide

Code but not as we know it - Infrastructure as code

  1. 1. Infrastructure as Code Patrick Debois http://www.tumblr.com/tagged/star-trek-quotesWednesday 17 October 12
  2. 2. Organizer Since 2009 Europe Organizer 2010 First Europe Training 2010 Speaker Monitoring Chapter Technical Reviewer Co-Author Veewee / Sahara / Mccloud Libvirt - Fog Freelance consultant Engineer http://github.com/jedi4ever Blog: http://jedi.be/blog - Twitter: @patrickdebois - #devopsWednesday 17 October 12
  3. 3. http://cfengine.com/ http://ansible.cc/ http://puppetlabs.com/ http://palletops.com/ http://opscode.com/chef/ CONFIGURATION MANAGEMENT SYSTEMSWednesday 17 October 12
  4. 4. Chef & Puppet focused based on my experience http://www.nerdnirvana.org/wp-content/uploads/2010/12/apology-form.jpgWednesday 17 October 12
  5. 5. GIVE ME THE CODE: “LANGUAGE”Wednesday 17 October 12
  6. 6. EXAMPLE SYNTAX Puppet Chef class myapache { package “apache2” package “apache2” service “apache2 do action [:enable , :start] service “apache2”: end ensure => “running”, require => Package[“apache2”] }Wednesday 17 October 12
  7. 7. TERMINOLOGY Java Puppet Chef manifests recipes *.java *.pp *.rb package module cookbookWednesday 17 October 12
  8. 8. TERMINOLOGY (2) Java Puppet Chef parametrized recipes with singleton classes attributes defines, definitions, class classes librariesWednesday 17 October 12
  9. 9. SYNTAX Puppet Chef Limited DSL DSL + full ruby (by design) Extended by Light Weight Definitions Resource Providers / Custom Resource Definitions Providers, Light providers Weight Resource ERB & Custom Providers Libraries LibrariesWednesday 17 October 12
  10. 10. LOOPING CONSTRUCTS Puppet Chef pass array of elements erb template for loops do while , repeat etc. create_resource available through (:type, hash) native rubyWednesday 17 October 12
  11. 11. VARIABLES Puppet Chef special syntax native ruby $bla = “aa” bla = “aa” string interpolation string interpolation $bla_string = “${bla}” bla_string = #{bla}Wednesday 17 October 12
  12. 12. SINGLE CLASS INHERITANCE Puppet Chef override via ‘module override via path’ ‘cookbook’ path +> operator “cookbook” attributeWednesday 17 October 12
  13. 13. PROJECT STRUCTURE Puppet Module Chef Cookbook attributes/ definitions/ files/ files/ libraries/ lib/ metadata.rb README.rdoc providers/ manifests/ README.rdoc templates/ recipes/ resources/ templates/Wednesday 17 October 12
  14. 14. EXECUTION MODEL Puppet Chef Compile catalog (directed graph Top Down execution model) Then ExecuteWednesday 17 October 12
  15. 15. CODE EDITORWednesday 17 October 12
  16. 16. VIM SYNTAX HIGHLIGHTIING https://github.com/rodjek/vim-puppet https://github.com/t9md/vim-chef https://github.com/vim-scripts/Cfengine-version-3-syntaxWednesday 17 October 12
  17. 17. GEPPETTO - ECLIPSE IDE https://github.com/cloudsmith/geppetto http://cloudsmith.github.com/geppetto/Wednesday 17 October 12
  18. 18. WYSIWYG CODING REACTOR8 http://beta.r8network.com/Wednesday 17 October 12
  19. 19. http://redmine.djagios.org/projects/puppet-lexer https://github.com/rodjek/puppet-pygments-lexerWednesday 17 October 12
  20. 20. CODE GENERATIONWednesday 17 October 12
  21. 21. REVERSE ENGINEERING Existing Server -> Manifest/Recipes https://github.com/devstructure/blueprintWednesday 17 October 12
  22. 22. DSL ON TOP OF PUPPET ~GRAILS Note: Not vastly used https://github.com/jnewland/shadow_puppetWednesday 17 October 12
  23. 23. CODING STYLEWednesday 17 October 12
  24. 24. Puppet Chef http://puppet-lint.com/ http://acrmp.github.com/ foodcritic/ • FC001: Use strings in preference to symbols to access node attributes • Must use two-space soft tabs. • FC002: Avoid string interpolation where not required • Must not use literal tab characters. • FC003: Check whether you are running with chef server before using server- specific features • Must not contain trailing white space. • FC004: Use a service resource to start and stop services • Should not exceed an 80 character line width • FC005: Avoid repetition of resource declarations An exception has been made for source  =>  puppet://... lines as • FC006: Mode should be quoted or fully specified when setting file permissions splitting these over multiple lines decreases the readability of the • FC007: Ensure recipe dependencies are reflected in cookbook metadata manifests. • FC008: Generated cookbook metadata needs updating • Should align arrows (=>) within blocks of attributes. • FC009: Resource attribute not recognised • FC010: Invalid search syntax • .... • FC011: Missing README in markdown format • FC012: Use Markdown for README rather than RDoc • • FC013: Use file_cache_path rather than hard-coding tmp paths • https://github.com/ampledata/cookbook-style-guide http://docs.puppetlabs.com/guides/style_guide.htmlWednesday 17 October 12
  25. 25. http://www.slideshare.net/PuppetLabs/modern-module- development-ken-barber-2012-edinburgh-puppet-campWednesday 17 October 12
  26. 26. http://projects.puppetlabs.com/projects/hiera https://github.com/crayfishx/hiera-gpg CODE VS CONFIG (THINK “PROFILES”) http://wiki.opscode.com/display/chef/Data+BagsWednesday 17 October 12
  27. 27. “STOP THE FORK(ING)” https://github.com/jedi4ever/stop-the-forkWednesday 17 October 12
  28. 28. PRE-COMMIT CHECKSWednesday 17 October 12
  29. 29. DEPENDENCY MGMT Git Submodules à la Pom File SubtreeWednesday 17 October 12
  30. 30. UPSTREAM REPOS http://community.opscode.com/ http://forge.puppetlabs.com/Wednesday 17 October 12
  31. 31. Puppet Chef https://github.com/rodjek/ https://github.com/ librarian-puppet applicationsonline/librarian http://berkshelf.com/ site  "http://community.opscode.com/api/v1" cookbook  "ntp" cookbook  "timezone",  "0.0.1" cookbook  "rvm",    :git  =>  "https://github.com/fnichol/chef-­‐rvm",    :ref  =>  "v0.7.1" cookbook  "cloudera",    :path  =>  "vendor/cookbooks/cloudera-­‐cookbook"Wednesday 17 October 12
  32. 32. CHEF METADATAWednesday 17 October 12
  33. 33. Puppet Dependency Graphs http://bitfieldconsulting.com/puppet-dependency-graphsWednesday 17 October 12
  34. 34. http://wham.cloudsmith.comWednesday 17 October 12
  35. 35. DEBUGGINGWednesday 17 October 12
  36. 36. LOGGING WITH DIFFERENT LEVELS Info only, no exception Chef::Log.info(Some  useful  info) Fatal, raising exception Chef::Log.fatal(Something  bad)Wednesday 17 October 12
  37. 37. REPL - STYLE (READ EVAL PRINT) https://github.com/pry/pry http://wiki.opscode.com/display/chef/ShefWednesday 17 October 12
  38. 38. https://github.com/vimeo/simple-black-boxWednesday 17 October 12
  39. 39. DEV ENVIRONMENTWednesday 17 October 12
  40. 40. Virtualbox + (Fusion Soon) http://vagrantup.com/ Virtualbox, Fusion, KVM,Parallels, https://github.com/jedi4ever/veewee/Wednesday 17 October 12
  41. 41. https://github.com/jedi4ever/mccloud/ EC2, KVM, FUSION, HOSTS, Vagrant Vagrant alike EC2 https://github.com/rtyler/blimpyWednesday 17 October 12
  42. 42. UNIT TESTINGWednesday 17 October 12
  43. 43. https://github.com/nistude/cucumber-puppetWednesday 17 October 12
  44. 44. https://github.com/rodjek/rspec-puppet https://github.com/acrmp/chefspec https://github.com/calavera/rspec-chefWednesday 17 October 12
  45. 45. Wednesday 17 October 12
  46. 46. MOCKINGWednesday 17 October 12
  47. 47. https://github.com/customink/fauxhaiWednesday 17 October 12
  48. 48. AUTO-TRIGGER TESTS RUN https://github.com/guard/guard-rspec https://github.com/johnbintz/guard-puppet https://github.com/alister/guard-puppet-lint https://github.com/guard/guard-chefWednesday 17 October 12
  49. 49. http://www.cucumber-chef.org/ EC2+LXC Faster testing via LXC Vagrant+LXC https://github.com/exceedhl/toftWednesday 17 October 12
  50. 50. CI INTEGRATIONWednesday 17 October 12
  51. 51. https://github.com/nicksieger/ci_reporterWednesday 17 October 12
  52. 52. https://github.com/rtyler/vagrant-pluginWednesday 17 October 12
  53. 53. https://travis-ci.org/Wednesday 17 October 12
  54. 54. CROSS OS-TESTING https://github.com/opscode/bento https://github.com/opscode/test-kitchenWednesday 17 October 12
  55. 55. Windows https://github.com/tknerr/bills-kitchenWednesday 17 October 12
  56. 56. INTEGRATION TESTING (ON REAL MACHINE)Wednesday 17 October 12
  57. 57. http://auxesis.github.com/cucumber-nagios/Wednesday 17 October 12
  58. 58. RE-USABLE CUCUMBER STEPS http://www.cucumber-chef.org/ https://github.com/hedgehog/cuken https://github.com/cucumber/arubaWednesday 17 October 12
  59. 59. Validate “inside” the provision-run cycle https://github.com/calavera/minitest-chef-handler https://github.com/jedi4ever/puppet-assertWednesday 17 October 12
  60. 60. PERFORMANCE/METRICSWednesday 17 October 12
  61. 61. https://github.com/rodjek/puppet-profilerWednesday 17 October 12
  62. 62. execution time number of classes https://github.com/krux/puppet-module-graphite-report https://github.com/imeyer/chef-handler-graphite https://github.com/joemiller/puppet-graphite_eventWednesday 17 October 12
  63. 63. TARGETED TESTING IMPACT OF CHANGE https://github.com/jonlives/knife-preflight https://github.com/jedi4ever/puppet-cicWednesday 17 October 12
  64. 64. Infrastructure as Code Patrick Debois http://www.tumblr.com/tagged/star-trek-quotesWednesday 17 October 12
  65. 65. Wednesday 17 October 12
  66. 66. http://foodfightshow.org/Wednesday 17 October 12
  67. 67. Wednesday 17 October 12
  68. 68. http://wiki.opscode.com/display/chef/Whyrun+TestingWednesday 17 October 12
  69. 69. https://github.com/tbatchelli/vmfestWednesday 17 October 12
  70. 70. Wednesday 17 October 12
  71. 71. CACHING - AMI, SNAPSHOTSWednesday 17 October 12
  72. 72. https://github.com/lak/puppet-memcachedWednesday 17 October 12
  73. 73. https://github.com/lak/puppet-static-compilerWednesday 17 October 12
  74. 74. http://puppetlabs.com/blog/what-is-user-experience-in- puppet/Wednesday 17 October 12
  75. 75. AUDITING http://www.fusioninventory.org/ http://www.normation.com/en/solutions/rudderWednesday 17 October 12
  76. 76. http://comodit.github.com/synapse-agent/Wednesday 17 October 12
  77. 77. http://saltstack.org/Wednesday 17 October 12
  78. 78. https://github.com/tobami/littlechefWednesday 17 October 12
  79. 79. https://github.com/dwt/vagrant-hostsWednesday 17 October 12
  80. 80. https://github.com/opscode/omnibusWednesday 17 October 12
  81. 81. https://github.com/puppetlabs/puppet-module-toolWednesday 17 October 12
  82. 82. http://wiki.opscode.com/display/chef/Recipes#Recipes- ExceptionsandLoggingWednesday 17 October 12
  83. 83. http://projects.puppetlabs.com/projects/puppet/wiki/ Anchor_PatternWednesday 17 October 12
  84. 84. VENDORINGWednesday 17 October 12
  85. 85. https://github.com/railsmachine/rumpWednesday 17 October 12
  86. 86. http://www.example42.com/?q=Puppi_A_Puppet_module_for_Deployment_AutomationWednesday 17 October 12
  87. 87. PLUGINSWednesday 17 October 12
  88. 88. http://wiki.opscode.com/display/chef/Knife+PluginsWednesday 17 October 12
  89. 89. FACES http://puppetlabs.com/blog/puppet-faces-what-the-heck-are- faces/Wednesday 17 October 12
  90. 90. TESTINGWednesday 17 October 12
  91. 91. http://rundeck.org/Wednesday 17 October 12
  92. 92. http://www.sonian.com/cloud-monitoring-sensu/Wednesday 17 October 12
  93. 93. http://docs.puppetlabs.com/guides/parameterized_classes.htmlWednesday 17 October 12
  94. 94. INHERITANCEWednesday 17 October 12
  95. 95. NAMESPACINGWednesday 17 October 12
  96. 96. https://github.com/rerun/rerunWednesday 17 October 12
  97. 97. AUTHENTICATIONWednesday 17 October 12
  98. 98. DASHBOARDSWednesday 17 October 12
  99. 99. http://puppetlabs.com/puppet/related-projects/dashboard/Wednesday 17 October 12
  100. 100. http://blog.mornati.net/2012/01/29/kermit-a-webui-for- mcollective/Wednesday 17 October 12
  101. 101. http://www.opscode.com/hosted-chef/Wednesday 17 October 12
  102. 102. http://theforeman.org/Wednesday 17 October 12

×