Using Ansible to create a Linux development environment to develop with Node.js, GoLang, Ruby, Docker was on my list of to-dos for sometime and just moved up in priority. I know very soon I will have to switch back from Linux to OS/X as my primary machine. Been there before and really prefer using tools under Linux rather then OS/X. Brew is fine and I will eventually try and set up everything native on OS/X. Since I have the time I thought it would be a good idea to try and build a development environment using Ansible that can be spun up using Vagrant on Docker or Virtualbox.
Ansible is a provisioning system such as Chef, Puppet and Salt. What is nice is I don’t have to bootstrap the box before provisioning. So I started out looking at other folks Ansible projects on GitHub (just search for “devbox ansible”) and see how folks were making their scripts. I decided to take one of the projects, samuell/devbox-golang and heavily modified it to my liking. The result is an Vagrant script that will invoke the Ansible script to build out a Docker image or Virtualbox VM with Ubuntu 14.04 and all the development tools I typically use.
Most of the Ansible scripts are pretty simple. I swapped out Samuell’s GoLang role for one from Ansible Galaxy. No need for reinventing the wheel. The bulk of the customization of my environment is found in roles/dotfiles. Here I have all my dotfiles and a script to deploy them on the Vagrant image. Eventually I would like to have this setup to use vcsh and mr to have direct git repos in the home directory as I described in my blog post, “Managing Dotfile Across Multiple Platforms“. This is really handy when you update .zshrc or .nvimrc file you can commit the change and push it up to github immediately so I can pull the change on other environments. Right now the dotfiles are part of the repo.
Source can be found at github.com/geoffcorey/devbox-ansible If you want to fork or just use it as a starting point just note that vars/user.yml needs to exist so I can close my github.com/geoffcorey/bin repo. Eventually it will also be used to clone a pass repo I use on BitBucket.
Current setup can be found in the README.md but the image defaults to zsh, git, mecurial, bzr, subversion, neovim with a ton of plugins, tmux, golang, nvm/node.js, rvm/ruby, python2.7, python3 and database clients for mongodb, postgresql, mysql, redis
Update 07/2019 - This method was quickly abandoned in favor of using mr, vcsh and git.