mitogen-hq / mitogen

Distributed self-replicating programs in Python
https://mitogen.networkgenomics.com/
BSD 3-Clause "New" or "Revised" License
2.34k stars 199 forks source link

Mitogen does not template-expand connection variables #599

Open yodatak opened 5 years ago

yodatak commented 5 years ago
- name: certifcate check
  local_action: stat path="{{ role_path }}/files/ssl/{{ ansible_hostname }}.crt"
  register: cert_file
TASK [ ssl check] ************
task path: /ansible/roles/prereqs/tasks/ssl.yml:2
[task 8881] 11:19:12.538234 D mitogen: unix.connect(path='/tmp/mitogen_unix_qps8rg.sock')
[task 8881] 11:19:12.539201 D mitogen: unix.connect(): local ID is 2051, remote is 0
[mux  8389] 11:19:12.539174 D mitogen: mitogen.unix.Listener('/tmp/mitogen_unix_qps8rg.sock'): accepted mitogen.core.Stream('unix_client.8881')
[mux  8389] 11:19:12.541293 D mitogen: mitogen.parent.Stream('default').connect()
[task 8881] 11:19:12.573746 D mitogen: mitogen.core.Stream('unix_listener.8389').on_disconnect()
[task 8881] 11:19:12.574181 D mitogen: Waker(Broker(0x74081d0) rfd=11, wfd=13).on_disconnect()
[task 8881] 11:19:12.574556 D mitogen: Router(Broker(0x74081d0)): stats: 0 module requests in 0 ms, 0 sent (0 ms minify time), 0 negative responses. Sent 0.0 kb total, 0.0 kb avg.
[mux  8389] 11:19:12.574246 D mitogen: mitogen.core.Stream('unix_client.8881').on_disconnect()
fatal: [XXXXXXXX]: UNREACHABLE! => {
    "changed": false, 
    "unreachable": true
}

MSG:

Child start failed: [Errno 2] No such file or directory. Command was: {{ansible_playbook_python}} -c "import codecs,os,sys;_=codecs.decode;exec(_(_(\"eNqFkVFPwjAUhZ/Zr9jbbUMDG1ODS5poeDA+GJPFyAMSs9FOG0bbdIMKv97LMLLhg2/3yz235+Q0Y3Nu6pFVVhIaOOY7pMoQoTRuTWgaDHAWWzshEYujiJ45Y11yuI1PvKpMLUnWBdeFeRc8AhrWe7Sv8gZdNyHnIYjceaUhzLVol/JLrrZNXlSyXY+3tRsXSo/tvvk0GjDn4EI25O3hTrpaGb1Ik2VrK/VOOWS4zx5eI1jy/tlJg1iR/oL1cQhkoxrzIXXqZZGLzd1BiiSZuHU6Taa3FGiAD3mnGkliBk+PL89RFL1pwAArI7BnGsz4Ozk2LYyVGvsFVwAdOZkLEl9Pr24og4Oy+FJp+Vk3Z+ALOJZf2h+DWTufCr1Q+//Uf1PG/ZS/XzWh3/oasVA=\".encode(),\"base64\"),\"zip\"))"

NO MORE HOSTS LEFT *************************************************************

PLAY RECAP *********************************************************************
localhost                  : ok=24   changed=9    unreachable=0    failed=0    skipped=13   rescued=0    ignored=0   
XXXXXXXX                   : ok=66   changed=7    unreachable=1    failed=0    skipped=15   rescued=0    ignored=0   

