Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run non-Python commands / Ansible raw module support #630

Open
8 tasks
dw opened this issue Aug 19, 2019 · 2 comments
Open
8 tasks

Run non-Python commands / Ansible raw module support #630

dw opened this issue Aug 19, 2019 · 2 comments
Labels
ansible Issues relating to Mitogen for Ansible feature Design and functional additions

Comments

@dw
Copy link
Member

dw commented Aug 19, 2019

Following on from #419, the following work item remains:

Command line building. To handle Ansible's raw action, we need to be able to turn connection configs into command lines, and run those commands, including typing any passwords and suchlike as we do already.

Lots of pieces are in place for it now. Roughly what's left:

  • The per-connection BootstrapProtocol subclasses need to change, so they know somehow that they don't just run until MITO000 appears on the stream. They need to know how to feed stdin of the program with arbitrary data, and record its output in an 8-bit clean manner
  • Figure out if Connection wants to handle running custom commands, or it wants split up even more to handle just the 'start this stream and wait for it to disconnect' part.
  • Modify the existing HistoryMixin to handle collecting up a big chunk of potentially binary data, and maybe teach it about size limits or similar. Maybe re-work it so that it doesn't subclass DelimitedProtocol, but wraps the raw on_receive() instead.
  • Figure out the public API for it. Don't both with Router.ssh() etc. since they're going away anyway, make it something like mitogen.ssh.run(...), returning some kind of Receiver-like object that can be waited on etc.
  • Figure out how to make it work recursively using something like via=. This is needed for Ansible so raw: against a machine proxied via mitogen_via= is completely transparent.
  • Must preserve the ability for connection methods to continue typing passwords and understanding tool output as they do already.
  • Modify Ansible extension to use it. Connection.exec_command() seems to be where it wants to go, but this needs some heuristic or hard rule about when exec_command() should assume Python is installed on the remote and start a real connection, or when a raw command line should be run from the parent instead. It must always be consistent
  • Figure out how to enable Ansible 2.8's Python interpreter detection

User issue: #597

@dw dw added ansible Issues relating to Mitogen for Ansible feature Design and functional additions labels Aug 19, 2019
@joe94 joe94 mentioned this issue Nov 20, 2019
3 tasks
@dch
Copy link

dch commented Dec 3, 2019

NB I rarely need raw command support, but when I do I just use env ANSIBLE_STRATEGY=free ansible-playbook ... and skip mitogen for this particular play.

@mikehardenize
Copy link

FWIW, I just spent half an hour trying to figure out why ansible was complaining about not being able to find python when I was using the raw module. Mitogen turned out to be the issue. I've set "strategy: linear" in that playbook now. Thankfully it's a short one so mitogen didn't have much of an impact anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ansible Issues relating to Mitogen for Ansible feature Design and functional additions
Projects
None yet
Development

No branches or pull requests

3 participants