For even longer than I have been using Ansible to manage my macOS setup, I have been using the same process for Debian (was previously Ubuntu, but was converted). I have also put a Vagrant configuration around it so I can test the inclusion of packages prior to running on my actual machine.
For quite some time I have been using Ansible to manage my OS X / macOS setup. Though fiddly, I have also put a Vagrant configuration around it so I can test the inclusion of packages prior to running on my actual machine.
A few years back I knocked together this quick Vagrant setup to introduce some peeps to the joy of the linux command-line.
https://github.com/svo/command-line-tools-buzz-session