puppet and aws is easy...?

32
Puppet and AWS is easy …… ? Cara Crawford and Scott Coulton

Upload: puppet

Post on 16-Feb-2017

755 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Puppet and AWS is Easy...?

Puppet and AWS is easy …… ?

Cara Crawford and Scott Coulton

Page 2: Puppet and AWS is Easy...?

Who are we? DevOps/Infrastructure Manager

2  

Cara Crawford •  8 + years development experience •  6 + years operational sysadmin experience •  Extensive experience across website solutions in both datacentre

and cloud solutions across Linux and Windows environments

   

@cara_p

Page 3: Puppet and AWS is Easy...?

Who are we? DevOps Solution Architect

3  

Scott Coulton •  10 + years hosting solutions experience •  Extensive experience in architecture across AWS, Puppet, Linux,

Docker and all things open source Sc

   

   

h#ps://github.com/sco#y-­‐c  h#ps://registry.hub.docker.com/repos/sco#yc/  

h#ps://forge.puppetlabs.com/sco#yc  

@sco#coulton  

Page 4: Puppet and AWS is Easy...?

Who are we?

4  

Healthdirect Australia manages the following healthcare service: •  Healthdirect nurse helpline and health information •  After hours GP helpline •  Pregnancy, Birth and Baby •  Mindhealthconnect •  National Health Service Directory •  My Aged Care •  Video Call Consulting

   

Page 5: Puppet and AWS is Easy...?

What we were trying to solve August 2013

5  

•  Majority of servers located in AWS •  Manual deployments •  Cloning for provisioning •  Inconsistent environments •  No CD •  No CI •  No Infrastructure as code •  No Automated testing •  Very limited automation

   

Deployments would take weeks or months with a high level of developer input onto cloned servers

Page 6: Puppet and AWS is Easy...?

How did we solve it

6  

First Iteration – Nov 2013 •  Basic Combination approach of Boto and Python for AWS scripting •  Basic Opensource Puppet for configuration, server management

Third Iteration – Jan 2015 •  AWS Puppet module with cloud formation •  Advanced puppet coding standards with testing •  Container services and schedulers

Second Iteration – Feb 2014 •  Improvements to scripts •  Additional Puppet coding standards including upgrading to Enterprise •  Heading towards 100% Puppet coverage

Page 7: Puppet and AWS is Easy...?

Our Environment

7  

5 development environments 3 Puppet masters Dynamically controlling the VPC environments they are responsible for Each environment the accesslevel reducing towards Stage and Prod being automated environments

Page 8: Puppet and AWS is Easy...?

So it all looks easy, Right !!!!!

8  

Page 9: Puppet and AWS is Easy...?

What have we learnt ?

9  

A solid foundation -  Development … Where to start ??? -  Unit and acceptance testing frameworks -  CD with Puppet

Deploying to AWS with Puppet -  Tips and tricks

What we are working on now to take Puppet to the next level

Page 10: Puppet and AWS is Easy...?

Development, Where to start ?

10  

Page 11: Puppet and AWS is Easy...?

If you have never written a module start here !!!

11  

h#ps://forge.puppetlabs.com/  

Page 12: Puppet and AWS is Easy...?

Start with a solid development foundation !!!

12  

h#ps://github.com/mitchellh/vagrant  

A  must  have  for  any  Puppet  development    

• Quick  deployments  • A  massive  community    

•  Supports  any  OS  you  do    •  You  can  deploy  a  single  machine  or  100    

•  It  is  as  complex  or  simple  as  you  need  it  to  be    

•  Its  all  Ruby      

Page 13: Puppet and AWS is Easy...?

If you have not developed Vagrant framework , Here are is a good one

13  

h#ps://github.com/adrienthebo/oscar  

Page 14: Puppet and AWS is Easy...?

What we have done with Vagrant

14  

• Re  useable  VagrantFile  with  variables  •  Yaml  box  configuraMon    

• MulM-­‐node  test  environments  with  both  open  source  and  Puppet  Enterprise    

•  Full  Hiera  integraMon      

• We  have  a  full  replicaMon  of  producMon  on  our  laptops      

Page 15: Puppet and AWS is Easy...?

VagrantFile

15  

Page 16: Puppet and AWS is Easy...?

Yaml backend

16  

Page 17: Puppet and AWS is Easy...?

Unit testing is a must !!!

17  

• Picks  up  human  error  

•  Tests  module  dependancies  

•  EssenMal  for  the  CD/CI  process      

Tools for the job h#p://rspec-­‐puppet.com/  

h#ps://github.com/rodjek/rspec-­‐puppet  

Page 18: Puppet and AWS is Easy...?

What do tests look like ?

18  

A  simple  example  

A  complex  example  

execute  the  test  •  rake  spec_prep  &&  rspec  

Page 19: Puppet and AWS is Easy...?

But wait what don't test cover ?

19  

• Package  versions,  If  a  file  exists  etc  

So we need acceptance testing •  This  where  Vagrant  comes  back  in    

Run the module !!!! Puppetlabs  have  a  very  good  framework  for  this  h#ps://github.com/puppetlabs/beaker  

Page 20: Puppet and AWS is Easy...?

So now we have our working modules … How do we integrate them with CD ?

20  

•  r10k  h#ps://github.com/puppetlabs/r10k  is  a  good  place  to  start.  

This  will  give  you  a  great  transport  mechanism  from  source  control  to  the  Puppet  master.  

But what if we are using a CD tool (ie Jenkins etc) ?

Page 21: Puppet and AWS is Easy...?

Puppet code deployment flow

21  

Page 22: Puppet and AWS is Easy...?

So some CD tricks and tips we use

22  

Every  module  has  its  own  repo  

Page 23: Puppet and AWS is Easy...?

So some CD tricks and tips we use

23  

Each  pipeline  runs  different  test  before  it  can  move  to  the  next  

Page 24: Puppet and AWS is Easy...?

AWS Deployment Tools

24  

…  And  because  we  are  not  big  fans  of  JSON  h#ps://github.com/bazaarvoice/cloudformaMon-­‐ruby-­‐dsl  

Page 25: Puppet and AWS is Easy...?

Example of the AWS Puppet module

25  

Page 26: Puppet and AWS is Easy...?

Benefits of the AWS Puppet module

26  

• Anyone  on  the  team  can  develop  a  new  AWS  instance,  elb  etc  • Out  of  the  box  we  have  great  unit  tesMng  coverage  • On  every  Puppet  run  reverts  the  environment  to  the  desired  state  

Number  1  2p  for  AWS  

h#ps://docs.puppetlabs.com/guides/rest_api.html  

The  HTTP  API  

AWS  SQS  +  Puppetlabs  HTTP  API  =  Happy  engineers      

Page 27: Puppet and AWS is Easy...?

27  

What we are working on to take Puppet and AWS to the next level

Page 28: Puppet and AWS is Easy...?

28  

Page 29: Puppet and AWS is Easy...?

29  

require => Class['docker']

docker-compose.yml.erb

Page 30: Puppet and AWS is Easy...?

What we are working on now to take Puppet to the next level

30  

Docker  scheduling  with  Puppet  

Dynamic  Hiera  backend  and  service  discovery  

Page 31: Puppet and AWS is Easy...?

So that was easy right ????

31  

Page 32: Puppet and AWS is Easy...?

Questions http://www.healthdirect.gov.au