ansible 2.3.1.0
python 2.7.14
I'm just wondering the best approach to handling a multi-OS
environment where python interpreters are located at different paths:
Linux:
/usr/bin/python
OpenBSD, FreeBSD
/usr/local/bin/python
macOS w/Homebrew
/usr/local/bin/python2
...and ansible_python_interpreter needs to be overridden on a large
part of the environment.
In this deployment I strongly want to use the approach like in [1] to
group hosts by OS using ansible_distribution fact, so I want to avoid
static declarations in inventory files and would like this to be able
to be specified in something like group_vars/Linux,
group_vars/OpenBSD, etc. leveraging ansible_distribution groupings.
Is there a way to achieve this? Or is it a chicken and egg problem
that requires inventory specifications because the
ansible_distribution cannot be known prior to invoking Python?
[1] https://github.com/ansible/ansible-examples/blob/master/language_features/group_by.yml