mitogen icon indicating copy to clipboard operation
mitogen copied to clipboard

Mitogen attempts Ansible connections early (e.g. during meta: reset_connection)

Open moreati opened this issue 1 year ago • 0 comments

The following playbook will work with vanilla Ansible, but may fail using Mitogen+Ansible

- hosts: foo
  gather_facts: false
  tasks:
    - meta: reset_connection
    - name: Templated variables in task
      vars:
        ansible_user: user_that_requires_password
        ansible_password: password_for_user
      ping:

With vanilla Ansible the meta task is executed and ansible.plugins.strategy.StrategyBase._execute_meta() calls connection.reset() - which closes any existing connection. With Mitogen + Ansible the call to connection.reset()tries to instantiate a new ansible_mitogen.transport_config.PlayContextSpec(), which triggers interpreter disocvery, which attempts a connection, which fails because the username and password aren't in scope.

This is probably a major cause/the cause of ~~#1105~~ #1096.

moreati avatar Oct 03 '24 11:10 moreati