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
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
Amazon Aurora Serverless v2が意外と高かった話と、AWS Database Migration Serviceの話
satoshi256kbyte
1
110
Escolhendo (ou não) o melhor ORM para o seu projeto
andreiacsilva
1
160
仕様と実装で学ぶOpenTelemetry
drumato
2
1.1k
TypeScript 関数型スタイルでバックエンド開発のリアル
naoya
49
16k
Criando a Woovi em uma semana
daniloab
0
120
Embedding it into Ruby code
soutaro
2
360
Go製Webアプリケーションのエラーとの向き合い方大全、あるいはやっぱりスタックトレース欲しいやん / Kyoto.go #50
utgwkk
6
2k
The Design of Everyday APIs - PyCon 2024
roguelynn
1
210
Productivity is Messing Around and Having Fun
hollycummins
1
180
GoでParserを書く
karupanerura
3
410
戦略的DDDは重いのか? / Is strategic DDD heavy?
pictiny
3
2.1k
otelcol receiver 自作RTA / Pepabo Tech Conference #22 春のSREまつり
arthur1
0
1k
Featured
See All Featured
WebSockets: Embracing the real-time Web
robhawkes
59
7k
Ruby is Unlike a Banana
tanoku
96
10k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
22
1.6k
Unsuck your backbone
ammeep
664
57k
Done Done
chrislema
178
15k
Web Components: a chance to create the future
zenorocha
306
41k
Visualization
eitanlees
137
14k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
12
1.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
For a Future-Friendly Web
brad_frost
172
9k
Building Effective Engineering Teams - LeadDev
addyosmani
33
1.9k
Code Reviewing Like a Champion
maltzj
516
39k
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