anyway to run different tasks with different interpreters (ex: yum using py2.6, get_url using py2.7)

Hello,
I’ve to maintain some node running on Centos 6 with Python 2.6 as default python.
My problem is due to SSL download using gt_url that require Python 2.7.9+ to work (related to SNI trouble).

Aim :

  • run all yum tasks with default Python (2.6, it’s a system requirement)
  • run all get_url tasks with Python 2.7 (required to have ssl working due to SNI)

Tried using ansible_python_interpreter, but it looks global (for all modules/tasks).

it is also a host variable, so it is settable as a normal var in play, just try setting it at the tasks you need

  • yum: …
    vars:
    ansible_python_interpreter: /usr/bin/python2212