This document outlines an agenda for a hands-on workshop on Vagrant for beginners. The agenda includes introductions to Vagrant and VirtualBox, the Vagrant and VirtualBox workflow, getting and configuring base boxes, and provisioning virtual machines using shell scripts. The workshop demonstrates how to use Vagrant to create lightweight reproducible development environments across different operating systems and configuration management tools.
Connector Corner: Automate dynamic content and events by pushing a button
Vagrant hands on workshop for beginners
1. Vagrant Hands on Workshop for
Beginners
Liora Milbaum
DevOps & ALM Evangelist
2. whoami
Mother of 3 girls 22,18,13
Software developer 3 years
ALM Expert 20+ years
DevOps Enthusiast 3 years
Owner of L.M.B.-Consulting Ltd. since 1999
IBM Advanced Business Partner ~10 years
https://www.linkedin.com/in/lioramilbaum
7. What is Vagrant good for?
Create and configure lightweight, reproducible
and portable development environments
https://www.vagrantup.com/
8. Vagrant in high level
Command line tool
Automates VM creation: Virtualbox, VMWare,
Hyper-V, AWS….
Integrates with configuration management
tools: shell, chef, Ansible, Puppet….
Runs on: Linux, Windows, MacOS
9. Why use Vagrant?
Create new VMs quickly and easily
Keep the number of VMs under control
Reproducibility
Identical environment in dev/test/stage/prod
Portability
14. $ vagrant init hashicorp/precise32
$ vagrant up
$ vagrant ssh
Getting Up And Running
15. What happened under the hood
$ vagrant init hashicorp/precise32
A Vagrantfile is created
VAGRANTFILE_API_VERSION = ‘2’
vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = ‘hashicorp/precise32’
end
16. What happened under the hood
$ vagrant up
The base box is downloaded and stored locally
in ~/.vagrant.d/boxes
A new VM is created and configured with the base box as
a template
The VM is booted
The box is provisioned
27. $ vagrant init user/box # Create Vagrantfile for specified
base box
$ vim/notepad Vagrantfile # Customize your box
$ vagrant up # Create VM if needed and boot
$ vagrant reload # After every change to Vagrantfile
$ vagrant halt # Poweroff
$ vagrant destroy # Clean up!
$ vagrant ssh # log in
$ vagrant status # Status of your VM
Summery
31. Recommended workflow
First do the installation manually (vagrant ssh)
Make sure every command runs without user interaction!
Record every command in the script
If everything works: vagrant destroy -f && vagrant up