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 Development Environments with Vagrant
Search
Erika Heidi
September 19, 2014
Programming
1
960
Portable Development Environments with Vagrant
As presented at Hackference 2014
Erika Heidi
September 19, 2014
Tweet
Share
More Decks by Erika Heidi
See All by Erika Heidi
Introducing Chainguard Images for Safer PHP Runtimes
erikaheidi
0
26
Automatizando documentação em PHP com Autodocs
erikaheidi
0
29
Building the World: The Story Behind Wolfi
erikaheidi
0
290
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
Site Reliability Engineering for GMO
pyama86
7
1k
見た目から始める生産性向上
ikumatadokoro
7
760
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
340
SwiftUI Performance 不要なViewの再描画と更新を抑える
bigamitiongit
1
160
Git Lint
bkuhlmann
4
750
ゆるい個人開発のススメ
kuroppe1819
10
980
AWS Application Composerで始める、 サーバーレスなデータ基盤構築 / 20240406-jawsug-hokuriku-shinkansen
kasacchiful
1
260
デフォルトにして至高、RubyMineの大好きな所
ruzia
0
190
Netty Chicago Java User Group 2024-04-17
sullis
0
170
코틀린으로 멀티플랫폼 만들기
pangmoo
0
140
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.7k
Behind VS Code Extensions for JavaScript / TypeScript Linnting and Formatting
unvalley
5
870
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
318
37k
Embracing the Ebb and Flow
colly
79
4.1k
Designing with Data
zakiwarfel
95
4.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
321
20k
KATA
mclloyd
14
12k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
220
21k
The Power of CSS Pseudo Elements
geoffreycrofte
59
5k
The Language of Interfaces
destraynor
151
23k
Web Components: a chance to create the future
zenorocha
305
41k
Principles of Awesome APIs and How to Build Them.
keavy
120
16k
Debugging Ruby Performance
tmm1
70
11k
A Tale of Four Properties
chriscoyier
150
22k
Transcript
None
whoami • PHP developer with sysadmin background • Author of
Vagrant Cookbook 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
Automation Tools > Shell Script • Right tool for the
job • Clear language • Powerful built-in features • Provisioning can be reused for deployment
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 ]
1.6 Other Vagrant Features • Managing Multiple VMs • Provisioning
to AWS, Digital Ocean, etc • Vagrant Cloud • Vagrant Share / Connect
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 Hackference 2014 http://bit.ly/vc-hack
Questions?
More Vagrant Resources http://erikaheidi.com/vagrant