Appendix A. Using Vagrant to Run Salt Examples

There are many options for setting up a suite of minions to use in the examples. Vagrant is a great solution that runs on top of a free virtual machine manager called VirtualBox.

There is a Git repo at GitHub that contains the companion code for this book.

Install Companion Code, VirtualBox, and Vagrant

To get started, simply clone the repo to your local machine:

git clone https://github.com/craig5/salt-essentials-utils

You will also need to install Vagrant and VirtualBox using the instructions on their respective websites.

Once you have all three pieces ready, you can start up the virtual machines used in the examples with:

host$ cd salt-essentials-utils/virtual-machines/
host$ vagrant up

This will download the base images and create a master running CentOS 6.6, two minions also running CentOS 6.6, and two more minions running Ubuntu Trusty Tahr (14.04).

Warning

The virtual machines do require unused memory if you do not want to degrade the performance of your host machine. Each node will use 512 MB of RAM. If you are not able to spare that much memory, consider running only a single minion of each OS type. You will have to modify the example accordingly.

Configure Salt

Once you have the virtual machines set up, you will need to install Salt on each one. Fortunately, the example code is made available to each host via a special mount: /srv/se-book. There is a setup script in the bin directory that will configure each host:

Get Salt Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.