Show Menu
Cheatography

Vagrant Set-Up Cheat Sheet by

Setup a Vagrant box or small network

Vagrant Setup

Vagrant installs at c:\has­hic­orp­\va­grant
Make a directory for each separate vm only 1 vagrant file can exist per directory'
i.e. c:\has­hic­orp­\va­gra­nt­\ansible
c:\has­hic­orp­\va­gra­nt­\deb­ian10
c:\has­hic­orp­\va­gra­nt­\netbox

Initial Config [/hash­ico­rp/­vag­ran­t/p­rec­ise64]

vagrant init [
Initia­lizes new vagran­tfile
]
i.e. vagrant init hashic­­or­p­/­pr­­ecise64
vagrant up [starts the box]

General Vagran­Mai­nte­nance

see adjacent screen shot
vagrant box list
|lists all available vagrant boxes on this endpoint
vagrant status
| displays status for box in current directory
vagrant box outdated
| checks if box is up to date
must run from a box path
vagrant global­-status
| displays status for all local boxes
vagrant global­­-s­tatus --prune
| status of all boxes; dropping invalid entries
vagrant box add <na­me> or <ur­l>
| downloads box image to your end point
vagrgant box remove <na­me>
| deletes box from end point
vagrant package
| packages a running enviro­nment in a reusable box

Advanced Vagrant Box Mgmt

vagrant provision
| forces end point to re-pro­vision
vagrant reload --prov­ision
| restart end point forcing provis­ioning
vagrant provision --debug
| increases verbosity during debug
vagrant up --prov­ision | tee provis­ion.log
| runs vagrant up provis­ioning & output logs placed in a file
enable VBGuest auto update

Notes / Alerts

If a PC goes to sleep, vagrant boxes will be forceably shutdown but no data should be lost

Website Resources

Windows Base Box [vagrant box add]

Vagrant Logs

vagrant up --prov­ision | tee provis­ion.log
forces provis­ioning and writes a log
vagran­t_l­og=info vagrant up
use env var VAGRAN­T_LOG to set verbosity
 

Vagrant Box List

Vagrant Status

Vagrant Global­-Status

Vagrant Box Outdated

Vagrant Box Add [name]

Vagrant Use Commands [Run in Project Path]

vagrant ssh
vagrant ssh config
vagrant suspend
vagrant resume
vagrant halt
vagrant reload
| restarts box w/ new config­uration
vagrant destroy
| destroys current endpoint not the base box
vagrant --version

Vagrant Plugins

vagrant plugin
| manages all plugins
vagrant plugin install vagran­t-v­bguest
| installs virtual box tools
vagrant plugin install vagran­t-h­ost­manager
  - manages /etc/hosts within a multi machine enviro­nment
vagrant plugin install vagran­t-env
| vagrant plugin install vagran­t-h­ost­sup­dater
UPdates /etc/hosts file each time vagrant stops or starts

Vagrant Share/­Remote Access

vagrant share
| share your enviro­nment with anyone
vagrant connect
| connect to a shared end point
vagrant hosts
| all hostnames managed by plugin
vagrant hostma­nager
| manages /etc/hosts within a multi machine enviro­nment
vagrant ssh-config
| provides connect config for machine
vagrant rdp
| connects to other machine via rdp
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Vagrant Cheat Sheet Cheat Sheet
          Vagrant Cheat Sheet
          Vagrant Cheat Sheet