Using Salt Stack and Vagrant for Drupal Development

Package the Updated Box

Now that the guest additions are updated, you should repackage a new box so the guest additions match each time you turn on this Vagrant box. This keeps you from needing to update them every time. As long as you don't change the version of VirtualBox that you are using, you won't need to update your guest additions. If you do, you'll need to update them again.

Using the vagrant package command, export your new box. This will shut down your machine and export a file in the current directory.

Rename this to something more descriptive, like

Now add this new box to Vagrant:

vagrant box add myprecise64

The names you give your boxes are arbitrary and entirely up to you. Feel free to use a description that makes sense to you.

You're done with the original box now, so destroy it with vagrant destroy. You can remove it entirely from Vagrant with vagrant box remove precise64.

Add your new myprecise64 box, or whatever you happened to call it, like you did previously with the base box you downloaded with vagrant box add.

Make sure to change the name in your Vagrantfile to match the new box, and test it with vagrant up.

Congratulations! You now have an updated Ubuntu 12.04 VirtualBox suitable for Salt Stack and Salty-Vagrant automation.

Install the Vagrant Salty-Vagrant Gem

The final piece of software you'll need to install is the Salty-Vagrant gem. It allows the automatic installation of Salt Stack on your guest virtual machines and uses Salt Stack to initiate your configuration and installation of software on them as well.

Back on your host machine (that is, the one that is not your virtual machine), use the Vagrant gem command vagrant gem install vagrant-salt to install the Salty-Vagrant gem.

Add a Salty-Vagrant-Specific Vagrantfile

Now you need to add a slightly customized Vagrantfile to configure some Salt-specific parameters, share your state tree and automatically install Drupal and the Linux Apache MySQL stack after your VirtualBox is started. If you added a Vagrantfile previously, you can delete it now. You're going to add a smaller, more customized one that is available from the Salty-Vagrant project page at You simply can copy and paste this into a new Vagrantfile.

Locate the line = "precise64" and change "precise64" to the name of your box. If you've been following along, earlier in the tutorial, I exported my box as "myprecise64".

I also like to add guest/host network communications with this line to my Vagrantfile too: :hostonly, ""

You can use any available IP address for your internal VirtualBox network. Keep in mind, this is separate from your own network and is created by VirtualBox. This allows you to access your Drupal site from your own operating system's Web browser using the IP address that you specified. You can choose another IP address if you want.

Create Your Minion Configuration File

In the same directory as your Vagrantfile, create a salt directory, srv directory and lamp-drupal directory like this:

mkdir -p salt/srv/lamp-drupal

Create a new minion.conf file in your salt directory that contains this line:

file_client: local

This instructs Salt not to search for a master server, but instead to use the local file structure for its configuration information. This is what you'll see referred to in the Salt Stack documentation as a masterless configuration.

Locate the line in your Vagrantfile labeled salt.minion_conf and uncomment it by removing the #. This tells Vagrant where your minion configuration is located. The path is relative to your Vagrantfile.

Get the State Files

My Drupal SLS file is available in the salt-states repository. You can use this to install all of the needed packages in Ubuntu for Drupal development. Download that file now and place it in your /srv/salt/lamp-drupal directory. You'll also need to create a /srv/salt/top.sls file that looks like this:

     - lamp-drupal

For more details about the top file, see my previously mentioned article about installing Salt Stack.

Add the State File to Your Shared Folder

Within the salt/srv/lamp-drupal directory, copy the init.sls file from the salt-states repository.

This file instructs Salt that when the machine is booted to install all of the needed packages for running a Drupal Web server. I've even included a Drush installation. If you examine the file, you'll find that it is fairly understandable already. I won't go into much more detail here, but feel free to take a look at the init.sls file to see what actually is being installed.

Now edit your Vagrantfile to reflect the location of this state file by editing the line:

config.vm.share_folder "salt_file_root", "/srv", 


config.vm.share_folder "salt_file_root", "/srv/salt", "salt/srv"

Vagrant Up!

With your minion configuration file in place and your state file ready to go, this last step will start your machine automatically, install Salt and install all of the necessary components needed for a Drupal development server.

Ready? Use vagrant up to start your machine.

You can watch the output and responses as Vagrant, Salty-Vagrant and Salt Stack automatically download all of the software you specified and configure it for you.

