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

Cloud infrastructure from code

Cloud infrastructure from code

Using Puppet to provision infrastructure in Digital Ocean and AWS. Includes examples of existing and upcoming features and using the existing testing tools to validate your infrastructure before creating it.

98234c645fe8c935edc0fec0186d28b8?s=128

Gareth Rushgrove

January 15, 2015
Tweet

Transcript

  1. Cloud infrastructure from code Puppet Labs Gareth Rushgrove Modelling AWS

    infrastructure in Puppet
  2. @garethr

  3. Gareth Rushgrove

  4. Gareth Rushgrove

  5. Gareth Rushgrove

  6. Introduction

  7. Infrastructure with APIs Gareth Rushgrove

  8. Gareth Rushgrove

  9. Lets start with a command line interface Gareth Rushgrove

  10. Gareth Rushgrove

  11. Gareth Rushgrove pearkes/tugboat

  12. » tugboat create new-server --image 9801950 \ --size 66 \

    --region 7 Gareth Rushgrove
  13. » tugboat droplets new-server (ip: 178.62.112.91, status: new, region: 7

    Gareth Rushgrove
  14. Run the create command again Gareth Rushgrove

  15. » tugboat create new-server --image 9801950 \ --size 66 \

    --region 7 Gareth Rushgrove
  16. Do we now have one server or two? Gareth Rushgrove

  17. » tugboat droplets new-server (ip: 178.62.112.91, status: active, region: 7

    new-server (ip: 178.62.17.225, status: new, region: 7, id: Gareth Rushgrove
  18. What if two people run the command at the same

    time? Gareth Rushgrove
  19. Language is important

  20. Imperative Gareth Rushgrove

  21. adjective 1. of the nature of or expressing a command;

    commanding Gareth Rushgrove
  22. Declarative Gareth Rushgrove

  23. adjective 1. serving to declare, make known, or explain Gareth

    Rushgrove
  24. Idempotent Gareth Rushgrove

  25. adjective 1. unchanged when multiplied by itself Gareth Rushgrove

  26. Model Gareth Rushgrove

  27. noun 1. a standard or example for imitation or comparison

    2. a representation to show the construction or appearance of something Gareth Rushgrove
  28. Why Puppet?

  29. Declarative Gareth Rushgrove

  30. Idempotent Gareth Rushgrove

  31. Graphs everywhere Gareth Rushgrove

  32. Familiar Gareth Rushgrove

  33. Tooling Gareth Rushgrove

  34. A simple example

  35. Gareth Rushgrove

  36. garethr/digitalocean Gareth Rushgrove

  37. Describe what we want in Puppet Gareth Rushgrove

  38. Gareth Rushgrove

  39. Apply our model Gareth Rushgrove

  40. » puppet apply manifest/test.pp Gareth Rushgrove

  41. Query our model Gareth Rushgrove

  42. » puppet resource droplet Gareth Rushgrove

  43. » puppet resource droplet Info: Checking if droplet test exists

    droplet { 'test': ensure => 'present', image => '9801950', private_address => '10.131.221.13', public_address => '178.62.17.225', region => 'lon1', } Gareth Rushgrove
  44. Interact with our model Gareth Rushgrove

  45. » puppet resource droplet test ensure=absent Gareth Rushgrove

  46. » puppet resource droplet test ensure=absent Info: Checking if droplet

    test exists Info: Destroying droplet test Notice: /Droplet[test]/ensure: removed Info: Checking if droplet test exists droplet { 'test': ensure => 'absent', } Gareth Rushgrove
  47. Something more interesting Gareth Rushgrove

  48. Gareth Rushgrove

  49. Multiple providers, not just machines

  50. Gareth Rushgrove

  51. Released in November Gareth Rushgrove

  52. puppetlabs/puppetlabs-aws Gareth Rushgrove

  53. Gareth Rushgrove

  54. Networking Gareth Rushgrove

  55. Gareth Rushgrove

  56. Gareth Rushgrove

  57. DNS Gareth Rushgrove

  58. Gareth Rushgrove

  59. Higher level resources Gareth Rushgrove

  60. Gareth Rushgrove

  61. Live demos Fingers crossed

  62. Gareth Rushgrove

  63. Gareth Rushgrove

  64. puppetlabs/gce_compute Gareth Rushgrove

  65. Software development tooling

  66. Editor support Gareth Rushgrove

  67. Unit testing with rspec-puppet Gareth Rushgrove

  68. » be rake spec arbiter should compile into a catalogue

    without dependency cycles should contain exactly 9 Droplet resources web servers should contain Droplet[web1-digitalocean] with region => "lon1" and size => "512mb" should contain Droplet[web2-digitalocean] with region => "lon1" and size => "512mb" should contain Droplet[web3-digitalocean] with region => "lon1" and size => "512mb" application servers should contain Droplet[app1-digitalocean] with region => "lon1" and size => "512mb" should contain Droplet[app2-digitalocean] with region => "lon1" and size => "512mb" should contain Droplet[app3-digitalocean] with region => "lon1" and size => "512mb" should contain Droplet[app4-digitalocean] with region => "lon1" and size => "512mb" database servers should contain Droplet[db1-digitalocean] with region => "lon1" and size => "2048mb" should contain Droplet[db2-digitalocean] with region => "lon1" and size => "2048mb" Finished in 0.26288 seconds 11 examples, 0 failures Gareth Rushgrove
  69. Coding standards and syntax checking Gareth Rushgrove

  70. » be rake lint syntax manifests/site.pp - WARNING: double quoted

    string containing no variables on line 3 ---> syntax:manifests ---> syntax:templates ---> syntax:hiera:yaml Gareth Rushgrove
  71. Conclusions

  72. Not a generic abstraction (Cloud network primitives vary wildly) Gareth

    Rushgrove
  73. Declarative vs Imperative Gareth Rushgrove

  74. Idempotent Gareth Rushgrove

  75. Puppet as a language to manage ALL of your infrastructure

    Gareth Rushgrove
  76. Gareth Rushgrove puppetlabs.com/download-learning-vm

  77. Gareth Rushgrove puppetlabs.com/community/participate

  78. Questions? And thanks for listening