Recently after moving companies, I realised how cumbersome it is to setup up a new development machine with the right tools and software, configured just the way you like it. After a week or so of working on different projects, it soon becomes apparent of how much time is invested in remembering, downloading, configuring and maintaining everything.
Rather than starting from scratch, only to have to repeat myself again in future, I decided to use Ansible. I have previously covered Ansible, but after reading this article by Nick Hammond I decided that I could do the same. Everytime I installed something new, I added it to my playbook. This started off very basic at first with packages like the latest version of PHP, Node.js and SASS and has become more extensive over time. Ansible also has support for Homebrew Cask out of the box, which means that I can also keep track of my desktop applications like Dropbox, Vagrant and iTerm2.
Below is a short example of my playbook tasks for installing Homebrew and Homebrew Cask packages:
- name: Install packages from Homebrew
homebrew: name= state=present update_homebrew=yes
- name: Install Brew Cask packages
homebrew_cask: name= state=present
In future I hope to add more, including:
- Maintaining dotfiles from a Github repo, with automatic updating and symlinking
- Start services on login, such as MySQL Server, Redis etc.
- Managing OS X configuration options using osx_defaults
This is all open source and can be found on Github. The great thing about Ansible, is that it is Immutable, I can run it over and over again without having to worry about re-applying and breaking the state of my machine, or having packages or applications installed multiple times. As an added bonus, I can add new tools that I find whilst at work, and have them automatically install on my Macbook at home the next time the provisioning task is run (or scheduled as a recurring task).
If you think you can improve anything, or suggest more things to be added and maintained, please leave a comment below, star the project on Github or open a pull request.
Originally published at steveedson.co.uk.