Vagrant is a seemingly uncomplicated tool with which you can quickly create virtual environments (based on Vagrant boxes) and customize them. To achieve this Vagrant uses some well-known technologies like VirtualBox, VMware and AWS as providers. These providers actually run virtual machines, vagrant provides unified selection of commands which can be used to manage those VMs. Furthermore you are able to use vagrant boxes from Vagrant cloud repositories which hosts many popular environments such as Ubuntu OS or Django.
If you are developer, Vagrant can help you configure your development environment. All binaries, libraries, editors, debuggers, web-browsers and other requirements can be zipped into single .box file that can be deployed on your laptop with single
Vagrantfile. After running
vagrant up command everything is installed and configured for you to work. No more “let’s give newcomer 5 working days to set everything up” issue. All members of your team will be able to get exactly same development environments on Linux, Windows, Mac OS X in no time.
If you work in operations department or as DevOps Engineer vagrant allows you to quickly create disposable environment for testing purposes. You can test new shell scripts, puppet modules or ansible playbooks without “Huh, I need to update my laptop first” thanks to Vagrant boxes. Your company allows you to use EC2 instances? Even better, vagrant supports them.
When working as architect / designer, Vagrant will set everything up that is required for your application so you can focus on your work. Once a developer configures Vagrant, you do not need to worry about how to get that application running ever again. No more asking other developers “Hey, could you please tell me how to set up this app again?”
vagrant up and you are ready to work.
Vagrant virtual environment (Vagrant boxes) can be packaged up, so you can share it with other team members. For example Vagrant box can be mirror of the production environment with web application deployed, so you can ‘fix bugs in production’ with no risk ;)
Vagrantfile (single plaintext file) is the only source of Vagrant’s configuration. It is easy to understand and yet it is simple to build complex environment.
VirtualBox is one of the providers that Vagrant supports. Think of a provider as a software that actually runs your virtual environment on your laptop. Virtual environment consists of one or more virtual machines connected to each other to provide the desired functionality. For example, the wordpress publishing platform virtual environment will consists of 2 VMs: database and a web server with PHP interpreter, both run by VirtualBox.
Packer is a tool for creating identical machine images for multiple platforms from a single source configuration (template). It is lightweight, runs on major operating systems and highly performant. It supports AMIs, VMDK/VMX, OVF, etc.
Have you ever needed to create custom centos images in a repeatable and automatic way? Packaging up complex software? Here is your tool for that.
Puppet is a configuration management tool used for deploying, configuring, managing nodes (servers). It uses master-slave architecture, where all configuration is stored on master and nodes (puppet agents) poll master server. Puppet is a quite complex tool that will allow you to solve a lot of issues with configuration management, if after reading whole tutorial you will be thinking to start using it, I encourage you to read the product’s documentation .
Someone might ask a question, why learning new things when the old are doing their job well. Answer is pretty simple - if can automate something, just do it (properly!), it will save your time. Take a look at this project. Thanks to automation you can deploy AD based lab in a no time.
OK, after a short introduction it’s time for an action. Let’s prepare a test environment (modern laptop with i5, 8GB of ram and some free hard disk space should do the job). If you have never used the above toolchain, install it.
Linux users can easily install a toolchain via package manager, so let’s not focus on that part. If you are using Windows, go to download page, find your setup.exe, double click on it, go through the wizard and reboot your laptop. Vagrant executable should be ready for you.
Same story. Go to download page, search for windows package, download, double click on setup.exe and go through the wizard.
Packer for windows is distributed as single executable. Go to download page, download zip package, unzip it and add destination directory to %PATH% variable.
For the purpose of this tutorial there is no need to install puppet on your laptop. Puppet will be installed inside virtual environment by vagrant automatically.
OK, all the tools you have installed on your laptop and you are ready to go. Feel free to do some hello worlds (for vagrant that would be
vagrant init hashicorp/precise64,
vagrant up). If you feel ready, go to the second part of the tutorial.