/vagrant-ansible-playbooks

Ansible playbooks to set up my development environments using Vagrant

Primary LanguageShellMIT LicenseMIT

About this repo

This repo is intended to hold some Ansible playbooks and roles to build my development environments with Vagrant.

Roles

rails-dev role

This role turns a Debian/Ubuntu machine into an environment to develop Ruby web applications (Ruby on Rails, Sinatra, etc.). It relies in 'ruby' and 'headless' roles.

It includes:

  • Some basic tools as tmux, Vim, GNU Emacs, Git and Zsh.
  • chruby and ruby-install to manage Ruby versions (also the last 2.1.x available version is installed).
  • PostgreSQL including development libraries. A user called rails with password vagrant is also set up.
  • SQLite including development libraries.
  • Some packages as libxslt1-dev or libxml2-dev that are useful to build some gems.

ruby role

headless role

Install and set up some browsers so you can drive integrations tests in 'headless' mode. It includes:

  • PhantomJS to drive integration tests without X.
  • Firefox
  • Webkit
  • Xvfb, so you can use Firefox or Webkit in your tests. It also adds a xvfb service so it's enabled during boot time. These tools are not installed by default.
  • x11vnc to access to the Xvfb server through VNC.

nodejs role

Install NodeJS and npm from Joyent's repository. It also the following packages through npm:

Usage

These playbooks are known to work on Debian "Wheezy" and Ubuntu Trusty.

If you're using Vagrant, you could rely on the Vagrantfile included in this repository. Just set the config.vm.box parameter and try to bring up the machine:

vagrant up rails

Now it's time to grab a coffee, a beer or whatever you like the most. And good luck!

Customization

You can enable/disable or tweak the installation of those tools by settings some variables. The files on vars directories are self-explanatory. A file in host_vars is the right place to override default variables.

Disclaimer

I've written this playbooks in a "works for me" fashion :). It's also the first time I use Ansible and I fear that I've not followed the best practices.