May 7, 2014 · puppet vagrant configuration management

Configuring a Single Server

We know that if we're managing a cluster of similar machines we need a configuration management tool (CTL) such as Puppet, Chef or Ansible. But what if we have a single machine where we run our services, a snowflake server?

In my experience, if that server is used in production it's still worth it:

Of course, you'll have to learn a new language, and writing all the configuration and verifying that everything works will take much longer than if you were doing it directly on the machine, especially in the beginning.

Another problem is there might be some differences between the Vagrant and the production box. For example, Vagrant will make sure to have your CTL of choice when booting the machine, but this won't probably be the case if you pick a stock operating system.

Finally, you might find some steps that you won't be able to do with a CTL. For example, I haven't found the way to programatically install Java 8, because during the installation is required to accept the licence. In those cases, you might try to find a dirty hack that solves your problem or document the steps in a text file.

Remember that even if you only get to automate 80% of the process, you'll already be in a much better position when you need to redeploy your server.

Example setup with Vagrant

With all this in mind, here's a sample setup that has worked well for me.


Since I use Puppet, manifests and modules directories contain the recipes with the configuration. Those will change if you use another CTL.

The Vagrantfile contains the configuration of the Vagrant box. I like to leave it as default as I can, just defining a private network IP and the Puppet configuration options.

The readme.txt file documents all the steps that I couldn't automate and any information that I need to remember when it's time to deploy the server. Because I know that I'll forget it otherwise.

Finally, the script is the one I use to configure the production machine. Usually contains the following steps: installing Puppet and git, cloning/pulling from the repository that contains the configuration and performing puppet apply.

Comments powered by Disqus