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

Mitogen attempts Ansible connections prematurely (e.g. during meta: reset_connection) #1132

Open
moreati opened this issue Oct 3, 2024 · 0 comments
Labels
affects-0.3 Issues related to 0.3.X Mitogen releases ansible Issues relating to Mitogen for Ansible bug Code feature that hinders desired execution outcome

Comments

@moreati
Copy link
Member

moreati commented Oct 3, 2024

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 toconnection.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 moreati added bug Code feature that hinders desired execution outcome ansible Issues relating to Mitogen for Ansible affects-0.3 Issues related to 0.3.X Mitogen releases labels Oct 3, 2024
moreati added a commit to moreati/mitogen that referenced this issue Oct 6, 2024
…h_password

This switches `ansible_mitogen.transport_config.PlayContextSpec.password()` to
Ansible's plugin option framework. As a result
- The relatively recent `ansible_ssh_password` variable is now respected.
- The SSH connection password can be templated and specified as a play
  variable. Task variables will probably also work, but testing was blocked
  by mitogen-hq#1132.

There is a chance this change will cause a regression in another connection
plugin (e.g. mitogen_docker), but nothing turned up in the test suite.
I intend ot migrate other connection configuration to
`ansible_mitogen.transport_config.PlayContextSpec._connect_option()`, the next
candidate is the remote port.

fixes mitogen-hq#1107
moreati added a commit to moreati/mitogen that referenced this issue Oct 6, 2024
…h_password

This switches `ansible_mitogen.transport_config.PlayContextSpec.password()` to
Ansible's plugin option framework. As a result
- The relatively recent `ansible_ssh_password` variable is now respected.
- The SSH connection password can be templated and specified as a play
  variable. Task variables will probably also work, but testing was blocked
  by mitogen-hq#1132.

There is a chance this change will cause a regression in another connection
plugin (e.g. mitogen_docker), but nothing turned up in the test suite.
I intend ot migrate other connection configuration to
`ansible_mitogen.transport_config.PlayContextSpec._connect_option()`, the next
candidate is the remote port.

fixes mitogen-hq#1106
moreati added a commit to moreati/mitogen that referenced this issue Oct 6, 2024
…h_password

This switches `ansible_mitogen.transport_config.PlayContextSpec.password()` to
Ansible's plugin option framework. As a result
- The relatively recent `ansible_ssh_password` variable is now respected.
- The SSH connection password can be templated and specified as a play
  variable. Task variables will probably also work, but testing was blocked
  by mitogen-hq#1132.

There is a chance this change will cause a regression in another connection
plugin (e.g. mitogen_docker), but nothing turned up in the test suite.
I intend ot migrate other connection configuration to
`ansible_mitogen.transport_config.PlayContextSpec._connect_option()`, the next
candidate is the remote port.

fixes mitogen-hq#1106
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-0.3 Issues related to 0.3.X Mitogen releases ansible Issues relating to Mitogen for Ansible bug Code feature that hinders desired execution outcome
Projects
None yet
Development

No branches or pull requests

1 participant