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
Portable Development Environments with Vagrant
Search
Erika Heidi
September 19, 2014
Programming
1
970
Portable Development Environments with Vagrant
As presented at Hackference 2014
Erika Heidi
September 19, 2014
Tweet
Share
More Decks by Erika Heidi
See All by Erika Heidi
Introducing Chainguard Images for Safer PHP Runtimes
erikaheidi
0
80
Automatizando documentação em PHP com Autodocs
erikaheidi
0
35
Building the World: The Story Behind Wolfi
erikaheidi
0
320
Hello Wolfi
erikaheidi
1
600
Container Images for the Cloud Native Era
erikaheidi
1
270
Creating Secure Container Images with apko
erikaheidi
0
390
Criando GitHub Actions em PHP com Minicli
erikaheidi
0
160
Building GitHub Actions in PHP with Minicli
erikaheidi
0
440
10 Code Search Tricks for Open Source
erikaheidi
2
210
Other Decks in Programming
See All in Programming
Embedding it into Ruby code
soutaro
2
360
The test code generator using static analysis and LLM
mikik0
1
210
Next.js App Router
quramy
14
2.3k
Productivity is Messing Around and Having Fun
hollycummins
1
180
WinActorの勉強を継続する方法
tamai_63
0
130
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
1
130
ペパボOpenTelemetry革命
pyama86
2
1.1k
JS RPCを理解する
yusukebe
5
290
freeeのエンジニアが 就活で出そうな コーディングテストを 解説してみる
freee
1
170
哲学史とモデリング
tanakahisateru
2
430
Revisiting the Hotwire Landscape after Turbo 8 @ RailsConf 2024, Detroit
marcoroth
3
610
Powerfully Typed TypeScript
euxn23
4
1.7k
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
36
2.1k
Six Lessons from altMBA
skipperchong
22
3k
We Have a Design System, Now What?
morganepeng
43
6.8k
BBQ
matthewcrist
80
8.8k
YesSQL, Process and Tooling at Scale
rocio
165
13k
In The Pink: A Labor of Love
frogandcode
138
21k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
23
1.7k
Making Projects Easy
brettharned
109
5.5k
Building Your Own Lightsaber
phodgson
100
5.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
A Modern Web Designer's Workflow
chriscoyier
689
190k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Transcript
None
whoami • PHP developer with sysadmin background • Author of
Vagrant Cookbook and phansible.com
What to expect from this talk 1)Vagrant overview 2)Provisioning with
Ansible 3)Useful Resources
Why Vagrant?
None
1.1 Why Vagrant? • Reproducible and portable development environment •
Enables easier code collaboration • Backend env tests / benchmark • Automation Tools learning and testing
None
1.2 Provisioning • Multiple provisioners can be used • Most
common ones: – Puppet – Chef – Ansible – Shell Script
Automation Tools > Shell Script • Right tool for the
job • Clear language • Powerful built-in features • Provisioning can be reused for deployment
1.3 Some Terms • Host / Guest • Provider /
Provisioner • Boxes • Vagrantfile • Synced Folder
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
None
1.5 Commands • up • reload • provision • suspend
• resume • destroy [ --provision ] [ --provision ]
1.6 Other Vagrant Features • Managing Multiple VMs • Provisioning
to AWS, Digital Ocean, etc • Vagrant Cloud • Vagrant Share / Connect
DEMO 1 Vagrant up
None
2.1 Ansible Overview • Simple and Powerful • Tasks defined
with YAML • Sequential Execution • Modules Directory: Ansible Galaxy • Requires installation of Ansible in the Host
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
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
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'], }
2.5 Variables --- - hosts: all sudo: yes vars: web_server:
nginx tasks: - name: Install {{ web_server }} apt: pkg={{ web_server }} state=latest
2.5 Variables - arrays tasks: - name: Install Packages apt:
pkg={{ item }} state=latest with_items: - nginx - php5-fpm - git
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
DEMO 2 Basic Playbook
None
None
Vagrant Cookbook Special discount coupon for Hackference 2014 http://bit.ly/vc-hack
Questions?
More Vagrant Resources http://erikaheidi.com/vagrant