Vagrant Overview

Vagrant builds and manages VM environment which allows multi vms to be configured at once and then destroyed and recreated again before you can manually setup one vm.

Vagrant uses already configured images to deploy thus speeding up deployment time.You have the option to make your own box but there are loads of pre-made images that are regularly updated.

Vagrant interfaces with providers (Docker/VirtualBox/hyperv) and allows provisioning tools(Chef, Puppet, Ansible, shell scripts) to be ran when the Vm is created.

Other custom plugins can be used to allow additional providers to be used.

Basic Commands

# initializes current directory as vagrant environment (creates Vagrantfile)
vagrant init 

# create and configs VM
vagrant up

# halts VM 
vagrant halt

# destroys VM
vagrant destroy

# validate Vagrantfile
vagrant validate

# runs configured provisioners 
vagrant provision

# status 
vagrant status

### ssh into vagrant vm 
vagrant ssh
# or the equivalent ssh  
ssh vagrant@localhost -p2222 -i ~/.vagrant.d/insecure_private_key  # vagrant is the password

### ssh config of vagrant 
vagrant ssh-config

Leave a comment

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

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax