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
68
Automatizando documentação em PHP com Autodocs
erikaheidi
0
29
Building the World: The Story Behind Wolfi
erikaheidi
0
300
Hello Wolfi
erikaheidi
1
590
Container Images for the Cloud Native Era
erikaheidi
1
260
Creating Secure Container Images with apko
erikaheidi
0
380
Criando GitHub Actions em PHP com Minicli
erikaheidi
0
150
Building GitHub Actions in PHP with Minicli
erikaheidi
0
430
10 Code Search Tricks for Open Source
erikaheidi
2
200
Other Decks in Programming
See All in Programming
スキーマ駆動開発による品質とスピードの両立 - 私達は何故、スキーマを書くのか
kentaroutakeda
0
170
大規模UIKitベースアプリへのTCAの段階的導入/gradual-adoption-of-tca-in-a-large-scale-uikit-based-app
takehilo
1
180
⼤規模⾔語モデルの拡張(RAG)が 終わったかも知れない件について
nearme_tech
23
15k
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
340
Random\Randomizer クラスで日常のあれこれを解決しよう! / Random\Randomizer class solves familiar trouble
cocoeyes02
0
250
AWS Application Composerで始める、 サーバーレスなデータ基盤構築 / 20240406-jawsug-hokuriku-shinkansen
kasacchiful
1
260
GitHub Copilotのススメ
marcy731
1
200
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
840
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
170
Blue/Greenデプロイの導入による 運用フローの改善
kudoas
1
380
dbtのドメイン分割による データ基盤の改善とDigdagとの連携
sakama
0
350
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
44
9.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
501
140k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
14
1.5k
Build The Right Thing And Hit Your Dates
maggiecrowley
24
2k
Being A Developer After 40
akosma
57
580k
What's new in Ruby 2.0
geeforr
337
31k
Optimizing for Happiness
mojombo
370
69k
The MySQL Ecosystem @ GitHub 2015
samlambert
243
12k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
659
120k
The Illustrated Children's Guide to Kubernetes
chrisshort
31
46k
Building Your Own Lightsaber
phodgson
99
5.7k
Web development in the modern age
philhawksworth
202
10k
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