Created
July 28, 2016 11:29
-
-
Save ekollof/6590f4ae02ac56225c164d3eb5518772 to your computer and use it in GitHub Desktop.
Find python interpreter and use it (useful when mixing Linux/BSD/Solaris/etc hosts)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: all | |
gather_facts: false | |
tasks: | |
- raw: which {{item}} | |
register: mypython | |
ignore_errors: True | |
with_items: | |
- python | |
- python2 | |
- python2.7 | |
- python27 | |
- python2.6 | |
- python26 | |
- set_fact: ansible_python_interpreter={{(mypython.results|rejectattr('rc')|list|first).stdout.strip()|default(omit)}} | |
- debug: var=ansible_python_interpreter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment