SlideShare una empresa de Scribd logo
Vagrant para automatizar entornos DEV/PRO
Vagrant + Chef Solo + [VirtualBox, vSphere]
@javier_jeronimo
Objetivos
● Entorno desarrollo = entorno producción
○ Mismo SO
○ Mismas herramientas, bibliotecas, versiones...

● Automatizar entornos
○ Poder destruir y re-generar desde cero
○ Sólo esto asegura DEV=PRO

● Control de versiones para todo
● Gestión de dependencias automática
Vagrant
Gestión de máquinas virtuales desde línea de
comandos:
● vagrant up
● vagrant halt
● vagrant ssh
vagrant up => un sólo comando por primera
vez y la máquina estará lista y en ejecución
Vagrant - Conceptos

1.

Definición
Vagrant - Conceptos (1)
Definición de la máquina virtual
● Carpeta conteniendo un Vagrantfile
● ID de la “caja” base (box). Ej: precise64
● URL de la caja (descarga y cache local)
○ ¡Cuidado con cajas con mismo ID!

● Configuración VM: IP, puertos, etc
● Sintaxis del fichero: Ruby DSL
Vagrant - Conceptos (1)
Vagrant::Config.run do |config| # v1
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui
#
#
#
#

Assign this VM to a bridged network, allowing you to connect directly to a
network using the host's network device. This makes the VM appear as another
physical device on your network.
config.vm.network :bridged

# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
# config.vm.forward_port 80, 8080
[...]
Vagrant - Conceptos

2.

Proveedor
Vagrant - Conceptos (2)
Proveedor (provider) de la máquina:
● ¿Qué es? => Quien finalmente la ejecuta
Proveedores:
● VirtualBox (incluido en Vagrant)
● VMWare, de pago (Workstation, Fusion)
● Otros mediante plugins: AWS, vSphere, etc.
Vagrant - Conceptos

3.

Aprovisionador
Vagrant - Conceptos (3)
Aprovisionador (provisioner):
● Prepara la máquina: instala paquetes,
configura usuarios, etc.
● Varios disponibles:
○
○
○
○

Shell script
Puppet
Chef Solo
...
Vagrant - Plugins
● Proveedores. Ej: Añadir soporte para AWS,
vSphere, OpenStack, Parallels, ...
● Aprovisionadores. Ej:
○ Chef: gestionar dependencias con Berkshelf o
Librarian, actualizar con OmniBus, …
○ Puppet: gestionar dependencias con Librarian
○ Otros: añadir soporte para Fabric, ...

● Otros. Ej: exec, screenshot, ...
Vagrant - Gestión configuración
Caja base: ID + URL

Vagrantfile

Recetas a ejecutar +
parámetros JSON

1
3
2

Berksfile

./cookbooks/*

./databags/*
Gestión de
configuración de las
recetas Chef

URL-de-la-caja

./roles/*

Proveedor
VirtualBox
(instalación local)
vSphere (servidor)
Vagrant - Diferentes entornos
Desarrollo:
● VirtualBox
● Detalles:
○ Redes host-guest,
guest-guest
○ DNS en /etc/hosts

● Entorno aislado en
ordenador

Producción:
● VMware vSphere
● Detalles:
○ Red virtualizada en
CPD
○ DNS por servidor

● Entorno CPD
virtualizado
Vagrant - Gestión configuración
Repositorio:
●
●
●
●

●

●

●
●

cookbooks/
databags/
roles/
boxes/
○ vsphere.box <== (caja vacía: sólo metadatos provider)
○ precise64_virtualbox.box<== (VirtualBox VM: disco duro con datos, definición...)
production/
○ server01/
■ Vagrantfile <== (provider=vSphere, box=vsphere.box)
■ Berksfile <== (gestión de dependencias Chef)
development/
○ server01/
■ Vagrantfile <== (provider=VirtualBox, box=precise64_virtualbox.box)
■ Berksfile <== (gestión de dependencias Chef)
Gemfile <== (gestión de dependencias Ruby)
plugins.json <== (gestión de dependencias: plugins Vagrant)
Vagrant - Entorno desarrollo
web.example.com
sql.example.com
tasks.example.com
...

VirtualBox: VMs

Ordenador
Ingeniero SW

Red virtual

Red virtual

Red virtual

Red virtual
Vagrant - Entorno desarrollo
Chef-Solo

6

Instalación de la máquina
virtual: recetas, datos...
Plugin: Chef OmniBus installer

5
5
4

4
CLI
Virtualbox

6

VM Boot + configuración
básica: IP, puertos, carpetas
compartidas, ...

2

3
Plugin: Berkshelf

incluido en
vagrant

CLI
2

Creación de la máquina
virtual

Vagrant

1

Descarga y cache local
de la caja: *_virtualbox

3
1
Vagrant - Entorno producción
web.example.com
sql.example.com
tasks.example.com
...

Ordenador
Ingeniero SW

Servidor vSphere ESXi
Vagrant - Entorno producción
Chef-Solo

7

Instalación de la máquina
virtual: recetas, datos...
Plugin: Chef OmniBus installer

6
1

vSphere
plugin vagrant

VM Boot + configuración
5 básica: IP, puertos, carpetas
API compartidas, ...
Plugin: Berkshelf
API
Creación de la máquina
3
virtual: template + spec
2

Creación: template +
customization spec

1

Descarga de una
máquina VMWare

vSphere

6

7
2

4
5

3

4
Objetivos
● Entorno desarrollo = entorno producción
○ Distinta máquina: IPs, VirtualBox vs vSphere...
○ Mismas recetas Chef: gestión de configuración

● Automatizar entornos
○ vagrant up / vagrant provision / vagrant destroy

● Control de versiones para todo
● Gestión de dependencias automática
○ Bundler (Gemfile), Berkshelf (Berksfile +
cookbooks/*/metadata.rb)
Referencias
Vagrant - Plugins: https://github.
com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins
Vagrant - Cajas: http://www.vagrantbox.es/
Berkshelf: http://berkshelf.com
vSphere - Templates: http://goo.gl/H8jdxQ
vSphere - Customization specs: http://goo.gl/OUVcTo

Más contenido relacionado

ODP
Virtualización y Provisionamiento: Entornos de desarrollo con Vagrant y Puppet
PDF
Entorno de desarrollo rápido con Vagrant
PDF
Creación de entornos de desarrollo con Vagrant
PDF
Entornos de desarrollo para symfony2 con vagrant y puppet
PDF
Introducción a Vagrant
PDF
Vagrant: virtualizando entornos de desarrollo
PPT
Virtualización y Provisionamiento: Entornos de desarrollo con Vagrant y Puppet
Entorno de desarrollo rápido con Vagrant
Creación de entornos de desarrollo con Vagrant
Entornos de desarrollo para symfony2 con vagrant y puppet
Introducción a Vagrant
Vagrant: virtualizando entornos de desarrollo

La actualidad más candente (20)

PDF
Vagrant
PDF
MythTV Mediacenter on an IGEPv2
PDF
Una introducción a vagrant
PDF
Cloud Computing. Gestión de configuraciones. Ansible
PDF
Sandbox para ejercicios de programación
PDF
Cloud Computing. Virtualización. qemu
PDF
Cloud Computing. Gestión de configuraciones. Vagrant
PDF
Introduccion A Docker
PPTX
Armitage pruebas
PPT
Java y sus caracteristicas
PDF
Exprime al máximo la capacidad de tus servidores gracias a la virtualización ...
PDF
Cloud Computing. Virtualización
PDF
Virtualenv y buildout
PDF
Introducción a Ansible
PDF
Docker - Sysmana 2014
PPTX
Docker 2014 v2
PDF
Introduccion a kata containers
PDF
Introducción a NodeJS
PDF
Fury - Docker Meetup
PDF
Dev ops infraestructura agil con open source
Vagrant
MythTV Mediacenter on an IGEPv2
Una introducción a vagrant
Cloud Computing. Gestión de configuraciones. Ansible
Sandbox para ejercicios de programación
Cloud Computing. Virtualización. qemu
Cloud Computing. Gestión de configuraciones. Vagrant
Introduccion A Docker
Armitage pruebas
Java y sus caracteristicas
Exprime al máximo la capacidad de tus servidores gracias a la virtualización ...
Cloud Computing. Virtualización
Virtualenv y buildout
Introducción a Ansible
Docker - Sysmana 2014
Docker 2014 v2
Introduccion a kata containers
Introducción a NodeJS
Fury - Docker Meetup
Dev ops infraestructura agil con open source
Publicidad

Destacado (12)

PPTX
Discovering New Apps
PPTX
Dev ops e infraestructura – acompañando nuestro software a producción
PDF
Curso puppet lenguaje_2
PDF
Vagrant y Docker - Guía práctica de uso
PPTX
Dev ops. Rompiendo Barreras
PDF
How to improve your moodle site performance
PPTX
Graylog Engineering - Design Your Architecture
PDF
Past, Present & Future of Recommender Systems: An Industry Perspective
PDF
Factorization Meets the Item Embedding: Regularizing Matrix Factorization wit...
PDF
(Some) pitfalls of distributed learning
PDF
Balancing Discovery and Continuation in Recommendations
ODP
Gestionando servidores con Puppet
Discovering New Apps
Dev ops e infraestructura – acompañando nuestro software a producción
Curso puppet lenguaje_2
Vagrant y Docker - Guía práctica de uso
Dev ops. Rompiendo Barreras
How to improve your moodle site performance
Graylog Engineering - Design Your Architecture
Past, Present & Future of Recommender Systems: An Industry Perspective
Factorization Meets the Item Embedding: Regularizing Matrix Factorization wit...
(Some) pitfalls of distributed learning
Balancing Discovery and Continuation in Recommendations
Gestionando servidores con Puppet
Publicidad

Similar a Vagrant para automatizar entornos DEV/PRO: VirtualBox y vSphere (20)

PDF
El servidor perfecto
PPTX
Oracle VM VirtualBox Hacked
PDF
Virtualizacion
PPT
3 3 virtual_box
PDF
Docker: la revolución en virtualización
PDF
Virtualizacion KVM + libvirt + HREL6
PDF
Dockeriza tu entorno de desarrollo
PDF
Documentacion vnc
PDF
Virtualbox
PDF
Magallanes, Herramienta de despliegue PHP sencilla y poderosa
PDF
1.1.1.4 Lab - Installing the CyberOps Workstation Virtual Machine(RESUELTO).pdf
PDF
Laboratorio 1
PPTX
[Run Reloaded] SCVMM 2008 R2 a fondo (Antonio Scuotto + Alejandro Ponicke)
PPTX
La Estación de Virtualización
PPTX
Virtualization Station
PDF
Curso linux clase_2_2012
PPTX
Jug málaga docker 101 - final
PDF
Entornos de desarrollo portables, reproducibles y ligeros
PPTX
Seguridad de las Redes
PDF
Introduction to docker. Stratio
El servidor perfecto
Oracle VM VirtualBox Hacked
Virtualizacion
3 3 virtual_box
Docker: la revolución en virtualización
Virtualizacion KVM + libvirt + HREL6
Dockeriza tu entorno de desarrollo
Documentacion vnc
Virtualbox
Magallanes, Herramienta de despliegue PHP sencilla y poderosa
1.1.1.4 Lab - Installing the CyberOps Workstation Virtual Machine(RESUELTO).pdf
Laboratorio 1
[Run Reloaded] SCVMM 2008 R2 a fondo (Antonio Scuotto + Alejandro Ponicke)
La Estación de Virtualización
Virtualization Station
Curso linux clase_2_2012
Jug málaga docker 101 - final
Entornos de desarrollo portables, reproducibles y ligeros
Seguridad de las Redes
Introduction to docker. Stratio

Último (20)

