Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

whoami ● PHP developer with sysadmin background ● Author of Vagrant Cookbook on LeanPub and phansible.com

Slide 3

Slide 3 text

What to expect from this talk 1)Vagrant overview 2)Provisioning with Ansible 3)Useful Resources

Slide 4

Slide 4 text

Why Vagrant?

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

1.1 Why Vagrant? ● Reproducible and portable development environment ● Enables easier code collaboration ● Backend env tests / benchmark ● Automation Tools learning and testing

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

1.2 Provisioning ● Multiple provisioners can be used ● Most common ones: – Puppet – Chef – Ansible – Shell Script

Slide 9

Slide 9 text

1.3 Some Terms ● Host / Guest ● Provider / Provisioner ● Boxes ● Vagrantfile ● Synced Folder

Slide 10

Slide 10 text

1.4 The simplest thing that does something Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision "shell", inline: "echo Hello World!" end

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

1.5 Commands ● up ● reload ● provision ● suspend ● resume ● destroy [ --provision ] [ --provision ]

Slide 13

Slide 13 text

DEMO 1 Vagrant up

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

2.1 Ansible Overview ● Simple and Powerful ● Tasks defined with YAML ● Sequential Execution ● Modules Directory: Ansible Galaxy ● Requires installation of Ansible in the Host

Slide 16

Slide 16 text

2.2 Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision "ansible" do |ansible| ansible.playbook = "playbook.yml" end end

Slide 17

Slide 17 text

2.3 The Playbook # playbook.yml --- - hosts: all sudo: true tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Nginx apt: pkg=nginx state=latest

Slide 18

Slide 18 text

2.4 Playbook x Manifest (Puppet) #playbook.yml --- - hosts: all sudo: true tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Nginx apt: pkg=nginx state=latest #default.pp exec { 'apt-get update': command => '/usr/bin/apt-get update' } package { 'nginx': ensure => "installed", require => Exec['apt-get update'], }

Slide 19

Slide 19 text

2.5 Variables --- - hosts: all sudo: yes vars: web_server: nginx tasks: - name: Install {{ web_server }} apt: pkg={{ web_server }} state=latest

Slide 20

Slide 20 text

2.5 Variables - arrays tasks: - name: Install Packages apt: pkg={{ item }} state=latest with_items: - nginx - php5-fpm - git

Slide 21

Slide 21 text

2.5 Variables - arrays --- - hosts: all sudo: yes vars: sys_packages: [ 'nginx', 'php5-fpm', 'git' ] tasks: - name: Install Packages apt: pkg={{ item }} state=latest with_items: sys_packages

Slide 22

Slide 22 text

DEMO 2 Basic Playbook

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Vagrant Cookbook Special discount coupon for Laracon EU 2014 http://bit.ly/vc-laracon

Slide 26

Slide 26 text

Questions?

Slide 27

Slide 27 text

More Vagrant Resources http://erikaheidi.com/vagrant Please Rate this Talk! https://joind.in/11689