My Ansible dev set-up
When I first started using Ansible it was mainly for DevOps related tasks. Automate this, set up that, it popped up every time I needed something automated. After a while, I found an article by someone who used Ansible for setting up his personal machine, which inspired me to do the same soon after.
As I was a Linux user at the time the scope of the set up was fairly limited since the installation of applications on Linux is a bit quirky at times. However, since I switched over to macOS a whole new world opened due to the almost unlimited supply of Homebrew and Caskroom packages. Everything I needed to have installed, was found on there.
For those who aren’t familiar with Ansible, it basically consists of a “playbook” that defines “roles” that need to be executed. The roles have “tasks” assigned to them, which are the actual commands that will be executed. I know it’s capable of so much more than simple scripting, but for the sake of this article lets assume this is it.
In my case I set up several roles that set up my development machine, ranging from installing applications through Homebrew to installing Node.js, Ruby and setting all my configuration files. It’s handy and takes a relatively small amount of time to set up and maintain. All you have to do is make sure that any changes you make locally are also reflected in your playbook so that you always have an up to date Ansible script.
I’ve set my Ansible playbook up so that it installs all my Homebrew / Caskroom packages, Node.js, Ruby and configures all my dot-files, configuration and preferences. And last but not least, also makes sure that my SSH and GPG keys are installed correctly. All I have to do is set some environment variables, run the playbook and wait for approximately 20 minutes until it is finished.
If you’re interested, you can look at my development machine set up right here at Github.