Continuous SUT deployment
Provisioning with Vagrant & Puppet @ Elmar
Slide 2
Slide 2 text
No content
Slide 3
Slide 3 text
We take
testing
seriously
Slide 4
Slide 4 text
Tools
Slide 5
Slide 5 text
No content
Slide 6
Slide 6 text
Problems
Slide 7
Slide 7 text
Problems with SUT deployment
Slide 8
Slide 8 text
Puppet failure
Slide 9
Slide 9 text
Even
worse
Slide 10
Slide 10 text
Our complete
infrastructure depends on
Puppet
Slide 11
Slide 11 text
Puppet is like a
programming language
Slide 12
Slide 12 text
Code breaks, so let's test
it before it's deployed!
Slide 13
Slide 13 text
How to test Puppet code?
Slide 14
Slide 14 text
puppet --noop is not enough!
Slide 15
Slide 15 text
Isolate your test subjects
Slide 16
Slide 16 text
Split up Puppet code into modules
Slide 17
Slide 17 text
Puppet module internal structure
Collection of resources, classes, files, definitions and templates
Slide 18
Slide 18 text
Why you should care about modules
● Easily reusable and re-distributable
● Benefit from existing modules (Puppet Forge)
● Testability
Slide 19
Slide 19 text
Puppet modules @ Elmar
Slide 20
Slide 20 text
So now our Puppet code
relies in isolated units.
Can we unit test it?
Slide 21
Slide 21 text
Cucumber
puppet
Slide 22
Slide 22 text
Unit testing Puppet like a pro (1)
Initial setup of cucumber-puppet
1. gem install cucumber-puppet
2. cd ~/my_puppet_project
3. cucumber-puppet-gen world
Slide 23
Slide 23 text
Unit testing Puppet like a pro (2)
Creating your high level language test
1. cucumber-puppet-gen debian_apt.feature
2. vim debian_apt.feature
Slide 24
Slide 24 text
Unit testing Puppet like a pro (3)
Creating the cucumber step definition
Generated by
cucumber-puppet
Slide 25
Slide 25 text
Unit testing Puppet like a pro (4)
Cucumber-puppet debian_apt.feat
Slide 26
Slide 26 text
So we're sure our Puppet code
works...
Slide 27
Slide 27 text
...things can still go wrong,
though
Slide 28
Slide 28 text
No content
Slide 29
Slide 29 text
No content
Slide 30
Slide 30 text
Wouldn't it be nice if we get rid
of puppet master?
Slide 31
Slide 31 text
No content
Slide 32
Slide 32 text
Why I love Vagrant and you
should too
Slide 33
Slide 33 text
Vagrant supports provisioning VMs
Slide 34
Slide 34 text
Provisioning: Taking a server
from bare metal to setting up
the services to be provided
Slide 35
Slide 35 text
Vagrant
provisioners
OOTB
● Chef Solo
● Chef Server
● Puppet
● Puppet Server
● Shell
Slide 36
Slide 36 text
Vagrant configuration
Slide 37
Slide 37 text
Now dance for
me puppets,
dance!
● vagrant up
● vagrant reload
○ Reboots the VM
● vagrant provision
○ Runs puppet!
Slide 38
Slide 38 text
Introducing: Vagrant plugin for Jenkins
Slide 39
Slide 39 text
Vagrant destroys my VM after
the job has finished...
Slide 40
Slide 40 text
...how can I see the
(erroneous) state of my VM
after the run?
Slide 41
Slide 41 text
No content
Slide 42
Slide 42 text
Gem install vagrant-snap
● snap take
● snap back
● snap go
Slide 43
Slide 43 text
We can restore a VM's state to
troubleshoot on problems
Slide 44
Slide 44 text
Enables devops to 'snap back'
to a base version of the VM
while making Puppet changes