Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Vagrant Provisioners in a Nutshell
Search
Erika Heidi
May 16, 2014
Programming
710
1
Share
Vagrant Provisioners in a Nutshell
Presented at PhpDay Verona - 16/05/2014
Erika Heidi
May 16, 2014
More Decks by Erika Heidi
See All by Erika Heidi
FreeCAD 101 Lightning Talk
erikaheidi
0
53
Learning Lab: WordPress
erikaheidi
0
140
Criando Container Runtimes mais Seguras com Wolfi
erikaheidi
0
210
Introducing Chainguard Images for Safer PHP Runtimes
erikaheidi
0
260
Automatizando documentação em PHP com Autodocs
erikaheidi
0
190
Building the World: The Story Behind Wolfi
erikaheidi
0
840
Hello Wolfi
erikaheidi
1
810
Container Images for the Cloud Native Era
erikaheidi
1
460
Creating Secure Container Images with apko
erikaheidi
0
660
Other Decks in Programming
See All in Programming
Oxlintとeslint-plugin-react-hooks 明日から始められそう?
t6adev
0
310
10 Tips of AWS ~Gen AI on AWS~
licux
5
510
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
710
書き換えて学ぶTemporal #fukts
pirosikick
1
320
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
920
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
210
2026年のソフトウェア開発を考える(2026/05版) / Software Engineering Scrum Fest Niigata 2026 Edition
twada
PRO
18
8.4k
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
160
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
180
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.1k
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
130
空間オーディオの活用
objectiveaudio
0
100
Featured
See All Featured
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
110
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
320
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Designing Experiences People Love
moore
143
24k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
300
Measuring & Analyzing Core Web Vitals
bluesmoon
9
820
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
490
Optimising Largest Contentful Paint
csswizardry
37
3.7k
Transcript
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