In this tutorial I will demonstrate how to use Ansible for Homebrew Configuration Management. The aim for using Ansible to manage your homebrew packages helps you to have a consistent list of packages on your macbook.
For me personally, when I get a new laptop it’s always a mission to get the same packages installed as what I had before, and ansible solves that for us to have all our packages defined in configuration management.
Install Ansible
Install ansible with python and pip:
1
|
|
Ansible Configuration
Create the ansible.cfg
configuration file:
1 2 3 |
|
Our inventory.ini
will define the information about our target host, which will be localhost as we are using ansible to run against our local target which is our macbook:
1 2 3 4 5 |
|
Ansible Playbook
Our playbook homebrew.yaml
will define the tasks to add the homebrew taps, cask packages and homebrew packages. You can change the packages as you desire, but these are the ones that I use:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
Deploy Playbook
Now you can run the playbook using:
1
|
|
Source Code
The code can be found in my github repository: - https://github.com/ruanbekker/ansible-macbook-setup
Thanks
Thanks for reading, feel free to check out my website, feel free to subscribe to my newsletter or follow me at @ruanbekker on Twitter.