Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Portable Environments with Vagrant
Search
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
31
Learning Lab: WordPress
erikaheidi
0
100
Criando Container Runtimes mais Seguras com Wolfi
erikaheidi
0
170
Introducing Chainguard Images for Safer PHP Runtimes
erikaheidi
0
220
Automatizando documentação em PHP com Autodocs
erikaheidi
0
160
Building the World: The Story Behind Wolfi
erikaheidi
0
780
Hello Wolfi
erikaheidi
1
770
Container Images for the Cloud Native Era
erikaheidi
1
420
Creating Secure Container Images with apko
erikaheidi
0
610
Other Decks in Programming
See All in Programming
開発に寄りそう自動テストの実現
goyoki
1
300
レイトレZ世代に捧ぐ、今からレイトレを始めるための小径
ichi_raven
0
490
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
560
AI時代もSEOを頑張っている話
shirahama_x
0
230
モダンJSフレームワークのビルドプロセス 〜なぜReactは503行、Svelteは12行なのか〜
fuuki12
0
190
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
140
Microservices rules: What good looks like
cer
PRO
0
530
All(?) About Point Sets
hole
0
260
dotfiles 式年遷宮 令和最新版
masawada
1
670
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
300
CSC305 Lecture 15
javiergs
PRO
0
240
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
6
1.3k
Featured
See All Featured
Facilitating Awesome Meetings
lara
57
6.7k
Designing for Performance
lara
610
69k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Optimizing for Happiness
mojombo
379
70k
We Have a Design System, Now What?
morganepeng
54
7.9k
Raft: Consensus for Rubyists
vanstee
140
7.2k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
The Cost Of JavaScript in 2023
addyosmani
55
9.3k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
It's Worth the Effort
3n
187
29k
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