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
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
Learning Lab: WordPress
erikaheidi
0
35
Criando Container Runtimes mais Seguras com Wolfi
erikaheidi
0
110
Introducing Chainguard Images for Safer PHP Runtimes
erikaheidi
0
140
Automatizando documentação em PHP com Autodocs
erikaheidi
0
110
Building the World: The Story Behind Wolfi
erikaheidi
0
600
Hello Wolfi
erikaheidi
1
680
Container Images for the Cloud Native Era
erikaheidi
1
360
Creating Secure Container Images with apko
erikaheidi
0
500
Criando GitHub Actions em PHP com Minicli
erikaheidi
0
220
Other Decks in Programming
See All in Programming
ASP.NET Core の OpenAPIサポート
h455h1
0
150
Amazon Nova Reelの可能性
hideg
0
240
AWS Lambda functions with C# 用の Dev Container Template を作ってみた件
mappie_kochi
0
210
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
130
HTML/CSS超絶浅い説明
yuki0329
0
200
はてなにおけるfujiwara-wareの活用やecspressoのCI/CD構成 / Fujiwara Tech Conference 2025
cohalz
3
3.1k
Vue.jsでiOSアプリを作る方法
hal_spidernight
0
120
ATDDで素早く安定した デリバリを実現しよう!
tonnsama
1
2.3k
動作確認やテストで漏れがちな観点3選
starfish719
5
710
CloudNativePGがCNCF Sandboxプロジェクトになったぞ! 〜CloudNativePGの仕組みの紹介〜
nnaka2992
0
140
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
250
月刊 競技プログラミングをお仕事に役立てるには
terryu16
1
1.2k
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
328
38k
The Invisible Side of Design
smashingmag
299
50k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
The Power of CSS Pseudo Elements
geoffreycrofte
74
5.4k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Being A Developer After 40
akosma
89
590k
Docker and Python
trallard
43
3.2k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
3k
GraphQLとの向き合い方2022年版
quramy
44
13k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.8k
Six Lessons from altMBA
skipperchong
27
3.6k
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