Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Vagrant Provisioners in a Nutshell
Search
Erika Heidi
May 16, 2014
Programming
740
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Vagrant Provisioners in a Nutshell
Presented at PhpDay Verona - 16/05/2014
Erika Heidi
May 16, 2014
Transcript
49 slides
None
whoami • Brazilian, living in Amsterdam since 2012 • PHP
<independent> developer and eventually sysadmin • Author of Vagrant Cookbook on LeanPub
What to expect from this talk 1)Quick Vagrant overview 2)Provisioner
Tasting: Ansible, Puppet and Chef 3)Useful Resources 4)What's new
None
Why Vagrant?
“It works on my machine” - every developer, ever.
Why Vagrant? • Reproducible and portable development environment • Enables
easier code collaboration • Backend env tests / benchmark • Automation Tools learning and testing
None
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
DEMO
None
1. Ansible • Tasks, Playbooks, Roles • Tasks are defined
with YAML • 3rd most used • Modules Directory: Ansible Galaxy • Requires installation of Ansible in the Host
1.1 A Task - name: Install Nginx apt: pkg=nginx state=latest
1.1 A Task - name: Install Nginx apt: pkg=nginx state=latest
- name: Install PHP Packages apt: pkg={{ item }} state=latest with_items: - php5-fpm - php5-cli
1.2 A Playbook # playbook.yml --- - hosts: all sudo:
true tasks: - name: Update apt-cache apt: update_cache=yes - name: Install Nginx and php5-fpm apt: pkg={{ item }} state=latest with_items: - nginx - php5-fpm
1.3 A Role . ├── playbook.yml └── roles ├── init
│ └── tasks │ └── main.yml └── nginxphp ├── tasks │ └── main.yml └── templates └── vhost.tpl #playbook.yml --- - hosts: all sudo: true vars: doc_root: /vagrant/web roles: - init - nginxphp
1.4 Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision "ansible"
do |ansible| ansible.playbook = "playbook.yml" end end
None
2. Puppet (puppet-apply) • Resources, Manifests, Modules • Non-sequential execution
order • Custom language based on Ruby • 1st most used • Modules Directory: Puppet Forge
2.1 A Resource package { 'nginx': ensure => 'installed' }
2.1 A Resource package { 'nginx': ensure => 'installed' }
package { ['php5-fpm', 'php5-cli']: ensure => 'installed' }
2.2 A Manifest # manifests/default.pp exec { 'apt-get update': command
=> 'apt-get update' } package { ['nginx', 'php5-fpm']: ensure => 'installed', require => Exec['apt-get update'] }
2.3 A Module . ├── manifests │ └── default.pp └──
modules └── nginxphp ├── manifests │ └── init.pp └── templates └── vhost.erb # manifests/default.pp exec { 'apt-get update': command => 'apt-get update', before => Class['nginxphp'], } class { 'nginxphp': doc_root => '/vagrant/web', }
2.4 Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision :puppet
do |puppet| puppet.module_path = "modules" end end
None
3. Chef (chef_solo) • Resources, Recipes, Cookbooks • Resources defined
with Ruby • 2nd most used, 1st with Ruby devs • Modules Directory: Cookbooks • Complex but very powerful
3.1 A Resource apt_package "nginx" do action :install end
3.1 A Resource apt_package "nginx" do action :install end ["nginx",
"php5-fpm"].each do |p| apt_package p do action :install end end
3.2 A Recipe # cookbooks/main/recipes/default.rb execute "apt-get update" do command
"apt-get update" end ["nginx", "php5-fpm"].each do |p| apt_package p do action :install end end
3.3 A Cookbook . └── cookbooks ├── main │ └──
recipes │ └── default.rb └── nginxphp ├── recipes │ └── default.rb └── templates └── default └── vhost.erb # cookbooks/main/recipes/default.rb execute "apt-get update" do command "apt-get update" end include_recipe 'nginxphp'
3.4 Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision "chef_solo"
do |chef| chef.add_recipe "main" end end
None
Some Cool New Features
None
Vagrant Share Demo
None
Global status and control
Useful Resources
None
None
Vagrant Cookbook Special discount coupon for PhpDay http://bit.ly/vc-phpday
Questions?
https://joind.in/11299
None
6.1 Debugging • Unknown Vagrant error – Use VirtualBox /
Vmware GUI • Unknown Provisioner error – Increase provisioner verbosity • Not working as expected – Login, fix, automate
6.2 NFS Performance • Synchronization has a cost • Symfony
cache/logs – Too much writing operations on disk – We don't need this in our synced folder
None
None
None
More Decks by Erika Heidi
See All by Erika Heidi
FreeCAD 101 Lightning Talk
erikaheidi
0
110
Learning Lab: WordPress
erikaheidi
0
200
Criando Container Runtimes mais Seguras com Wolfi
erikaheidi
0
260
Introducing Chainguard Images for Safer PHP Runtimes
erikaheidi
0
320
Automatizando documentação em PHP com Autodocs
erikaheidi
0
240
Building the World: The Story Behind Wolfi
erikaheidi
0
920
Hello Wolfi
erikaheidi
1
860
Container Images for the Cloud Native Era
erikaheidi
1
510
Creating Secure Container Images with apko
erikaheidi
0
820
Other Decks in Programming
See All in Programming
ビジネスロジックを堅牢に~Scala 3のドメインプリミティブ~
j5ik2o
0
190
React Native에 현대적인 빌드 도구 더하기: Rollipop 구현기
leegeunhyeok
0
180
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
240
SODA - FACT BOOK(JP)
sodainc
1
40k
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
16
9.2k
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
270
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
230
Claude Code ハーネスDeep Dive – 君はどこまで制御する? -
takateeen_knj
6
5.9k
Getting Started with Vibe Coding
miccheng
0
230
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
330
私なりのハーネスエンジニアリング ~独自の言語処理系の開発を通して~
seosoft
0
210
Beyond Chatbots: Agentic UI with Open Standards @W-JAX 2026, München
manfredsteyer
PRO
0
100
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
610
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
370
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
680
Writing Fast Ruby
sferik
630
63k
BBQ
matthewcrist
90
10k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
How to build a perfect <img>
jonoalderson
1
6.2k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
340
Large-scale JavaScript Application Architecture
addyosmani
516
110k