Using CheatSheets To Apply Best Practices

Cheatsheet: Vagrant

Cheatsheet: Vagrant

1.1 vagrant Basic

Name Command
Vagrant supported providers VirtualBox, VMware, Docker, Hyper-V
Check version vagrant version
Start vm from vagrantfile vagrant up. Sample vagrantfile
Start vm with customization vagrant up --debug, vagrant up --provider virtualbox
Destroy vagrant vm vagrant destory
SSH to vagrant vm vagrant ssh
lists all boxes installed into Vagrant vagrant box list
Vagrant data folder ~/.vagrant.d
Reference Link: vagrant cli, Link: Discover Vagrant Boxes

1.2 vagrant start vms

Name Command
ubuntu 14.04 64bits vagrant init ubuntu/trusty64
ubuntu 12.04 32bits vagrant init hashicorp/precise32
ubuntu 12.04 64bits vagrant init hashicorp/precise64
CentOS 6.5 vagrant init chef/centos-6.5
Start vm from image vagrant init precise64 http://files.vagrantup.com/precise64.box

1.3 vagrant advanced

Name Command
Show Vagrant environments vagrant global-status
stops the vagrant machine vagrant halt
package virtualbox vm to boxfile vagrant package --base my-virtual-machine
Get detail ssh configuration vagrant ssh-config
Start vm with vagrant up --debug
Copy local files to vagrant vm copy-to-vagrant.sh
Update vagrant boxes vagrant box update, vagrant box update --box $box_name
Destroy all old boxes vagrant box destroy
Vagrant add a secondary drive  
Vagrant resize disk  

1.4 Online Help Usage

> vagrant --help
WARNING: This command has been deprecated in favor of `vagrant cloud auth login`
Usage: vagrant [options] <command> [<args>]

    -v, --version                    Print the version and exit.
    -h, --help                       Print this help.

Common commands:
     box             manages boxes: installation, removal, etc.
     cloud           manages everything related to Vagrant Cloud
     destroy         stops and deletes all traces of the vagrant machine
     global-status   outputs status Vagrant environments for this user
     halt            stops the vagrant machine
     help            shows the help for a subcommand
     init            initializes a new Vagrant environment by creating a Vagrantfile
     login
     package         packages a running vagrant environment into a box
     plugin          manages plugins: install, uninstall, update, etc.
     port            displays information about guest port mappings
     powershell      connects to machine via powershell remoting
     provision       provisions the vagrant machine
     push            deploys code in this environment to a configured destination
     rdp             connects to machine via RDP
     reload          restarts vagrant machine, loads new Vagrantfile configuration
     resume          resume a suspended vagrant machine
     snapshot        manages snapshots: saving, restoring, etc.
     ssh             connects to machine via SSH
     ssh-config      outputs OpenSSH valid configuration to connect to the machine
     status          outputs status of the vagrant machine
     suspend         suspends the machine
     up              starts and provisions the vagrant environment
     upload          upload to machine via communicator
     validate        validates the Vagrantfile
     version         prints current and latest Vagrant version
     winrm           executes commands on a machine via WinRM
     winrm-config    outputs WinRM configuration to connect to the machine

For help on any individual command run `vagrant COMMAND -h`

Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.


Leave a Reply

Your email address will not be published. Required fields are marked *