Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

whoami ● @erikaheidi ● Brazilian, living in Amsterdam since 2012 ● PHP developer, eventually sysadmin ● Using vagrant for about 1 year

Slide 3

Slide 3 text

What to expect from this talk ● Introduction to Vagrant ● Provisioner Tasting: Ansible, Puppet and Chef ● Vagrant usage research – results

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

“It works on my machine” - every developer, ever

Slide 6

Slide 6 text

1. Why Vagrant ● Reproducible and portable dev environment ● Enables easier code collaboration ● Backend env tests / benchmark ● Automation Tools learning and testing

Slide 7

Slide 7 text

2. How it Works ● Vagrant manages vms using a Virtualization software like VirtualBox ● Beyond that, it runs a provisioner to setup the vm environment ● You just need to run vagrant up

Slide 8

Slide 8 text

3. What you need (basic) ● Vagrant [1.4.x] ● VirtualBox [4.3.x]

Slide 9

Slide 9 text

4. The Vagrantfile ● Where you define the vagrant project settings Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.provision "shell", inline: "echo hello, this is a simple Shell Provisioner!" end

Slide 10

Slide 10 text

4.1 Defining the Box # this is the simplest thing that does something Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.box_url = "http://files.vagrantup.com/precise64.box" end

Slide 11

Slide 11 text

4.2 Defining the Network Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.box_url = " http://files.vagrantup.com/precise64.box" config.vm.network :private_network, ip: "192.168.33.101" end

Slide 12

Slide 12 text

4.3 Defining a Provisioner Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.network :private_network, ip: "192.168.33.101" config.vm.provision "shell", inline: "echo hello, this is a simple Shell Provisioner!" end

Slide 13

Slide 13 text

4.4 Shared Folder Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.provision "shell", inline: "echo hello, this is a simple Shell Provisioner!" config.vm.synced_folder "./app", "/vagrant" end

Slide 14

Slide 14 text

Output

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

5.1 Ansible Syntax YAML Scripts Playbooks Execution Order Sequential Modularity Many built-in modules Popularity Quite new, community is growing fast Documentation Clear, objective Note: requires installation of extra package (ansible).

Slide 18

Slide 18 text

5.1 Ansible: playbook #simple playbook example --- - hosts: all sudo: true Tasks: - name: Update apt apt: update_cache=yes - name: Install Nginx apt: pkg=nginx state=latest

Slide 19

Slide 19 text

5.1 Ansible: Output

Slide 20

Slide 20 text

5.2 Puppet (puppet-apply) Syntax Custom based on Ruby Scripts Manifests Execution Order NOT Sequential Modularity Very easy to find modules on internet Popularity Very popular, with a large community Documentation A bit confusing

Slide 21

Slide 21 text

5.2 Puppet: manifest #manifests/default.pp Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] } exec { 'apt-get update': command => 'apt-get update', } package { 'nginx': ensure => "installed", require => Exec['apt-get update'], }

Slide 22

Slide 22 text

5.2 Puppet: output

Slide 23

Slide 23 text

5.3 Chef (chef_solo) Syntax Ruby Scripts Recipes Execution Order Sequential Modularity Many “cookbooks” available on internet Popularity Popular, big community Documentation Chaos!

Slide 24

Slide 24 text

5.3 Chef: recipe #cookbooks/nginx/recipes/default.rb execute "apt-get update" do command "apt-get update" end apt_package "nginx" do action :install end

Slide 25

Slide 25 text

5.3 Chef: output

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

MORE RESOURCES

Slide 32

Slide 32 text

Quickly getting started ● Sandbox-PHP – Ansible, Puppet and Chef provisionings – https://github.com/vagrantee/sandbox-php ● PuPHPet – Web interface, creates a Puppet provisioning – https://puphpet.com/

Slide 33

Slide 33 text

Vagrant Cookbook ● A practical e-book about Vagrant and its most popular provisioners ● Link: https://leanpub.com/vagr antcookbook

Slide 34

Slide 34 text

Summary ● Vagrant – is awesome ● Provisioners – Each one has pros and cons... it's up to you ● Vagrant research – In first hand!

Slide 35

Slide 35 text

QUESTIONS

Slide 36

Slide 36 text

erikaheidi.com/vagrant