works Configuration 3 Provisioning Ways to provision Cookbooks Berkshelf 4 Interesting links Vagrant auto generators Guillermo Guerrero Ibarra (Simpple) Getting started with Vagrant March 5, 2015 2 / 12
Easy to use Multiplatform Compatible with multiple virtualization software: VirtualBox / VMware / Parallels Snapshots Guillermo Guerrero Ibarra (Simpple) Getting started with Vagrant March 5, 2015 3 / 12
time Vagrant executes provision) halt suspend / resume provision → Shell / Chef destroy ssh Vagrant triggers: On up On destroy On provision ... Guillermo Guerrero Ibarra (Simpple) Getting started with Vagrant March 5, 2015 5 / 12
c o n f i g u r e (2) do | c o n f i g | 2 c o n f i g .vm. box = ’ ubuntu/ t r u s t y 6 4 ’ 3 4 c o n f i g . ssh . forward agent = t r u e 5 c o n f i g .vm. network ’ f o rw a r d e d p o rt ’ , : guest => 3000 , : host => 9000 6 c o n f i g .vm. network ’ f o rw a r d e d p o rt ’ , : guest => 3306 , : host => 9306 7 8 c o n f i g .vm. network ’ p r i v a t e n e t w o r k ’ , : i p => ’ 10.10.10.120 ’ 9 10 c o n f i g .vm. p r o v i d e r ’ v i r t u a l b o x ’ do | vb | 11 vb . memory = ’ 1024 ’ 12 end 13 end Guillermo Guerrero Ibarra (Simpple) Getting started with Vagrant March 5, 2015 6 / 12
g .vm. p r o v i s i o n ” s h e l l ” , i n l i n e : <<−SHELL 2 sudo apt−get update 3 sudo apt−get i n s t a l l −y apache2 4 SHELL Chef 1 c o n f i g .vm. p r o v i s i o n : c h e f s o l o do | chef | 2 chef . a d d r e c i p e ’ apt ’ 3 chef . a d d r e c i p e ’ build −e s s e n t i a l ’ 4 chef . a d d r e c i p e ’ g i t ’ 5 chef . a d d r e c i p e ’ nodejs ’ 6 end Others → puppet, knife, chef, ansible... Guillermo Guerrero Ibarra (Simpple) Getting started with Vagrant March 5, 2015 7 / 12
in Vagrantfile Chef 1 c o n f i g .vm. p r o v i s i o n : c h e f s o l o do | chef | 2 chef . a d d r e c i p e ’ apt ’ 3 chef . a d d r e c i p e ’ build −e s s e n t i a l ’ 4 chef . a d d r e c i p e ’ g i t ’ 5 chef . a d d r e c i p e ’ nodejs ’ 6 chef . a d d r e c i p e ’ rvm : : system ’ 7 chef . a d d r e c i p e ’ rvm : : vagrant ’ 8 chef . a d d r e c i p e ’ app : : packages ’ 9 chef . a d d r e c i p e ’ app : : mysql ’ 10 chef . a d d r e c i p e ’ app : : gemset ’ 11 chef . a d d r e c i p e ’ app : : environment ’ 12 chef . a d d r e c i p e ’ app : : post−i n s t a l l ’ 13 end Guillermo Guerrero Ibarra (Simpple) Getting started with Vagrant March 5, 2015 8 / 12
supermarket . g e t c h e f . com” 2 3 cookbook ’ apt ’ 4 cookbook ’ g i t ’ 5 cookbook ’ build −e s s e n t i a l ’ 6 cookbook ’ nodejs ’ 7 cookbook ’ mysql ’ 8 cookbook ’ rvm ’ 9 cookbook ’ o p e n s s l ’ 10 cookbook ’ app ’ , path : ’ ./ s i t e −cookbooks /app ’ Guillermo Guerrero Ibarra (Simpple) Getting started with Vagrant March 5, 2015 9 / 12
Templates files support erb (parameters) Cookbooks folders 1 s i t e −cookbooks /app 2 a t t r i b u t e s 3 l i s t o f a t t r i b u t e s . rb 4 r e c i p e s 5 l i s t o f r e c i p i e s . rb 6 templates 7 d e f a u l t s f i l e s 8 B e r k s f i l e 9 metadata . rb Guillermo Guerrero Ibarra (Simpple) Getting started with Vagrant March 5, 2015 10 / 12