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 Environments with Vagrant
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Erika Heidi
August 29, 2014
Programming
8
1.8k
Portable Environments with Vagrant
Portable Development Environments with Vagrant (and Ansible) - LaraconEU 2014
Erika Heidi
August 29, 2014
Tweet
Share
More Decks by Erika Heidi
See All by Erika Heidi
FreeCAD 101 Lightning Talk
erikaheidi
0
47
Learning Lab: WordPress
erikaheidi
0
130
Criando Container Runtimes mais Seguras com Wolfi
erikaheidi
0
200
Introducing Chainguard Images for Safer PHP Runtimes
erikaheidi
0
250
Automatizando documentação em PHP com Autodocs
erikaheidi
0
180
Building the World: The Story Behind Wolfi
erikaheidi
0
810
Hello Wolfi
erikaheidi
1
790
Container Images for the Cloud Native Era
erikaheidi
1
440
Creating Secure Container Images with apko
erikaheidi
0
640
Other Decks in Programming
See All in Programming
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
15
2.8k
Railsの気持ちを考えながらコントローラとビューを整頓する/tidying-rails-controllers-and-views-as-rails-think
moro
4
380
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
190
モジュラモノリスにおける境界をGoのinternalパッケージで守る
magavel
0
3.5k
ご飯食べながらエージェントが開発できる。そう、Agentic Engineeringならね。
yokomachi
1
290
CSC307 Lecture 13
javiergs
PRO
0
310
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
180
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
1.9k
15年目のiOSアプリを1から作り直す技術
teakun
1
620
NOT A HOTEL - 建築や人と融合し、自由を創り出すソフトウェア
not_a_hokuts
2
950
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
790
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
520
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
3
360
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Exploring anti-patterns in Rails
aemeredith
2
290
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
200
Building the Perfect Custom Keyboard
takai
2
710
Docker and Python
trallard
47
3.8k
Being A Developer After 40
akosma
91
590k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
470
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
GitHub's CSS Performance
jonrohan
1032
470k
Ruling the World: When Life Gets Gamed
codingconduct
0
170
Designing for Timeless Needs
cassininazir
0
150
Transcript
None
whoami • PHP developer with sysadmin background • Author of
Vagrant Cookbook on LeanPub 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
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 ]
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 Laracon EU 2014 http://bit.ly/vc-laracon
Questions?
More Vagrant Resources http://erikaheidi.com/vagrant Please Rate this Talk! https://joind.in/11689