Skip to main content

Small talk on Vagrant

Intro:

Vagrant is a tool for building and managing virtual machine environments.
A modular framework to work with virtual machines.


Why to use Vagrant :

- No need to learn different CLI command of Virtualization providers , vagrant takes cares to manage the underlying VM's with its easy CLI interface. Commands are like,
vagrant up
vagrant ssh

- Well defined environments as configuration used to create the environments is in simple text files. User can recreate as many Vagrant Instances (VMs) using same Vagrant file .

- Vagrant is capable of executing configuration management software like Puppet/Ansible/Chef once the base system is ready (using box). This help o setup the environment (System + Application) on the target machines in automated way.

- Developer can create/destroy multiple development environments in minutes.

- As vagrant is wrapper only , you can choose the guest OS images supported by the virtualization platform you choice. Example on CentOS 8, you may run CentOS 7 VM.

The most important concepts of vagrant are,
  • providers
  • provisioners

Providers

  • Who provides virtualization support
  • They magic VMs into existence
  • It falls into two category Local or Remote
    • Local providers are VirtualBox, VMWare, Docker
    • Remote providers are AWS, Openstack

Provisioners

  • Provision the VMs
  • They shared, repeatable configurations of VMs
  • Some provisioners are SHELL, ansible.

Steps to use Vagrant:

1] Initiate vagrant to get vagrant file.

$vagrant init -m <image-name>

2] After initialising vagrant, you will get a vagrant file. We have to update vagrant file with the configurations.

cat vagrantfile

3] Then, we have to up the vagrant. This will bring up the instance.

vagrant up

4] Later we have to ssh to the instance using "vagrant ssh" command.
x

Comments