Ansible.cfg and Python set-up OSX

MacOSX: 10.12.6
Iterm2:bash shell
Vagrant 2.0.2
ansible version: 2.4.3.0
pip version: 10.0.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
pyenv version: 1.2.3
Python versions: installed:system
* 2.7.10 (set by /Users/username/.python-version)
  2.7.5 
Python -V:2.7.15

Typically as of late(last 24months or so) 99% of the time docker is my go to for local development as a VM and deployment. But decided to try out a more “traditional” VM and Vagrant env to do some testing and deployment on and feel out the differences pros, cons, etc. In the Process some issues came up which are concerning, as I am not that familiar with the environment set-up and particularly ansible and Python.
I have read over a lot of the ansible docs and looked over ansible_shell_executable and Enviormental variables but that doesn’t seem to draw the answer I am seeking.

I would imagine there is way to reconfigure for ansible with out have to reinstall the env or Python. Python env and development is not my strong suite, relative newbie in the Python World.
I am trying to set up a Vagrant LEMP Stack for WordPress that uses anisble-galaxy to provision the VM. Towards the end of the install it says

[WARNING]: Failure using method (v2_playbook_on_play_start) in callback plugin
    (<ansible.plugins.callback.vars.CallbackModule object at 0x10e7c3dd8>): 'dict'
    object has no attribute 'iteritems'

then;

ERROR! Trellis does not yet support Python 3.6.5.
Please use Python 2.7.
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.`

Obviously this is a error with Trellis not supporting python 3.* yet and that is nothing to do with ansible.

But apparently Python 3.6.5 has become installed(possible the default of OSX ?) and is the $PATH ansible-playbook is using for its Python version.
I am trying to find the appropriate way to not mess up my Python $PATHS but also figure out maybe a proper Python set-up locally ? As I 95% use nvm and node.js.
Also any advice of environmental set-up for ansible or how to ad a proper re-config $PATH to ansible.cfg file to use 2.7.* for future use.

Any help or advice for configuring an env variable for anisble in this situation or proper set up for python versions and $PATHS would be greatly appreciated.

Please do some searches on this forum, there are existing threads that will be able to guide you :slight_smile:

1 Like