Hello everybody,

I have a custom module and would like to set the ansible_python_interpreter 
variable 
from within a corresponding action plugin.
This is what I do in the action plugin:

task_vars_modified = task_vars.copy()
task_vars_modified['ansible_python_interpreter'] = '<path/to/my/python>'
result = merge_hash(result, self._execute_module(module_args=module_args, 
task_vars=task_vars_modified))

Unfortunately this has no effect. Using the playbook debugger I can verify 
that ansible_python_interpreter is not set for the module.
I am sure that the action plugin is called.
What am I doing wrong?
Is it possible at all to modify task_vars? I cannot find an example for 
this approach.

Background:
My custom module makes use of some python modules. I do not want to install 
these modules globally so I'm using a virtual environment.
Obviously now the ansible module needs to use the python binary within the 
virtual environment.
I would like to encapsulate this so that the user does not have to remember 
to set ansible_python_interpreter each time he uses the module.

Thanks and Regards,
Carsten

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/12ecebdd-cabd-49ea-8eb4-725cd3b086fbo%40googlegroups.com.

Reply via email to