Monday, 24 December 2018

Vagrant Interview Questions


1) What is Vagrant?

A) Vagrant is an open-source software product for building and maintaining portable virtual software development environments, e.g. for VirtualBox, Hyper-V, Docker, VMware, and AWS.

2) Vagrant is written in which language?

A) Vagrant is written in Ruby language.

3) What is a BOX in Vagrant?

A) A box is a packaged Vagrant environment, typically a virtual machine.

4) What is Provider in Vagrant?

A) A provider is the location in which the virtual environment runs. It can be local (the default is to use VirtualBox), remote, or even a special case like a Docker container.

5) What is Provisioner in Vagrant?

A) A provisioner is a tool to set up the virtual environment, and can be as simple as a shell script, but alternatively a more advanced tool like Chef, Puppet, or Ansible can be used.

6) What are the subcommands associated with Box command?

A) Box command used to manage (add, remove, etc.) boxes.
Command: vagrant box
The main functionality of this command is exposed via even more subcommands:
Ø  add
Ø  list
Ø  outdated
Ø  prune
Ø  remove
Ø  repackage
Ø  update

7) Explain Box Add Command in Vagrant?

A) Command: vagrant box add ADDRESS
This adds a box with the given address to Vagrant. The address can be one of three things:
·         A shorthand name from the public catalog of available Vagrant images, such as "hashicorp/precise64".
·         File path or HTTP URL to a box in a catalog. For HTTP, basic authentication is supported and http_proxyenvironmental variables are respected. HTTPS is also supported.

·         URL directly a box file. In this case, you must specify a --name flag (see below) and versioning/updates will not work.

8) What is Box List command in Vagrant?

A) Command: vagrant box list
This command lists all the boxes that are installed into Vagrant.

9) What is Box Outdated command in Vagrant?

A) Command: vagrant box outdated
This command tells you whether or not the box you are using in your current Vagrant environment is outdated.

10) What is Box Prune command in Vagrant?

A) Command: vagrant box prune
This command removes old versions of installed boxes. If the box is currently in use vagrant will ask for confirmation.

11) What is Box Remove command in Vagrant?

A) Command: vagrant box remove NAME
This command removes a box from Vagrant that matches the given name.

12) What is Box Repackage command in Vagrant?

A) Command: vagrant box repackage NAME PROVIDER VERSION
This command repackages the given box and puts it in the current directory so you can redistribute it. The name, provider, and version of the box can be retrieved using vagrant box list.

13) What is Box Update command in Vagrant?

A) Command: vagrant box update
This command updates the box for the current Vagrant environment if there are updates available.

14) What is Connect command in Vagrant?

A) Command: vagrant connect NAME
The connect command complements the share command by enabling access to shared environments.

15) Destroy command in Vagrant

A) Command: vagrant destroy [name|id]

16) Global Status command in Vagrant

A) Command: vagrant global-status

17) What is Vagrant Share?

A) Vagrant Share allows you to share your Vagrant environment with anyone in the world, enabling collaboration directly in your Vagrant environment in almost any network environment with just a single command: vagrant share.
This command will tell you the state of all active Vagrant environments on the system for the currently logged in user.
This command stops the running machine Vagrant is managing and destroys all resources that were created during the machine creation process.

18) What is Vagrantfile?

A) The primary function of the Vagrantfile is to describe the type of machine required for a project, and how to configure and provision these machines.

19) What is Provisioning in Vagrant?

A) Provisioners in Vagrant allow you to automatically install software, alter configurations, and more on the machine as part of the vagrant up process.

20) What are Synced Folders in Vagrant?

A) Synced folders enable Vagrant to sync a folder on the host machine to the guest machine, allowing you to continue working on your project’s files on your host machine, but use the resources in the guest machine to compile or run your project.

21) What is Multi-Machine environment in Vagrant?

A) Vagrant is able to define and control multiple guest machines per Vagrantfile. This is known as a “multi-machine” environment.
These machines are generally able to work together or are somehow associated with each other. Here are some use-cases people are using multi-machine environments for today:
Accurately modeling a multi-server production topology, such as separating a web and database server.
Modeling a distributed system and how they interact with each other.
Testing an interface, such as an API to a service component.
Disaster-case testing: machines dying, network partitions, slow networks, inconsistent world views, etc.

22) How do you define multiple machines in Vagrant?

A) Multiple machines are defined within the same project Vagrantfile using the config.vm.define method call.

23) What are Providers in Vagrant?


A) While Vagrant ships out of the box with support for VirtualBox, Hyper-V, and Docker, Vagrant has the ability to manage other types of machines as well. This is done by using other providers with Vagrant.

24) What are Plugins in Vagrant and how they assist?

A) Vagrant comes with many great features out of the box to get your environments up and running. Sometimes, however, you want to change the way Vagrant does something or add additional functionality to Vagrant. This can be done via Vagrant plugins.

25) What is Vagrant Push?

A) Vagrant is capable of deploying or “pushing” application code in the same directory as your Vagrantfile to a remote such as an FTP server.
Pushes are defined in an application’s Vagrantfile and are invoked using the vagrant push subcommand.

26) What is vagrant in DevOps?

A) DevOps is a lot more than configuration management.  Vagrant is another tool to help your organization transition to a DevOps culture. Vagrant also helps improve your entire workflow of using Puppet, improving development and process for both developers and operations.

27) What is a vagrant image?

A) The Vagrantfile has some information that will be merged into your Vagrantfile that is created when you run vagrant init boxname in a folder. The box-disk.vmdk is the virtual hard disk drive. The box.ovf defines the virtual hardware for thebox.