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

Provisioning with Puppet

Provisioning with Puppet

PuppetConf 2015 presentation on how and why to use Puppet to provision infrastructure. Includes examples of AWS, vSphere, GCE, and Azure.

98234c645fe8c935edc0fec0186d28b8?s=128

Gareth Rushgrove

October 09, 2015
Tweet

Transcript

  1. Provisioning Infrastructure with Puppet Puppet Labs Gareth Rushgrove Modelling more

    than hosts
  2. Gareth Rushgrove @garethr

  3. Gareth Rushgrove

  4. Introduction

  5. Infrastructure with APIs Gareth Rushgrove

  6. Gareth Rushgrove

  7. Lets start with a command line interface Gareth Rushgrove

  8. Gareth Rushgrove

  9. Gareth Rushgrove pearkes/tugboat

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

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

    Gareth Rushgrove
  12. Run the create command again Gareth Rushgrove

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

    --region 7 Gareth Rushgrove
  14. Do we now have one droplet or two? Gareth Rushgrove

  15. » 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
  16. What if two people run the command at the same

    time? Gareth Rushgrove
  17. What if someone runs the command with the wrong arguments?

    Gareth Rushgrove
  18. What about credentials and access control? Gareth Rushgrove

  19. Why Puppet for Cloud Infrastructure?

  20. A Declarative approach means describing just what you want Gareth

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

    Rushgrove
  22. Making the execution Idempotent allows for creation and management over

    time Gareth Rushgrove
  23. adjective 1. unchanged when multiplied by itself Gareth Rushgrove

  24. A Model of your infrastructure is useful for different usecases

    Gareth Rushgrove
  25. noun 1. a standard or example for imitation or comparison

    2. a representation to show the construction or appearance of something Gareth Rushgrove
  26. Infrastructure as code allows for code review, automated testing, continuous

    integration… Gareth Rushgrove
  27. If you’re already Familiar with the Puppet language you don’t

    need to learn or adopt a new tool Gareth Rushgrove
  28. Puppet already has mature Tooling for testing and development Gareth

    Rushgrove
  29. A Simple Example

  30. Gareth Rushgrove

  31. garethr/digitalocean Gareth Rushgrove

  32. Describe what we want in Puppet code Gareth Rushgrove

  33. Gareth Rushgrove

  34. Apply our model Gareth Rushgrove

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

  36. Query our model Gareth Rushgrove

  37. » puppet resource droplet Gareth Rushgrove

  38. » 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
  39. Interact with our model Gareth Rushgrove

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

  41. » 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
  42. Something more interesting Gareth Rushgrove

  43. Gareth Rushgrove

  44. Multiple Providers, Not Just Machines

  45. Gareth Rushgrove

  46. Gareth Rushgrove puppetlabs/aws

  47. Open Source. v1.2 released last month. Supported on Puppet Enterprise

    Gareth Rushgrove
  48. puppetlabs/puppetlabs-aws Gareth Rushgrove

  49. Gareth Rushgrove

  50. Describe your AWS network, including VPC Gareth Rushgrove

  51. Gareth Rushgrove

  52. Gareth Rushgrove

  53. Model your Route53 DNS Gareth Rushgrove

  54. Gareth Rushgrove

  55. Launch entire autoscaling groups and RDS databases Gareth Rushgrove

  56. Gareth Rushgrove

  57. Gareth Rushgrove Shoutouts @aharden @vazhnov @rfletcher @bashtoni @claflic @jhoblitt @daveseff

    @pjfoley @petems
  58. Gareth Rushgrove

  59. Gareth Rushgrove

  60. Gareth Rushgrove puppetlabs/gce_compute

  61. Gareth Rushgrove Shoutout @ihmccreery

  62. Gareth Rushgrove

  63. Available in Puppet Enterprise 2015.2 Gareth Rushgrove

  64. Gareth Rushgrove

  65. » puppet resource vsphere_vm Gareth Rushgrove

  66. » puppet resource vsphere_vm Info: Checking if vsphere_vm /dc/vm/eng/sample exists

    vsphere_vm { '/dc/vm/eng/sample': ensure => 'running', cpu_reservation => '0', cpus => '1', guest_os => 'Debian GNU/Linux 6 (64-b instance_uuid => '5018f10a-ec54-0dbc-5537- memory => '1024', memory_reservation => '0', number_ethernet_cards => '1', power_state => 'poweredOn', resource_pool => 'general1', Gareth Rushgrove
  67. Gareth Rushgrove puppetlabs/vsphere

  68. Gareth Rushgrove Shoutout @andulla

  69. Gareth Rushgrove andulla/vsphere_conf

  70. Gareth Rushgrove

  71. Coming in Puppet Enterprise 2015.3 Gareth Rushgrove

  72. Gareth Rushgrove puppetlabs/azure

  73. Gareth Rushgrove

  74. Gareth Rushgrove

  75. None
  76. » puppet resource azure_vm_classic Gareth Rushgrove

  77. » puppet resource azure_vm_classic Info: Checking if azure_vm_classic exists azure_vm_classic

    { 'virtual-machine-name': ensure => 'present', cloud_service => 'cloud-service-uptjy', deployment => 'cloud-service-uptjy', hostname => 'garethr', image => 'b39f27a8b8c64d52b05eac6a62ebad85__Ubun ipaddress => 'xxx.xx.xxx.xx', location => 'West US', media_link => 'http://xxx.blob.core.windows.net/vhds/ disk_2015_08_28_07_49_34_868.vhd', os_type => 'Linux', Gareth Rushgrove
  78. Not Just In The Cloud

  79. Use the Puppet language to manage your network devices Gareth

    Rushgrove
  80. Gareth Rushgrove

  81. Gareth Rushgrove

  82. Gareth Rushgrove puppetlabs/netdev_stdlib

  83. Use Razor to provision on bare metal Gareth Rushgrove

  84. Gareth Rushgrove Auto-Discovery, Policy based provisioning

  85. Software Development Tooling

  86. Gareth Rushgrove Hiera support

  87. Gareth Rushgrove Create higher level abstractions

  88. Editor support Gareth Rushgrove

  89. » 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 Unit testing support
  90. Gareth Rushgrove Language style guide

  91. » 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 Coding standards and syntax
  92. DEMO Fingers crossed everyone

  93. Conclusions

  94. Puppet is simple to extend to a wide range of

    infrastructure problems Gareth Rushgrove
  95. Management over time, not just fire and forget Gareth Rushgrove

  96. As with Puppet on individual hosts - start small Gareth

    Rushgrove
  97. Puppet already has excellent developer Tooling which can be used

    in new ways Gareth Rushgrove
  98. Puppet is a language and a platform to manage ALL

    of your infrastructure Gareth Rushgrove
  99. Gareth Rushgrove puppetlabs.com/download-learning-vm

  100. Gareth Rushgrove puppetlabs.com/community/participate

  101. Test pilots logo Gareth Rushgrove

  102. Questions? And thanks for listening