Open yodatak opened 5 years ago
Mitogen does not render host_vars, in this case ansible_python_interpreter.
In my case I had to add host_vars/localhost
containing:
ansible_python_interpreter: "{{ ansible_playbook_python }}"
This is a workaround to 2.8 bug with local_action and it works without mitogen, but fails with mitogen, the var is not being interpreted:
msg: 'Child start failed: [Errno 2] No such file or directory. Command was: {{ ansible_playbook_python }} -c "import codecs,os,sys;_=codecs.decode;exec(_(_(\"..........
Hi there!
Do you have a reference for the upstream bug? I could not find anything in their issue tracker.
It is possible to support this, and it might even be possible to support it without destroying performance, but I'd like to understand what the use case is before adding it.
If it's just a workaround for a temporary bug upstream, then I would much prefer to keep any templating out of the connection layer.
If on the other hand a genuine use case exists, we can look at ways of supporting it, perhaps on a variable-by-variable basis, hopefully without impacting performance too much.
Template expansion performance in upstream Ansible is abysmal. Putting that in the connection layer in Mitogen is going to hurt everybody
Sorta this https://github.com/ansible/ansible/issues/59434 Of course they will fix the discovery eventually, but currently it might be useful to interoperate playbooks between control hosts with different python paths by always using playbook's python for localhost via a var.
It seems the problem here is quite similar to the problem in https://github.com/dw/mitogen/pull/515 , so that is 2 use cases where templating is required.
It looks like it may be simpler to implement this than trying to avoid it any longer, perhaps something like:
Ansible's templating (Templar) makes heavy use of the plugin loader, so even templating a single simple variable will introduce a ton of overhead.
I will do some profiling to figure out how much this will hurt (if indeed it hurts at all, but fairly certain it will)
For my part i fix in using host_vars folder and in localhost fileansible_python_interpreter: python2
but i think its still a issue ?
Which version of Ansible are you running? 2.8
Have you tried the latest master version from Git? yes master