This document outlines an agenda for a Vagrant 101 workshop. The workshop will teach participants about environments and Infrastructure as Code using Vagrant. It will cover setting up a Vagrant environment with VirtualBox, basic Vagrant commands like init, up, ssh, destroy and box add. The agenda includes introducing environments, Vagrant, VirtualBox, commands, and workflow. Requirements are basic Linux knowledge and the latest versions of Vagrant and VirtualBox installed.
Our DEV environment
āGot a Laptop
ā Installed: Python, pip, virtualenv
ā Checked out code from GitHub
ā Hardware + OS
ā Middleware
ā Application
10.
What Vagrant Is?
Buildingand Managing VM environments in a single,easy-to-
use workflow
https://www.vagrantup.com/
11.
From Top
ā Commandline tool
ā Providers: Virtualbox, VMWare, Hyper-V, AWS, GCP, Azure ā¦.
ā Provisioners: shell, Chef, Ansible, Puppet ā¦.
ā Runs on: Linux, Windows, MacOS
12.
VirtualBox
ā A generalpurpose full virtualizer for x86 hardware
ā Free
ā Open Source
ā Available on every major platform
https://www.virtualbox.org
13.
Getting up andrunning
$ vagrant init ubuntu/xenial64
$ vagrant up
$ vagrant ssh
Did you know?
Hashicorp is Vagrant vendor
Xenial = Ubuntu 16.04
Did you know?
ssh - Secure Shell. Used to log onto
remote systems
14.
Command: vagrant init
Placesa Vagrantfile is current directory
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
end
Run the init command in your
project root directory. Many
configuration options are relative to
the project root folder
ubuntu/xenial64 - a box
A box is a base image
15.
Command: vagrant up
āThe box is downloaded and stored locally in ~/.vagrant.d/boxes
ā A new VM is created and bootstrapped with the box
ā The VM is booted and provisioned
16.
Command: vagrant ssh
āLog onto the VM
Did you know?
You logon with the user āvagrantā
which was created by vagrant
during the VM bootstrapping
Command: vagrant boxadd
ā Catalog - https://app.vagrantup.com/boxes/search
ā Stored locally in ~/.vagrant.d/boxes
$ vagrant box add ubuntu/trusty64
Did you know?
Trusty = Ubuntu 14.04
Do you remember?
The base box configuration option is
in the Vagrantfile
19.
Exercise
ā Check whichUbuntu version is running - ālsb_release -aā
ā Destroy the VM
ā Spin up a new VM based on trusty64
ā Check which Ubuntu version is running NOW
20.
/vagrant - syncedfolder
ā By default, the project root folder (host) is synced with the /vagrant folder
(guest)
ā Two way sync
ā It is not vagrant home directory
21.
Provider - VirtualBoxconfiguration
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |v|
v.name = "my_vm"
v.memory = 2048
v.cpus = 4
end
end