mac-dev-playbook icon indicating copy to clipboard operation
mac-dev-playbook copied to clipboard

Document running playbook against local macOS VM for testing

Open geerlingguy opened this issue 3 years ago • 3 comments

I recently had some time to play around with virtualization options on M1, and thought I'd document some tests I'm doing with this playbook against different macOS instances running inside VMs.

For now, I'm looking at Tart and UTM.

geerlingguy avatar Jul 29 '22 16:07 geerlingguy

Tart installation is simple:

brew install cirruslabs/cli/tart
tart clone ghcr.io/cirruslabs/macos-monterey-base:latest monterey-base
tart run monterey-base

A VM is brought up with the default login admin/admin, with Remote Login on, and an IP address (at least in my case) of 192.168.64.2. It looks like the VM framework sets up a bridge100 network on the host (found using ifconfig).

Screen Shot 2022-07-29 at 11 43 51 AM

I can ssh into the VM with ssh [email protected].

To run mac-dev-playbook against the VM from my Mac, I cloned this project, then changed the inventory file:

[all]
192.168.64.2  ansible_user=admin

Then I ran the playbook:

ansible-playbook main.yml --ask-pass

(To use a password instead of an SSH key I installed brew install hudochenkov/sshpass/sshpass.)

Everything worked great!

Screen Shot 2022-07-29 at 11 50 17 AM

Now I'm considering whether it would be simpler to set up a VM in CI too, so the test rig would be identical between GitHub Actions and local!

geerlingguy avatar Jul 29 '22 16:07 geerlingguy

@geerlingguy this is great! Doing a quick scan here i didn't see any obvious hits, but i wonder if you've ever laid out how to do this on an intel chip. I've done a bit of googling but finding the os x images is a pain. I wish there were something like tart that just "handled" it. Do you have some resources you might share that would cut down on the google guff?

archae0pteryx avatar Sep 23 '22 14:09 archae0pteryx

@archae0pteryx - I used to use https://github.com/geerlingguy/macos-virtualbox-vm but it was getting a bit complicated to try to set up a VM on Intel macOS :(

geerlingguy avatar Sep 23 '22 15:09 geerlingguy