mitogen icon indicating copy to clipboard operation
mitogen copied to clipboard

Add the ability to disable mitogen per task

Open yodatak opened this issue 5 years ago • 4 comments

It coud be usefull to have a variable to disable mitogen when there is some modules or task , like some delegate to in my playbook . Can it be possible or ? Because when a role can't work with mitogen for now i make two role with differents stategy

yodatak avatar Dec 11 '18 15:12 yodatak

It's kindof possible in an awkward way right now, using something like this:


- hosts: all
  strategy: mitogen_linear
   tasks:
   - ...

- hosts: all
  strategy: linear
   tasks:
   - ...

- hosts: all
  strategy: mitogen_linear
   tasks:
   - ...

Naturally that is a lot of work! A better option might be:

  • to expose a variable like "mitogen_enabled: false" that could be set per-task, however, this has ramifications for some unreleased work, where it can't be supported because the underlying implementation has been completely replaced

  • to support explicitly setting "connection: mitogen_ssh" as an option, rather than the existing magic redirect that picks that plugin when "ssh" is used, so that a task can have a plain "connection: ssh" to really-seriously-honestly use the default SSH plugin when desired.

Of these, I think the latter might be a nicer option. This tallies in with a new branch I'm hoping to eventually release, so it needs a little more thought.

Thanks for reporting this

dw avatar Dec 13 '18 22:12 dw

I think this feature is very important. When I provision a new freshly installed server, python is not already installed. Ansible is very limited without python installed on the remote server, so, I created an ansible-prereqs role that install python with the script module and this is the first role I execute on my playbook.

Unfortunately, mitogen seem to requires python on the remote host, so I need to disable mitogen in my ansible.cfg file when provisioning a new server and changing it back after the first playbook run.

fatal: [server]: UNREACHABLE! => {"changed": false, "msg": "EOF on stream; last 300 bytes received: u'bash: python: command not found\\n'", "unreachable": true}

ohmer1 avatar Feb 07 '19 16:02 ohmer1

When we deal with crazy things around ssh (like switching from password ssh to key-based or reconfiguring something), it's possible to influence ansible behavior via ansible_connection variable. F.e. if you have a task and you set that variable at task level, you can switch between 'local', 'docker' and 'ssh' with ease. May be mitogen can do the same?

I, actually, would like very much to see mitogen configuration as connection ('mitogen_ssh') and be able to switch to 'ssh' at any task at will.

amarao avatar Nov 24 '21 20:11 amarao

Yes. That'd ge great!

cocoonkid avatar Jun 28 '23 21:06 cocoonkid