A Fresh Start with Ansible
A guide to using Ansible to automatically setup your OSX development environment
It’s Spring, a time for fresh beginnings. Today we are going to look at setting up a clean OSX development environment using Ansible.
Ansible is a technology used in the DevOps world for deploying applications and managing environments. It is a non-intrusive technology in that changes are pushed to target machines via SSH rather than requiring agents to be installed on each. In it’s simpliest form Ansible can be viewed as distributed SSH with a Galaxy of modules for supporting common tasks like working with files, installing applications, provisioning on cloud platforms etc.
As we will be formatting the hard drive which will wipe all information, it’s prudent to backup any important files along with your current profile.
For example, I copied the following files to a USB drive mounted on /Volumes/backup
Creating a Mac OSX install disk
Next we wish to create a bootable USB drive with the OSX installer. Please use a USB drive without any important information as the drive will be erased by following steps.
- Download El Capitan installer from the App store
- Insert a 8GB or larger USB drive
- Create Bootable OSX disk
- Follow instructions to setup bootable OSX disk
- Restart Mac and pressing the options ⌥ key
- Select to boot from El Capitan Installer and follow instuctions to do a clean install of OSX
- Wait until install is complete
- Add a network cable or WIFI settings for your local network
Installing ansible using homebrew
Now we are going to use Homebrew (a package manager for OSX) to install ansible. Run the following inside your terminal:
Playbook - what tasks to perform
A playbook is a set of instructions which tell Ansible what to do. We wish to install all the applications we use via Homebrew and reinstate our profile.
Inventory - where to run playbook against
An inventory file defines the machines and groups of machine on which you wish to run a playbook against. As we are wishing to setup the local machine create a file called
inventory with the following content:
Running the Play book
Execute the following script and watch as all your applications and profile are setup: