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.

Gareth Rushgrove

October 09, 2015
Tweet

More Decks by Gareth Rushgrove

Other Decks in Technology

Transcript

  1. Provisioning Infrastructure
    with Puppet

    Puppet Labs
    Gareth Rushgrove
    Modelling more than hosts

    View full-size slide

  2. Gareth Rushgrove
    @garethr

    View full-size slide

  3. Gareth Rushgrove

    View full-size slide

  4. Introduction

    View full-size slide

  5. Infrastructure with APIs
    Gareth Rushgrove

    View full-size slide

  6. Gareth Rushgrove

    View full-size slide

  7. Lets start with a command
    line interface
    Gareth Rushgrove

    View full-size slide

  8. Gareth Rushgrove

    View full-size slide

  9. Gareth Rushgrove
    pearkes/tugboat

    View full-size slide

  10. » tugboat create new-server --image 9801950 \
    --size 66 \
    --region 7
    Gareth Rushgrove

    View full-size slide

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

    View full-size slide

  12. Run the create
    command again
    Gareth Rushgrove

    View full-size slide

  13. » tugboat create new-server --image 9801950 \
    --size 66 \
    --region 7
    Gareth Rushgrove

    View full-size slide

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

    View full-size slide

  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

    View full-size slide

  16. What if two people run
    the command at the
    same time?
    Gareth Rushgrove

    View full-size slide

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

    View full-size slide

  18. What about credentials
    and access control?
    Gareth Rushgrove

    View full-size slide

  19. Why Puppet for
    Cloud Infrastructure?

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  25. noun
    1. a standard or example for
    imitation or comparison
    2. a representation to show the
    construction or appearance of
    something
    Gareth Rushgrove

    View full-size slide

  26. Infrastructure as code
    allows for code review,
    automated testing,
    continuous integration…
    Gareth Rushgrove

    View full-size slide

  27. If you’re already Familiar
    with the Puppet language
    you don’t need to learn or
    adopt a new tool
    Gareth Rushgrove

    View full-size slide

  28. Puppet already has
    mature Tooling for testing
    and development
    Gareth Rushgrove

    View full-size slide

  29. A Simple Example

    View full-size slide

  30. Gareth Rushgrove

    View full-size slide

  31. garethr/digitalocean
    Gareth Rushgrove

    View full-size slide

  32. Describe what we want
    in Puppet code
    Gareth Rushgrove

    View full-size slide

  33. Gareth Rushgrove

    View full-size slide

  34. Apply our model
    Gareth Rushgrove

    View full-size slide

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

    View full-size slide

  36. Query our model
    Gareth Rushgrove

    View full-size slide

  37. » puppet resource droplet
    Gareth Rushgrove

    View full-size slide

  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

    View full-size slide

  39. Interact with our model
    Gareth Rushgrove

    View full-size slide

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

    View full-size slide

  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

    View full-size slide

  42. Something more
    interesting
    Gareth Rushgrove

    View full-size slide

  43. Gareth Rushgrove

    View full-size slide

  44. Multiple Providers,
    Not Just Machines

    View full-size slide

  45. Gareth Rushgrove

    View full-size slide

  46. Gareth Rushgrove
    puppetlabs/aws

    View full-size slide

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

    View full-size slide

  48. puppetlabs/puppetlabs-aws
    Gareth Rushgrove

    View full-size slide

  49. Gareth Rushgrove

    View full-size slide

  50. Describe your AWS
    network, including VPC
    Gareth Rushgrove

    View full-size slide

  51. Gareth Rushgrove

    View full-size slide

  52. Gareth Rushgrove

    View full-size slide

  53. Model your Route53 DNS
    Gareth Rushgrove

    View full-size slide

  54. Gareth Rushgrove

    View full-size slide

  55. Launch entire autoscaling
    groups and RDS databases
    Gareth Rushgrove

    View full-size slide

  56. Gareth Rushgrove

    View full-size slide

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

    View full-size slide

  58. Gareth Rushgrove

    View full-size slide

  59. Gareth Rushgrove

    View full-size slide

  60. Gareth Rushgrove
    puppetlabs/gce_compute

    View full-size slide

  61. Gareth Rushgrove
    Shoutout
    @ihmccreery

    View full-size slide

  62. Gareth Rushgrove

    View full-size slide

  63. Available in Puppet
    Enterprise 2015.2
    Gareth Rushgrove

    View full-size slide

  64. Gareth Rushgrove

    View full-size slide

  65. » puppet resource vsphere_vm
    Gareth Rushgrove

    View full-size slide

  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

    View full-size slide

  67. Gareth Rushgrove
    puppetlabs/vsphere

    View full-size slide

  68. Gareth Rushgrove
    Shoutout
    @andulla

    View full-size slide

  69. Gareth Rushgrove
    andulla/vsphere_conf

    View full-size slide

  70. Gareth Rushgrove

    View full-size slide

  71. Coming in Puppet
    Enterprise 2015.3
    Gareth Rushgrove

    View full-size slide

  72. Gareth Rushgrove
    puppetlabs/azure

    View full-size slide

  73. Gareth Rushgrove

    View full-size slide

  74. Gareth Rushgrove

    View full-size slide

  75. » puppet resource azure_vm_classic
    Gareth Rushgrove

    View full-size slide

  76. » 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

    View full-size slide

  77. Not Just In
    The Cloud

    View full-size slide

  78. Use the Puppet language
    to manage your network
    devices
    Gareth Rushgrove

    View full-size slide

  79. Gareth Rushgrove

    View full-size slide

  80. Gareth Rushgrove

    View full-size slide

  81. Gareth Rushgrove
    puppetlabs/netdev_stdlib

    View full-size slide

  82. Use Razor to provision on
    bare metal
    Gareth Rushgrove

    View full-size slide

  83. Gareth Rushgrove
    Auto-Discovery, Policy based provisioning

    View full-size slide

  84. Software
    Development
    Tooling

    View full-size slide

  85. Gareth Rushgrove
    Hiera support

    View full-size slide

  86. Gareth Rushgrove
    Create higher level abstractions

    View full-size slide

  87. Editor support
    Gareth Rushgrove

    View full-size slide

  88. » 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

    View full-size slide

  89. Gareth Rushgrove
    Language style guide

    View full-size slide

  90. » 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

    View full-size slide

  91. DEMO
    Fingers crossed everyone

    View full-size slide

  92. Puppet is simple to
    extend to a wide range of
    infrastructure problems
    Gareth Rushgrove

    View full-size slide

  93. Management over time,
    not just fire and forget
    Gareth Rushgrove

    View full-size slide

  94. As with Puppet on
    individual hosts -
    start small
    Gareth Rushgrove

    View full-size slide

  95. Puppet already has
    excellent developer
    Tooling which can be
    used in new ways
    Gareth Rushgrove

    View full-size slide

  96. Puppet is a language and
    a platform to manage ALL
    of your infrastructure
    Gareth Rushgrove

    View full-size slide

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

    View full-size slide

  98. Gareth Rushgrove
    puppetlabs.com/community/participate

    View full-size slide

  99. Test pilots logo
    Gareth Rushgrove

    View full-size slide

  100. Questions?
    And thanks for listening

    View full-size slide