[mux  8389] 11:19:12.658943 D mitogen: Waker(Broker(0x765ac50) rfd=9, wfd=11).on_disconnect()
[mux  8389] 11:19:12.659471 D mitogen: mitogen.ssh.Stream('ssh.XXXXXXXX') closing CALL_FUNCTION channel
[mux  8389] 11:19:12.659830 D mitogen: mitogen.parent.DiagLogStream(fd=83, 'ssh.XXXXXXXX').on_disconnect()
[mux  8389] 11:19:12.660233 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-21'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.660775 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-22'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.661264 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-23'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.661658 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-24'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.662165 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-25'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.662510 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-26'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.662873 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-27'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.663224 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-28'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.663558 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-29'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.663911 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-30'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.664263 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-31'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.664606 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-0'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.664990 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-1'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.665331 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-2'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.665708 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-3'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.666072 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-4'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.666402 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-5'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.666852 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-6'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.667321 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-7'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.667845 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-8'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.668368 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-9'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.668825 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-10'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.669187 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-11'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.669536 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-12'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.669885 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-13'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.670217 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-14'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.670539 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-15'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.671006 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-16'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.671494 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-17'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.671993 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-18'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.672434 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-19'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.672778 D mitogen: mitogen.service.Pool(0x7660410, size=32, th='mitogen.service.Pool.7660410.worker-20'): channel or latch closed, exitting: None
[mux  8389] 11:19:12.673215 D mitogen.ctx.ssh.XXXXXXXX: mitogen: _on_shutdown_msg(Message(2, 0, 0, 106, 0, ''..0))
[mux  8389] 11:19:12.673479 D mitogen.ctx.ssh.XXXXXXXX: mitogen: Broker(0x1688ed0).shutdown()
[mux  8389] 11:19:12.673726 D mitogen.ctx.ssh.XXXXXXXX: mitogen: Waker(Broker(0x1688ed0) rfd=3, wfd=4).on_shutdown()
[mux  8389] 11:19:12.673947 D mitogen.ctx.ssh.XXXXXXXX: mitogen: Waker(Broker(0x1688ed0) rfd=3, wfd=4).on_disconnect()
[mux  8389] 11:19:12.674190 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.core.Stream('parent').on_shutdown(Broker(0x1688ed0))
[mux  8389] 11:19:12.674484 D mitogen.ctx.ssh.XXXXXXXX: mitogen: <IoLogger stdout>.on_shutdown()
[mux  8389] 11:19:12.674728 D mitogen.ctx.ssh.XXXXXXXX: mitogen: <IoLogger stderr>.on_shutdown()
[mux  8389] 11:19:12.674949 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.fork.Stream('fork.88069') closing CALL_FUNCTION channel
[mux  8389] 11:19:12.675150 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.parent.DiagLogStream(fd=17, 'sudo.root').on_shutdown()
[mux  8389] 11:19:12.675334 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.parent.DiagLogStream(fd=17, 'sudo.root').on_disconnect()
[mux  8389] 11:19:12.675518 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.sudo.Stream('sudo.root') closing CALL_FUNCTION channel
[mux  8389] 11:19:12.675810 D mitogen.ctx.ssh.XXXXXXXX: mitogen: <IoLogger stdout>.on_disconnect()
[mux  8389] 11:19:12.676127 D mitogen.ctx.ssh.XXXXXXXX: mitogen: <IoLogger stderr>.on_disconnect()
[mux  8389] 11:19:12.676435 D mitogen.ctx.fork.88069: mitogen: _on_shutdown_msg(Message(3, 2, 2, 106, 0, ''..0))
[mux  8389] 11:19:12.676789 D mitogen.ctx.fork.88069: mitogen: Broker(0x16ed450).shutdown()
[mux  8389] 11:19:12.677103 D mitogen.ctx.fork.88069: mitogen: <IoLogger stderr>.on_shutdown()
[mux  8389] 11:19:12.677405 D mitogen.ctx.fork.88069: mitogen: Waker(Broker(0x16ed450) rfd=3, wfd=4).on_shutdown()
[mux  8389] 11:19:12.677744 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: _on_shutdown_msg(Message(4, 2, 2, 106, 0, ''..0))
[mux  8389] 11:19:12.678061 D mitogen.ctx.fork.88069: mitogen: Waker(Broker(0x16ed450) rfd=3, wfd=4).on_disconnect()
[mux  8389] 11:19:12.678360 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: Broker(0x1bd5dd0).shutdown()
[mux  8389] 11:19:12.678679 D mitogen.ctx.fork.88069: mitogen: mitogen.core.Stream('parent').on_shutdown(Broker(0x16ed450))
[mux  8389] 11:19:12.678959 D mitogen.ctx.fork.88069: mitogen: <IoLogger stdout>.on_shutdown()
[mux  8389] 11:19:12.679340 D mitogen.ctx.fork.88069: mitogen: <IoLogger stderr>.on_disconnect()
[mux  8389] 11:19:12.679649 D mitogen.ctx.fork.88069: mitogen: <IoLogger stdout>.on_disconnect()
[mux  8389] 11:19:12.679939 D mitogen.ctx.fork.88069: mitogen: _broker_main() force disconnecting <Side of mitogen.core.Stream('parent') fd 5>
[mux  8389] 11:19:12.680216 D mitogen.ctx.fork.88069: mitogen: mitogen.core.Stream('parent').on_disconnect()
[mux  8389] 11:19:12.680515 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.fork.Stream('fork.88069').on_disconnect()
[mux  8389] 11:19:12.680775 D mitogen.ctx.ssh.XXXXXXXX: mitogen: RouteMonitor(): mitogen.fork.Stream('fork.88069') is gone; propagating DEL_ROUTE for set([3])
[mux  8389] 11:19:12.680969 D mitogen.ctx.ssh.XXXXXXXX: mitogen: Router(Broker(0x1688ed0)).del_route(3)
[mux  8389] 11:19:12.681211 D mitogen: RouteMonitor(): firing local disconnect for Context(3, u'fork.88069')
[mux  8389] 11:19:12.681393 D mitogen: RouteMonitor(): deleting route to 3 via mitogen.ssh.Stream('ssh.XXXXXXXX')
[mux  8389] 11:19:12.681637 D mitogen: Router(Broker(0x765ac50)).del_route(3)
[mux  8389] 11:19:12.681959 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.fork.Stream('fork.88069'): child process still alive, sending SIGTERM
[mux  8389] 11:19:12.682333 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: <IoLogger stdout>.on_shutdown()
[mux  8389] 11:19:12.683076 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: mitogen.fork.Stream('fork.88075') closing CALL_FUNCTION channel
[mux  8389] 11:19:12.683475 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: <IoLogger stderr>.on_shutdown()
[mux  8389] 11:19:12.683776 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: Waker(Broker(0x1bd5dd0) rfd=3, wfd=4).on_shutdown()
[mux  8389] 11:19:12.684146 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: Waker(Broker(0x1bd5dd0) rfd=3, wfd=4).on_disconnect()
[mux  8389] 11:19:12.686148 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: mitogen.core.Stream('parent').on_shutdown(Broker(0x1bd5dd0))
[mux  8389] 11:19:12.686550 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: <IoLogger stdout>.on_disconnect()
[mux  8389] 11:19:12.688720 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: <IoLogger stderr>.on_disconnect()
[mux  8389] 11:19:12.689040 D mitogen.ctx.fork.88075: mitogen: _on_shutdown_msg(Message(1003, 4, 4, 106, 0, ''..0))
[mux  8389] 11:19:12.689310 D mitogen.ctx.fork.88075: mitogen: Broker(0x1c43390).shutdown()
[mux  8389] 11:19:12.689598 D mitogen.ctx.fork.88075: mitogen: <IoLogger stdout>.on_shutdown()
[mux  8389] 11:19:12.689873 D mitogen.ctx.fork.88075: mitogen: Waker(Broker(0x1c43390) rfd=3, wfd=4).on_shutdown()
[mux  8389] 11:19:12.690144 D mitogen.ctx.fork.88075: mitogen: Waker(Broker(0x1c43390) rfd=3, wfd=4).on_disconnect()
[mux  8389] 11:19:12.690410 D mitogen.ctx.fork.88075: mitogen: <IoLogger stderr>.on_shutdown()
[mux  8389] 11:19:12.690699 D mitogen.ctx.fork.88075: mitogen: mitogen.core.Stream('parent').on_shutdown(Broker(0x1c43390))
[mux  8389] 11:19:12.690957 D mitogen.ctx.fork.88075: mitogen: <IoLogger stdout>.on_disconnect()
[mux  8389] 11:19:12.691228 D mitogen.ctx.fork.88075: mitogen: <IoLogger stderr>.on_disconnect()
[mux  8389] 11:19:12.691492 D mitogen.ctx.fork.88075: mitogen: _broker_main() force disconnecting <Side of mitogen.core.Stream('parent') fd 5>
[mux  8389] 11:19:12.691788 D mitogen.ctx.fork.88075: mitogen: mitogen.core.Stream('parent').on_disconnect()
[mux  8389] 11:19:12.692058 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: mitogen.fork.Stream('fork.88075').on_disconnect()
[mux  8389] 11:19:12.692306 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: RouteMonitor(): mitogen.fork.Stream('fork.88075') is gone; propagating DEL_ROUTE for set([1003])
[mux  8389] 11:19:12.692563 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: Router(Broker(0x1bd5dd0)).del_route(1003)
[mux  8389] 11:19:12.692844 D mitogen.ctx.ssh.XXXXXXXX: mitogen: RouteMonitor(): firing local disconnect for Context(1003, u'fork.88075')
[mux  8389] 11:19:12.693109 D mitogen.ctx.ssh.XXXXXXXX: mitogen: RouteMonitor(): deleting route to 1003 via mitogen.sudo.Stream('sudo.root')
[mux  8389] 11:19:12.693363 D mitogen.ctx.ssh.XXXXXXXX: mitogen: Router(Broker(0x1688ed0)).del_route(1003)
[mux  8389] 11:19:12.693656 D mitogen: RouteMonitor(): firing local disconnect for Context(1003, u'fork.88075')
[mux  8389] 11:19:12.693892 D mitogen: RouteMonitor(): deleting route to 1003 via mitogen.ssh.Stream('ssh.XXXXXXXX')
[mux  8389] 11:19:12.694110 D mitogen: Router(Broker(0x765ac50)).del_route(1003)
[mux  8389] 11:19:12.694394 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: mitogen.fork.Stream('fork.88075'): child process still alive, sending SIGTERM
[mux  8389] 11:19:12.694787 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: _broker_main() force disconnecting <Side of mitogen.core.Stream('parent') fd 5>
[mux  8389] 11:19:12.695057 D mitogen.ctx.ssh.XXXXXXXX.sudo.root: mitogen: mitogen.core.Stream('parent').on_disconnect()
[mux  8389] 11:19:12.752176 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.sudo.Stream('sudo.root').on_disconnect()
[mux  8389] 11:19:12.752552 D mitogen.ctx.ssh.XXXXXXXX: mitogen: RouteMonitor(): mitogen.sudo.Stream('sudo.root') is gone; propagating DEL_ROUTE for set([4])
[mux  8389] 11:19:12.752863 D mitogen.ctx.ssh.XXXXXXXX: mitogen: Router(Broker(0x1688ed0)).del_route(4)
[mux  8389] 11:19:12.753112 D mitogen: RouteMonitor(): firing local disconnect for Context(4, u'ssh.XXXXXXXX.sudo.root')
[mux  8389] 11:19:12.753314 I ansible_mitogen.services: ContextService(): Forgetting Context(4, u'ssh.XXXXXXXX.sudo.root') due to stream disconnect
[mux  8389] 11:19:12.753558 D mitogen: RouteMonitor(): deleting route to 4 via mitogen.ssh.Stream('ssh.XXXXXXXX')
[mux  8389] 11:19:12.753737 D mitogen: Router(Broker(0x765ac50)).del_route(4)
[mux  8389] 11:19:12.753929 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.parent.DiagLogStream(fd=17, 'sudo.root').on_disconnect()
[mux  8389] 11:19:12.754120 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.sudo.Stream('sudo.root'): PID 88071 exited with return code 0
[mux  8389] 11:19:12.754376 D mitogen.ctx.ssh.XXXXXXXX: mitogen: _broker_main() force disconnecting <Side of mitogen.core.Stream('parent') fd 5>
[mux  8389] 11:19:12.754556 D mitogen.ctx.ssh.XXXXXXXX: mitogen: mitogen.core.Stream('parent').on_disconnect()
[mux  8389] 11:19:12.770313 D mitogen: mitogen.ssh.Stream('ssh.XXXXXXXX').on_disconnect()
[mux  8389] 11:19:12.770558 D mitogen: RouteMonitor(): mitogen.ssh.Stream('ssh.XXXXXXXX') is gone; propagating DEL_ROUTE for set([2])
[mux  8389] 11:19:12.770754 D mitogen: Router(Broker(0x765ac50)).del_route(2)
[mux  8389] 11:19:12.770936 I ansible_mitogen.services: ContextService(): Forgetting Context(2, u'ssh.XXXXXXXX') due to stream disconnect
[mux  8389] 11:19:12.771169 D mitogen: mitogen.parent.DiagLogStream(fd=83, 'ssh.XXXXXXXX').on_disconnect()
[mux  8389] 11:19:12.771380 D mitogen: mitogen.ssh.Stream('ssh.XXXXXXXX'): PID 8428 exited with return code 0
[mux  8389] 11:19:12.771740 D mitogen: Router(Broker(0x765ac50)): stats: 1 module requests in 20 ms, 36 sent (339 ms minify time), 0 negative responses. Sent 134.4 kb total, 3.7 kb avg.
Vladimir-csp commented 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(_(_(\"..........
dw commented 5 years ago

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

Vladimir-csp commented 5 years ago

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.

dw commented 5 years ago

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)

yodatak commented 5 years ago

For my part i fix in using host_vars folder and in localhost fileansible_python_interpreter: python2 but i think its still a issue ?