Saturday, December 26, 2015

Vagrant Commands



What is Vagrant ?
  • Vagrant is a tool that uses Oracle's VirtualBox to dynamically build configurable, lightweight, and portable virtual machines. 
  • Vagrant supports the use of either Puppet or Chef for managing the configuration.
vagrant -v 

vagrant up, halt 
- up is used to create & configure your guest environment/machines based on  your  vagrantfile.
- halt bring down the environment Vagrant is managing.

vagrant status
- status of the Vagrant managed machines.

vagrant reload
-  apply Vagrant configuration changes (like port forwarding) without rebuilding the VM.

vagrant suspend, resume
- saves the state of the current VM.- resume will load up the suspended VM.

vagrant init, destroy 
- init initializes a project to use Vagrant
- Beware. This command will bring down the environment if running and then destroys
all of the resources that were created along with the initial creation.

vagrant push
- Vagrant can be configured to deploy code !

vagrant ssh 

- SSH into your Vagrant running machines.

vagrant login 
- log into Vagrant cloud (Atlas).

vagrant share 
- Do form folder with vagrantfile

vagrant global-status
- List all VMs status anywhere on the system.

vagrant gem
- install Vagrant plugins via RubyGems

vagrant box (add, list, remove) 

- vagrant box add, allows you to install a box (or VM) to the local machine
-  vagrant box remove, a box from the local machine
-  vagrant box list, the locally installed Vagrant boxes

vagrant -help 
- That will provide man pages for a Vagrant command.

Configuration Management Tool : Puppet,  Chef, Ansible, Salt, Docker
vagrant provision, reload --provision 
- provisioning runs on up only

Create own boxes with vagrant or packer
vagrant package
- To create a distribution of the vm you have running.

Vagrant plugin list : click here
vagrant plugin install vagrant-berkshelf
vagrant plugin install vagrant-hostmanager
vagrant plugin install vagrant-omnibus

Vagrant Boxes List : click here

Vagrant Example :

vagrant box add precise32 http://files.vagrantup.com/precise32.box
vagrant init precise32
vagrant up
vagrant ssh
vagrant reload
vagrant provision