32
Vagrant Workshop by Eduardo Casarero ([email protected] || @jedux) vagrant up (TECHNOLOGY) phrasal verb with vagrant “just hit vagrant up” and ‘automágicamente’ download the box, unpack it, add it to the box repo, clone it into VirtualBox, start it, provision it and give access to the user.

Vagrant Workshop

Embed Size (px)

Citation preview

Page 1: Vagrant Workshop

Vagrant Workshopby Eduardo Casarero ([email protected] || @jedux)

vagrant up(TECHNOLOGY) — phrasal verb with vagrant

“just hit vagrant up” and ‘automágicamente’ download the box, unpack it, add it to the box repo, clone it into VirtualBox, start it, provision it and give access to the user.

Page 2: Vagrant Workshop

Who?● Eduardo Casarero (@jedux)● Almost Engineer (UADE)● Sysadmin > 10 years● DevOps <3● #sysarmy (irc, sysarmy/help, adminbirras)● #nerdearla

Page 3: Vagrant Workshop

HashicorpCandy factory for Sysadmins.

Page 4: Vagrant Workshop

Application delivery done right.

HashiCorp delivers pragmatic solutions to maximize developer and operator agility. Build microservice-driven applications that are codified, automated, scalable and secure.

Page 5: Vagrant Workshop

Hashicorp Ecosystem

Page 6: Vagrant Workshop

Hashicorp EcosystemPacker is a HashiCorp tool for creating machine images and deployable artifacts such as AMIs,

OpenStack images, Docker containers, etc.

Terraform is a HashiCorp tool for creating, combining, and modifying infrastructure. In the Atlas

workflow Terraform reads from the artifact registry and provisions infrastructure.

Consul is a HashiCorp tool for service discovery, service registry, and health checks.

Serf is a HashiCorp tool for cluster membership and failure detection.

Vagrant is a HashiCorp tool for managing development environments that mirror production.

Vagrant environments reduce the friction of developing a project and reduce the risk of

unexpected behavior appearing after deployment.

Page 7: Vagrant Workshop

Atlas

Page 8: Vagrant Workshop

BV: Before Vagrant

Page 9: Vagrant Workshop

Pre-Vagrant scenario (real)Use case 1 (easy one):“ASAP test this package/app/config/etc (in a clean environment)”● First approach: use my notebook/desktop

○ my desktop is not a “clean” environment, it’s more like a polluted one.● Second approach: use a virtual machine on virtualbox

○ easy, install from iso in virtualbox, test, destroy vm… too much time to setup.

○ Corporate Virtual Machine “black” market -> not clean environment● Third approach: cd vagrant/ubuntu-server && vagrant up

○ Learn vagrant, created one base box like a production environment○ up -> test -> destroy -> up -> test -> destroy :) :) :) :)

Page 10: Vagrant Workshop

AV: After Vagrant

Page 11: Vagrant Workshop

Vagrant!

Virtualized development environment made easy● command line tool● lowers provisioning time● fully control environment and versions● kills “work on my machine” excuse● many providers: virtualbox, vmware, aws, etc● can use puppet, chef, ansible, bash scripts● FREE and open source

Page 12: Vagrant Workshop

80% of Vagrant

● 5 simple commands:○ vagrant up○ vagrant provision○ vagrant ssh○ vagrant halt○ vagrant destroy

● Really more like 16 commands, but you really use these 5.

Page 13: Vagrant Workshop

Go -> Level 0 & 1Get the workshop environment from https://github.com/edux/vagrant_workshop

Page 14: Vagrant Workshop

Shortfalls of environments

● Does not mirror “testing” or production setup● Each developer has a different one● Easily out of sync with standards● Many versions of php, mysql, java, etc.● High learning curve for new devs/qa/it● ‘works in my computer’ culture.

Page 15: Vagrant Workshop

QA/Dev “Standard” Workstation

Page 16: Vagrant Workshop
Page 17: Vagrant Workshop

Vagrantified environment

Page 18: Vagrant Workshop

Benefits● Solo Developers

○ consistency across multiple projects○ can run multiple environments on a single host (dev, test, staging)○ easy tear down and rebuild

● TEAMS○ identical development environments (kills ‘works on my pc’ excuse)○ consistent and portable

● COMPANIES○ lowering learning curve○ build once, distribute to everyone○ lower costs

Page 19: Vagrant Workshop

Go -> Level 2

Page 20: Vagrant Workshop

Real use case: take 2PM: please fix our “switch to replica” golden scripts.

Need at least 3 servers to test.● Started with only Virtualbox kicking and

snapshotting vms. ● Ended with Vagrant with multi machine

environment -> glory.

Page 21: Vagrant Workshop

Go -> Level 3

Page 22: Vagrant Workshop

Real Use case: take 3

IT team supports almost 60 devs+qa. Everybody “needs” a sandbox environment to play with. ● Sandbox installation installs toooooo many things nginx,

mysql,git,internal tools, log tools, the app, devs tools, qa tools, etc….

● Solution: Vagrantify environment, this is still a work in progress as the use case is “complex”.

Page 23: Vagrant Workshop

(my) Success keys to deploy vagrant● dogfooding is critical (sell what you use)● get support from management (hard one)● rock solid images (users does not like bugs, neither do

we)● prepare images and configs to suit all use cases!!!!● detect early adopters to help you push changes in the

teams

Page 24: Vagrant Workshop

Boxes, boxes, boxes

https://atlas.hashicorp.com/boxes/search

Page 25: Vagrant Workshop

Provisioning like a boss

- Shell- Ansible- CFEngine- Chef- Docker- Puppet- Salt

Page 26: Vagrant Workshop

Go -> Level 4

Page 27: Vagrant Workshop

multi envs with multi vms.

- The dynamic ip challenge.- Hostsmanager- moving that to libvirt with minimal changes:

- network eth names- mem / cpu / other hypervisor parameters.

Page 28: Vagrant Workshop

misc: kali - windows.

- using gui=true.- winrm is available to do configs over

windows hosts.- show modern.ie windows vms for everyone.

(https://dev.modern.ie/)

Page 29: Vagrant Workshop

Go -> Level 5

Page 30: Vagrant Workshop

Cutting edge: Otto

Page 31: Vagrant Workshop

Questions ?

Page 32: Vagrant Workshop

Thanks!!