I’ve mentioned that I decided to use Ansible for my server configuration management. This installation has finally bubbled up as the first item on my to-do list. I looked around to see how to install it. Since I already have Homebrew installed on my mac, I saw two options:
- > brew install ansible
- > pip3 install ansible
I did not know any reason why these would be different, so I went ahead and ran ‘> brew install ansible’. That was a mistake. Ansible lists Python 2 as a dependency, which is not included in my Homebrew installation. Homebrew installs Python 2.7.13. I also have Python 3 running (3.6.2). I also found out there’s a third version of Python (2.7.10) which is part of the default installation in my laptop. 3 versions of Python on one machine. Wonderful!
I created a /etc/ansible/hosts file and did a test ping, which returns UNREACHABLE. That makes no sense, but I think I have to use some command line options to use the correct account.
Also, I don’t know which version of ansible is running. I may want to remove the Homebrew version and figure out how to use the python3 version. What a mess.
After a day of thought, I decided to check a few things:
> ansible —version
> ansible 184.108.40.206 (good)
… python version = 3.6.2 (what? Why not 2.7.13 or 2.7.10? Interesting.)
I checked the documents page at ansible.com. They say that ansible can run with python3 in one of two ways:
- > python3 <path/to/ansible> localhost -m ping
- > ansible localhost -m ping -e ‘ansible_python_interpreter=<path/to/python3>
To see what happens, I also tried
- > ansible localhost -m ping
It turns out all return good pings from localhost, so … I guess my installation is OK. Even so, next time, avoid using Homebrew for ansible installations.