Slide 1

Slide 1 text

Cloud infrastructure from code Puppet Labs Gareth Rushgrove Modelling AWS infrastructure in Puppet

Slide 2

Slide 2 text

@garethr

Slide 3

Slide 3 text

Gareth Rushgrove

Slide 4

Slide 4 text

Gareth Rushgrove

Slide 5

Slide 5 text

Gareth Rushgrove

Slide 6

Slide 6 text

Introduction

Slide 7

Slide 7 text

Infrastructure with APIs Gareth Rushgrove

Slide 8

Slide 8 text

Gareth Rushgrove

Slide 9

Slide 9 text

Lets start with a command line interface Gareth Rushgrove

Slide 10

Slide 10 text

Gareth Rushgrove

Slide 11

Slide 11 text

Gareth Rushgrove pearkes/tugboat

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

Run the create command again Gareth Rushgrove

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

Do we now have one server or two? Gareth Rushgrove

Slide 17

Slide 17 text

» 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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

Language is important

Slide 20

Slide 20 text

Imperative Gareth Rushgrove

Slide 21

Slide 21 text

adjective 1. of the nature of or expressing a command; commanding Gareth Rushgrove

Slide 22

Slide 22 text

Declarative Gareth Rushgrove

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

Idempotent Gareth Rushgrove

Slide 25

Slide 25 text

adjective 1. unchanged when multiplied by itself Gareth Rushgrove

Slide 26

Slide 26 text

Model Gareth Rushgrove

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

Why Puppet?

Slide 29

Slide 29 text

Declarative Gareth Rushgrove

Slide 30

Slide 30 text

Idempotent Gareth Rushgrove

Slide 31

Slide 31 text

Graphs everywhere Gareth Rushgrove

Slide 32

Slide 32 text

Familiar Gareth Rushgrove

Slide 33

Slide 33 text

Tooling Gareth Rushgrove

Slide 34

Slide 34 text

A simple example

Slide 35

Slide 35 text

Gareth Rushgrove

Slide 36

Slide 36 text

garethr/digitalocean Gareth Rushgrove

Slide 37

Slide 37 text

Describe what we want in Puppet Gareth Rushgrove

Slide 38

Slide 38 text

Gareth Rushgrove

Slide 39

Slide 39 text

Apply our model Gareth Rushgrove

Slide 40

Slide 40 text

» puppet apply manifest/test.pp Gareth Rushgrove

Slide 41

Slide 41 text

Query our model Gareth Rushgrove

Slide 42

Slide 42 text

» puppet resource droplet Gareth Rushgrove

Slide 43

Slide 43 text

» 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

Slide 44

Slide 44 text

Interact with our model Gareth Rushgrove

Slide 45

Slide 45 text

» puppet resource droplet test ensure=absent Gareth Rushgrove

Slide 46

Slide 46 text

» 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

Slide 47

Slide 47 text

Something more interesting Gareth Rushgrove

Slide 48

Slide 48 text

Gareth Rushgrove

Slide 49

Slide 49 text

Multiple providers, not just machines

Slide 50

Slide 50 text

Gareth Rushgrove

Slide 51

Slide 51 text

Released in November Gareth Rushgrove

Slide 52

Slide 52 text

puppetlabs/puppetlabs-aws Gareth Rushgrove

Slide 53

Slide 53 text

Gareth Rushgrove

Slide 54

Slide 54 text

Networking Gareth Rushgrove

Slide 55

Slide 55 text

Gareth Rushgrove

Slide 56

Slide 56 text

Gareth Rushgrove

Slide 57

Slide 57 text

DNS Gareth Rushgrove

Slide 58

Slide 58 text

Gareth Rushgrove

Slide 59

Slide 59 text

Higher level resources Gareth Rushgrove

Slide 60

Slide 60 text

Gareth Rushgrove

Slide 61

Slide 61 text

Live demos Fingers crossed

Slide 62

Slide 62 text

Gareth Rushgrove

Slide 63

Slide 63 text

Gareth Rushgrove

Slide 64

Slide 64 text

puppetlabs/gce_compute Gareth Rushgrove

Slide 65

Slide 65 text

Software development tooling

Slide 66

Slide 66 text

Editor support Gareth Rushgrove

Slide 67

Slide 67 text

Unit testing with rspec-puppet Gareth Rushgrove

Slide 68

Slide 68 text

» 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

Slide 69

Slide 69 text

Coding standards and syntax checking Gareth Rushgrove

Slide 70

Slide 70 text

» 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

Slide 71

Slide 71 text

Conclusions

Slide 72

Slide 72 text

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

Slide 73

Slide 73 text

Declarative vs Imperative Gareth Rushgrove

Slide 74

Slide 74 text

Idempotent Gareth Rushgrove

Slide 75

Slide 75 text

Puppet as a language to manage ALL of your infrastructure Gareth Rushgrove

Slide 76

Slide 76 text

Gareth Rushgrove puppetlabs.com/download-learning-vm

Slide 77

Slide 77 text

Gareth Rushgrove puppetlabs.com/community/participate

Slide 78

Slide 78 text

Questions? And thanks for listening