DOCX
Zarate Quispe Alex aldayir aplicaciones de internet .docx
PDF
Estrategia de apoyo tecnología miguel angel solis
PPTX
RAP02 - TECNICO SISTEMAS TELEINFORMATICOS.pptx
PPTX
Power Point Nicolás Carrasco (disertación Roblox).pptx
PDF
SAP Transportation Management para LSP, TM140 Col18
PDF
Diapositiva proyecto de vida, materia catedra
PDF
taller de informática - LEY DE OHM
PDF
5.1 Pinch y Bijker en libro Actos, actores y artefactos de Bunch Thomas (coor...
PPTX
historia_web de la creacion de un navegador_presentacion.pptx
PPTX
ANCASH-CRITERIOS DE EVALUACIÓN-FORMA-10-10 (2).pptx
PDF
Maste clas de estructura metálica y arquitectura
PDF
Estrategia de apoyo tecnología grado 9-3
PPTX
sa-cs-82-powerpoint-hardware-y-software_ver_4.pptx
PDF
CyberOps Associate - Cisco Networking Academy
PDF
Plantilla para Diseño de Narrativas Transmedia.pdf
PDF
clase auditoria informatica 2025.........
PPTX
Presentación PASANTIAS AuditorioOO..pptx
PPTX
IA de Cine - Como MuleSoft y los Agentes estan redefiniendo la realidad
PPTX
REDES INFORMATICAS REDES INFORMATICAS.pptx
PDF
Influencia-del-uso-de-redes-sociales.pdf
Zarate Quispe Alex aldayir aplicaciones de internet .docx
Estrategia de apoyo tecnología miguel angel solis
RAP02 - TECNICO SISTEMAS TELEINFORMATICOS.pptx
Power Point Nicolás Carrasco (disertación Roblox).pptx
SAP Transportation Management para LSP, TM140 Col18
Diapositiva proyecto de vida, materia catedra
taller de informática - LEY DE OHM
5.1 Pinch y Bijker en libro Actos, actores y artefactos de Bunch Thomas (coor...
historia_web de la creacion de un navegador_presentacion.pptx
ANCASH-CRITERIOS DE EVALUACIÓN-FORMA-10-10 (2).pptx
Maste clas de estructura metálica y arquitectura
Estrategia de apoyo tecnología grado 9-3
sa-cs-82-powerpoint-hardware-y-software_ver_4.pptx
CyberOps Associate - Cisco Networking Academy
Plantilla para Diseño de Narrativas Transmedia.pdf
clase auditoria informatica 2025.........
Presentación PASANTIAS AuditorioOO..pptx
IA de Cine - Como MuleSoft y los Agentes estan redefiniendo la realidad
REDES INFORMATICAS REDES INFORMATICAS.pptx
Influencia-del-uso-de-redes-sociales.pdf

Vagrant para automatizar entornos DEV/PRO: VirtualBox y vSphere

  • 1. Vagrant para automatizar entornos DEV/PRO Vagrant + Chef Solo + [VirtualBox, vSphere] @javier_jeronimo
  • 2. Objetivos ● Entorno desarrollo = entorno producción ○ Mismo SO ○ Mismas herramientas, bibliotecas, versiones... ● Automatizar entornos ○ Poder destruir y re-generar desde cero ○ Sólo esto asegura DEV=PRO ● Control de versiones para todo ● Gestión de dependencias automática
  • 3. Vagrant Gestión de máquinas virtuales desde línea de comandos: ● vagrant up ● vagrant halt ● vagrant ssh vagrant up => un sólo comando por primera vez y la máquina estará lista y en ejecución
  • 5. Vagrant - Conceptos (1) Definición de la máquina virtual ● Carpeta conteniendo un Vagrantfile ● ID de la “caja” base (box). Ej: precise64 ● URL de la caja (descarga y cache local) ○ ¡Cuidado con cajas con mismo ID! ● Configuración VM: IP, puertos, etc ● Sintaxis del fichero: Ruby DSL
  • 6. Vagrant - Conceptos (1) Vagrant::Config.run do |config| # v1 # All Vagrant configuration is done here. The most common configuration # options are documented and commented below. For a complete reference, # please see the online documentation at vagrantup.com. # Boot with a GUI so you can see the screen. (Default is headless) # config.vm.boot_mode = :gui # # # # Assign this VM to a bridged network, allowing you to connect directly to a network using the host's network device. This makes the VM appear as another physical device on your network. config.vm.network :bridged # Forward a port from the guest to the host, which allows for outside # computers to access the VM, whereas host only networking does not. # config.vm.forward_port 80, 8080 [...]
  • 8. Vagrant - Conceptos (2) Proveedor (provider) de la máquina: ● ¿Qué es? => Quien finalmente la ejecuta Proveedores: ● VirtualBox (incluido en Vagrant) ● VMWare, de pago (Workstation, Fusion) ● Otros mediante plugins: AWS, vSphere, etc.
  • 10. Vagrant - Conceptos (3) Aprovisionador (provisioner): ● Prepara la máquina: instala paquetes, configura usuarios, etc. ● Varios disponibles: ○ ○ ○ ○ Shell script Puppet Chef Solo ...
  • 11. Vagrant - Plugins ● Proveedores. Ej: Añadir soporte para AWS, vSphere, OpenStack, Parallels, ... ● Aprovisionadores. Ej: ○ Chef: gestionar dependencias con Berkshelf o Librarian, actualizar con OmniBus, … ○ Puppet: gestionar dependencias con Librarian ○ Otros: añadir soporte para Fabric, ... ● Otros. Ej: exec, screenshot, ...
  • 12. Vagrant - Gestión configuración Caja base: ID + URL Vagrantfile Recetas a ejecutar + parámetros JSON 1 3 2 Berksfile ./cookbooks/* ./databags/* Gestión de configuración de las recetas Chef URL-de-la-caja ./roles/* Proveedor VirtualBox (instalación local) vSphere (servidor)
  • 13. Vagrant - Diferentes entornos Desarrollo: ● VirtualBox ● Detalles: ○ Redes host-guest, guest-guest ○ DNS en /etc/hosts ● Entorno aislado en ordenador Producción: ● VMware vSphere ● Detalles: ○ Red virtualizada en CPD ○ DNS por servidor ● Entorno CPD virtualizado
  • 14. Vagrant - Gestión configuración Repositorio: ● ● ● ● ● ● ● ● cookbooks/ databags/ roles/ boxes/ ○ vsphere.box <== (caja vacía: sólo metadatos provider) ○ precise64_virtualbox.box<== (VirtualBox VM: disco duro con datos, definición...) production/ ○ server01/ ■ Vagrantfile <== (provider=vSphere, box=vsphere.box) ■ Berksfile <== (gestión de dependencias Chef) development/ ○ server01/ ■ Vagrantfile <== (provider=VirtualBox, box=precise64_virtualbox.box) ■ Berksfile <== (gestión de dependencias Chef) Gemfile <== (gestión de dependencias Ruby) plugins.json <== (gestión de dependencias: plugins Vagrant)
  • 15. Vagrant - Entorno desarrollo web.example.com sql.example.com tasks.example.com ... VirtualBox: VMs Ordenador Ingeniero SW Red virtual Red virtual Red virtual Red virtual
  • 16. Vagrant - Entorno desarrollo Chef-Solo 6 Instalación de la máquina virtual: recetas, datos... Plugin: Chef OmniBus installer 5 5 4 4 CLI Virtualbox 6 VM Boot + configuración básica: IP, puertos, carpetas compartidas, ... 2 3 Plugin: Berkshelf incluido en vagrant CLI 2 Creación de la máquina virtual Vagrant 1 Descarga y cache local de la caja: *_virtualbox 3 1
  • 17. Vagrant - Entorno producción web.example.com sql.example.com tasks.example.com ... Ordenador Ingeniero SW Servidor vSphere ESXi
  • 18. Vagrant - Entorno producción Chef-Solo 7 Instalación de la máquina virtual: recetas, datos... Plugin: Chef OmniBus installer 6 1 vSphere plugin vagrant VM Boot + configuración 5 básica: IP, puertos, carpetas API compartidas, ... Plugin: Berkshelf API Creación de la máquina 3 virtual: template + spec 2 Creación: template + customization spec 1 Descarga de una máquina VMWare vSphere 6 7 2 4 5 3 4
  • 19. Objetivos ● Entorno desarrollo = entorno producción ○ Distinta máquina: IPs, VirtualBox vs vSphere... ○ Mismas recetas Chef: gestión de configuración ● Automatizar entornos ○ vagrant up / vagrant provision / vagrant destroy ● Control de versiones para todo ● Gestión de dependencias automática ○ Bundler (Gemfile), Berkshelf (Berksfile + cookbooks/*/metadata.rb)
  • 20. Referencias Vagrant - Plugins: https://github. com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins Vagrant - Cajas: http://www.vagrantbox.es/ Berkshelf: http://berkshelf.com vSphere - Templates: http://goo.gl/H8jdxQ vSphere - Customization specs: http://goo.gl/OUVcTo