Automating macOS setup with Ansible Pull
· 2 min read
The problem
I've been using macOS for three years and I'm on my fifth laptop replacement across two jobs. Moving to a new one is always a bit of a hassle, especially without a spare personal laptop :)
I'm not keen on restoring from Time Machine snapshots. I like treating my workstation more like a server: keep it as stateless as practical and configure it with IaC.
The setup
I ended up with a simple setup:
- A local cron job runs
ansible-pull -U https://github.com/kb play.yml. - Ansible clones the repository and runs the playbook at the specified path. In my setup it applies to localhost.
Takeaways
- Keeping my workstation setup in IaC, including software, GUI apps, and config files, feels like a good investment.
- It's convenient to apply IaC in a GitOps style, with configuration applied automatically to maintain the desired state. Here Ansible provides the automation without a full GitOps controller.