1

Using MacOS as my primary machine, I would like to use Ansible.

Glancing over tutorials I get the impression that running Ansible from Ubuntu (or in my case: a dedicated virtual machine running Ubuntu) will be more practical than installing and running it on my Mac. Although the installation on a Mac is easy (via pip install or brew install, I need extra configuration to make paths work. On an Ubuntu machine I would have to specify the hosts / remote machines in /etc/ansible/hosts. On my Mac I would have to do extra steps.

So my question: Does it make sense to create a dedicated VM for running Ansible? Or is it fairly easy to run it from my Mac directly?

3

I'd run it from a Ubuntu VM. If you use connection: local or delegate_to: localhost you will be executing on the Mac or Ubuntu VM. Even with homebrew, the Mac userland can be interesting, to say the least, with ancient versions of software. For example I was (unwittingly) using macos's version of tail and was surprised by its lack of features. (Homebrew's version is called gtail to avoid naming conflict.)

If you do choose to use the Mac, I'd at least use a python virtual environment (anaconda, pyenv, etc) to handle the miriad of python modules used by ansible without version conflicts.

1

I don't see how it's any more work to run it from a Mac than Ubuntu. Maybe I am missing something.

You mention /etc/ansible/hosts, but that isn't necessary for a single-user control node. That would be useful if you have a shared control node where other users will leverage the same inventory.

Even then, you could put the Ansible configuration, inventory file, and Playbooks in a single directory under version control. Each user could clone the repository and run it from their local systems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.