After the server is started, simply SSH to your virtual server using vagrant ssh again. You'll find a /var/www folder ready to receive your Drupal installation.

This SLS file is reusable across multiple environments, and I haven't configured it to change the permissions of the /var/www folder. You'll notice this folder is owned by root, just like the Ubuntu package manager sets it.

The Drush directory located within the vagrant user's home directory is also owned by root. You'll get an error with Drush if you don't change the ownership of that folder to the user that is initiating the Drush command.


By combining four very powerful tools: Vagrant, Salty-Vagrant, VirtualBox and Salt, you can speed up your Drupal development considerably. Maintaining small development environments and then scripting their configuration helps create a win for everyone involved by adding consistency across all your developers' platforms. Maintaining small, text-based configuration files can save money on storage costs too. You and your developers also can save time transferring new configurations to remote servers.

You can try out new configurations and install additional libraries if you need or want to, without fear of breaking your local or production systems.

Each of the tools I have outlined are available for no cost and are open-source projects. You'll find the Salt development community to be one of the friendliest and most welcoming communities around the Open Source world.

Each project is updated on a regular basis, and it would be a good idea to review the documentation, as well as changes to the software, if you encounter any problems.


Ben Hosmer is a DEVOP with RadiantBlue Technologies where he develops and maintains Drupal sites and administers various servers. He is an open-source advocate and helps spread the use of Linux and other open-source software within the US government.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Network type VM setting should be updated...

Cruz's picture

Thanks for the great tutorial!!

I'm currently using Vagrant version 1.2.4 and it did not like the "hostonly" Network type: Network type 'hostonly' is invalid. Please use a valid network type.

I looked up the online Vagrant docs and found that the correct Network type is: "private_network"

The above VM setting should change...
From: :hostonly, ""
To: :private_network, ""

Thanks again!!


Anonymous's picture

I am very happy to discover this particular post very beneficial personally, as it includes lots of details. I choose to browse the quality articles which issue I ran across in your soul post. Appreciate your expressing!
Learn 2 Backlinks for Seo

Everything is well designed

zeennate's picture

Everything is well designed your site and very nice with many choices, it is a wonder! Congratulations. friendly
voyance gratuitement

use Vagrant

Propeople's picture

Also check out this article about how Vagrant can help you simplify a complex development environment.

Question about a step

Bruno Barrette's picture


First of all, thanks for the article... Currently trying to set this up for some testing, it looks more than interesting.

I have a question though for something that seems to be missing some informaiton...

In the step "Add a Salty-Vagrant-Specific Vagrantfile":

When you're talking about deleting the vagrantfile we already have, just to make sure, you're talking about the one in the salty-vagrant folder, right?

Afterwards, you are redirecting us to take the Vagrantfile from the given URL... What Vagrantfile config should we take? There is a sample one on that page, that doesn't seem to reflect the next directions you give in this tutorial (there is no minion_conf line in this example). There is also one in the exemple folder, should it be this one?

I am up to this point now, hopefully you can provide a clarification on this step.

Thanks in advance,

Reply to comment | Linux Journal

aesthetic dentistry nyc's picture

My family always say that I am killing my time here at net, but I know I am getting knowledge all the time
by reading such nice articles or reviews.

Reply to comment | Linux Journal's picture

Amazing! This blog looks exactly like my old one! It's on a completely different subject but it has pretty much the same layout and design. Wonderful choice of colors!

Have you tried Boxen? It's a

Adam Gerthel's picture

Have you tried Boxen? It's a dev toolkit made by Github in order to easily set up dev environments, and it uses Puppet. It solves the same problem in a way that Vagrant does, but made for OSX.

Please correct the URL for Salt Stack's web site

Anonymous's picture

The article text has a URL for Salt Stack with a typo. Please change it to and delete this comment.

Automatically updating Guest Additions

Bert VV's picture

Nice article, thanks for sharing. Especially the part about Salt is interesting.

There's a Vagrant plugin that can automatically update VirtualBox Guest Additions:

Every time you boot a box, it checks the version and updates when necessary.


Reply to comment | Linux Journal

what to say to beautiful women's picture

Great article! We are linking to this particularly great post on our site.
Keep up the great writing.

Reply to comment | Linux Journal

Samantha's picture

I'm not sure why but this site is loading extremely slow for me. Is anyone else having this issue or is it a issue on my end? I'll check back lateг
аnd sеe if the pгoblem ѕtill ехists.