Skip to content

ansible become / sudo broken since commit f1503874de82353cbed8b51408d20fdfa899f8f7 #952

@zerwes

Description

@zerwes

Please drag-drop large logs as text file attachments.

Feel free to write an issue in your preferred format, however if in doubt, use
the following checklist as a guide for what to include.

  • Which version of Ansible are you running? 2.12.2 + 2.13.2

  • Is your version of Ansible patched in any way? NO

  • Are you running with any custom modules, or module_utils loaded? NO

  • Have you tried the latest master version from Git? YES

  • Mention your host and target OS and versions Debian GNU/Linux 11 (bullseye)

  • Mention your host and target Python versions python version = 3.9.2

  • If reporting any kind of problem with Ansible, please include the Ansible
    version along with output of "ansible-config dump --only-changed".

ansible [core 2.12.2]
  config file = /home/admzerwes/git/ansible/ansible.cfg
  configured module search path = ['/home/admzerwes/git/ansible/library']
  ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
  ansible collection location = /home/admzerwes/git/ansible/.collections:/home/admzerwes/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  jinja version = 2.11.3
  libyaml = True

While testing a upgrade to ansibel 2.13.2, IO tried the latest checkout from github and realized the sudo feature was broken.
Rolling back to ansible 2.12, but preserving the latest mitogen checkout, I realized that this problem seems to be not related to the ansible version in use, but caused by mitogen.
Using git bisectthe faulty commit I identified is:

# git bisect bad
f1503874de82353cbed8b51408d20fdfa899f8f7 is the first bad commit
commit f1503874de82353cbed8b51408d20fdfa899f8f7
Author: Alex Willmer <alex@moreati.org.uk>
Date:   Mon Jul 4 21:50:58 2022 +0100

    ansible_mitogen: Correct ansible_become_pass/ansible_become_password precendence
    
    Until Ansible 2.9 it looks like ansible_become_password had higher priority.
    From Ansible 2.10 ansible_become_pass has higher priority [1]. Mitogen was not
    respecting this.
    
    I may need to rework this further, instatiating the become plugin may have
    slowed down execution.
    
    [1] Based on testing with
    
    ```
    [ubuntus]
    become-pass-pass ansible_become_pass=1234
    become-pass-password ansible_become_password=1234
    become-pass-both ansible_become_password=wrong ansible_become_pass=1234
    
    [ubuntus:vars]
    ansible_host=ubuntu2004.local
    ansible_user=ubuntu
    ```
    ```
    - hosts: ubuntus
      gather_facts: false
      become: true
      tasks:
        - ping:
    ```

 ansible_mitogen/loaders.py                                 |  2 ++
 ansible_mitogen/transport_config.py                        | 10 +++++++---
 tests/ansible/hosts/transport_config.hosts                 |  2 +-
 tests/ansible/integration/transport_config/become_pass.yml |  9 ++++-----
 4 files changed, 14 insertions(+), 9 deletions(-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-0.3Issues related to 0.3.X Mitogen releasesbugCode feature that hinders desired execution outcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions