Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 whoami

Slide 3

Slide 3 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Back to 2006...

Slide 4

Slide 4 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 PHP Development Environments

Slide 5

Slide 5 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Sharing the Project

Slide 6

Slide 6 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Deployment

Slide 7

Slide 7 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Hosting

Slide 8

Slide 8 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Now back to 2015...

Slide 9

Slide 9 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 What a time to be alive!

Slide 10

Slide 10 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 But, still... “It works on my machine”

Slide 11

Slide 11 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 What if I told you...

Slide 12

Slide 12 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 What if I told you... There's a way to make your development process more consistent, while also smoothing the transition from dev to prod?

Slide 13

Slide 13 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Presenting: D.R.I.V.E ● Disposable ● Replicable ● Isolated ● Versioned ● Environment

Slide 14

Slide 14 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Presenting: D.R.I.V.E ● Disposable ● Replicable ● Isolated ● Versioned ● Environment

Slide 15

Slide 15 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 D.R.I.V.E Disposable & Isolated Replicable & Versioned

Slide 16

Slide 16 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 D.R.I.V.E Disposable & Isolated ● Virtual Machines, Containers Replicable & Versioned

Slide 17

Slide 17 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 D.R.I.V.E Disposable & Isolated ● Virtual Machines, Containers – VirtualBox, VMWare, KVM, etc – Docker Replicable & Versioned

Slide 18

Slide 18 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 D.R.I.V.E Disposable & Isolated ● Virtual Machines, Containers – VirtualBox, VMWare, KVM, etc – Docker Replicable & Versioned ● Configuration Management

Slide 19

Slide 19 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 D.R.I.V.E Disposable & Isolated ● Virtual Machines, Containers – VirtualBox, VMWare, KVM, etc – Docker Replicable & Versioned ● Configuration Management – Ansible, Puppet, Chef, Salt, etc

Slide 20

Slide 20 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 VAGRANT

Slide 21

Slide 21 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Vagrant ● Virtual Machines + Configuration Management ● Easy DRIVE for DEV ● Made Conf. Management popular with developers – And we nailed it!

Slide 22

Slide 22 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Otto?

Slide 23

Slide 23 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Otto? "Otto is very young and while we tout it as a successor to Vagrant, it'll take time to reach the maturity level that Vagrant is already at. We don't recommend dropping Vagrant today, but look to Otto for the future.."

Slide 24

Slide 24 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 How Vagrant Works

Slide 25

Slide 25 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 The Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64" config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.synced_folder "/vagrant", "." config.vm.provision "shell", inline: "echo hello" end

Slide 26

Slide 26 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 This whole provisioning thing...

Slide 27

Slide 27 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 ANSIBLE

Slide 28

Slide 28 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Ansible ● Simple and straightforward language (YAML) ● Agentless Architecture ● Huge collection of built-in modules ● Great community, very popular on Github - 13k+ stars and almost 4k forks

Slide 29

Slide 29 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Playbook Example --- - hosts: all sudo: true tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Nginx apt: pkg=nginx state=latest

Slide 30

Slide 30 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Playbook Resources ● Variables ● Loops ● Conditionals ● Templates ● Ansible Vault

Slide 31

Slide 31 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 LET'S DRIVE?

Slide 32

Slide 32 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Vagrantfile #Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64" config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.provision "ansible" do |ansible| ansible.playbook = "demo.yml" end end

Slide 33

Slide 33 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Playbook --- - hosts: all sudo: true vars: packages: ["nginx", "php5-fpm"] tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Packages apt: pkg={{ item }} state=latest with_items: packages - name: Change Nginx Vhost File template: src=default.tpl dest=/etc/nginx/sites-available/default notify: restart nginx handlers: - name: restart nginx service: name=nginx enabled=yes state=restarted

Slide 34

Slide 34 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 DEMO

Slide 35

Slide 35 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 when this baby hits 88 mph...

Slide 36

Slide 36 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 TIPS&TRICKS

Slide 37

Slide 37 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 1. Roles . ├── playbook.yml └── roles ├── init │ └── tasks │ └── main.yml └── webserver ├── handlers │ └── main.yml ├── tasks │ └── main.yml └── templates └── vhost.tpl #playbook.yml --- - hosts: all sudo: true vars: doc_root: /vagrant/web roles: - init - webserver

Slide 38

Slide 38 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 2. Phansible

Slide 39

Slide 39 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 2. Phansible . ├── ansible │ ├── inventories │ │ └── dev │ ├── playbook.yml │ ├── roles │ │ ├── app │ │ ├── mysql │ │ ├── nginx │ │ ├── php │ │ ├── server │ │ └── vagrant_local │ └── vars │ └── all.yml └── Vagrantfile

Slide 40

Slide 40 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 2. Phansible . ├── ansible │ ├── inventories │ │ └── dev │ ├── playbook.yml │ ├── roles │ │ ├── app │ │ ├── mysql │ │ ├── nginx │ │ ├── php │ │ ├── server │ │ └── vagrant_local │ └── vars │ └── all.yml └── Vagrantfile #inventories/dev [phansible-web] 192.168.33.10

Slide 41

Slide 41 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 3. group_vars . ├── ansible │ ├── inventories │ │ ├── dev │ │ ├── test │ │ └── prod │ ├── group_vars │ │ ├── all.yml │ │ ├── web-dev.yml │ │ ├── web-prod.yml │ │ └── web-test.yml │ ├── playbook.yml │ ├── roles │ └── windows.sh └── Vagrantfile

Slide 42

Slide 42 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 3. group_vars . ├── ansible │ ├── inventories │ │ ├── dev │ │ ├── test │ │ └── prod │ ├── group_vars │ │ ├── all.yml │ │ ├── web-dev.yml │ │ ├── web-prod.yml │ │ └── web-test.yml │ ├── playbook.yml │ ├── roles │ └── windows.sh └── Vagrantfile #inventories/prod [web-prod] myapp.io

Slide 43

Slide 43 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 3. group_vars . ├── ansible │ ├── inventories │ │ ├── dev │ │ ├── test │ │ └── prod │ ├── group_vars │ │ ├── all.yml │ │ ├── web-dev.yml │ │ ├── web-prod.yml │ │ └── web-test.yml │ ├── playbook.yml │ ├── roles │ └── windows.sh └── Vagrantfile #group_vars/web-prod.yml project_root: /var/www doc_root: /var/www/web sys_packages: ["vim","fail2ban"] #inventories/prod [web-prod] myapp.io

Slide 44

Slide 44 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 3. group_vars . ├── ansible │ ├── inventories │ │ ├── dev │ │ ├── test │ │ └── prod │ ├── group_vars │ │ ├── all.yml │ │ ├── web-dev.yml │ │ ├── web-prod.yml │ │ └── web-test.yml │ ├── playbook.yml │ ├── roles │ └── windows.sh └── Vagrantfile #group_vars/web-prod.yml project_root: /var/www doc_root: /var/www/web sys_packages: ["vim","fail2ban"] #inventories/prod [web-prod] myapp.io bit.ly/multistage

Slide 45

Slide 45 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 4. ansible-vault $ ansible-vault encrypt group_vars/web-prod.yml twitter: app_token: MYSUPERTOKEN app_secret: MYSUPERSECRET otherthing: secret_thing: SECRET secret_other: TOPSECRET $ANSIBLE_VAULT;1.1;AES256 39356166303165393330613634373636 61343834313564386262323234303063 3539656138633837 32353631303265623232306338303266 65306531633835630a36306133306539 3835356331343862 32346132653432623766366161333334 66393964396261303637313335646463 before after

Slide 46

Slide 46 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 4. ansible-vault $ ansible-playbook (…) --ask-vault-pass $ ansible-vault view path/to/varfile.yml $ ansible-vault edit path/to/varfile.yml

Slide 47

Slide 47 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015

Slide 48

Slide 48 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Vagrant Cookbook leanpub.com/vagrantcookbook/c/phpworld

Slide 49

Slide 49 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 QUESTIONS?

Slide 50

Slide 50 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 Please rate the talks you attend!

Slide 51

Slide 51 text

DRIVE with Vagrant and Ansible @erikaheidi / PHP[world] 2015 THANKS!