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

allow ansible_ssh_password #1107

Closed
wants to merge 0 commits into from
Closed

allow ansible_ssh_password #1107

wants to merge 0 commits into from

Conversation

madsi1m
Copy link
Contributor

@madsi1m madsi1m commented Aug 23, 2024

Fixes #1106

@moreati
Copy link
Member

moreati commented Aug 29, 2024

Notes to self

  • confirm priority order of existing variables in vanilla Ansible vs Mitogen. Will require running experiment.

Copy link
Member

@moreati moreati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for raising this PR. Additionally it need

  • to be rebased on main
  • test coverage of the new variable, see tests/ansible/integration/password.yml for a good starting point
  • an entry in docs/changelog.rst
  • Optionally, an entry for yourself in docs/contributers.rst

Could you make these changes? I'm happy to do so otherwise.

I can do these if you wish

@@ -686,6 +686,7 @@ def become_pass(self):
def password(self):
return optional_secret(
self._host_vars.get('ansible_ssh_pass') or
self._host_vars.get('ansible_ssh_password') or
Copy link
Member

@moreati moreati Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on some adhoc testing this will not match the behaviour of vanilla Ansible. ansible_ssh_password should have the highest priority, then ansible_ssh_pass, then ansible_password. This playbook is how I confirmed

- hosts: localhost
  strategy: linear
  gather_facts: false
  vars:
    ansible_user: mitogen__user1
    ansible_port: 32768
    ansible_python_interpreter: python3

    ansible_password: wrong
    ansible_ssh_pass: wrong
    ansible_ssh_password: user1_password

  tasks:
    - meta: reset_connection
    - ping:
    - debug:
        var: ansible_version.full
$ ansible-playbook -i localhost, issue1106.yml
PLAY [localhost] *************************************************************

TASK [meta] ******************************************************************

TASK [ping] ******************************************************************
ok: [localhost]

TASK [debug] *****************************************************************
ok: [localhost] => {
    "ansible_version.full": "2.17.2"
}

PLAY RECAP *******************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

@madsi1m
Copy link
Contributor Author

madsi1m commented Sep 3, 2024

@moreati I'm not fully over the codebase, happy for you to make those addition/changes. :)

@moreati
Copy link
Member

moreati commented Sep 4, 2024

I screwed up the git command. I meant to push my local branch called ansible_ssh_password to madsi1m:master (the fork+branch of this PR). Instead I pushed upstream/master to madsi1m:master, which caused Github to close this PR. I'm prevented from reopening the PR because madsi1m:master is the samve revision as mitogen-hq:mitogen.

I've opened a new PR #1114 with the commits I meant to push. Sorry for the confusion.

moreati added a commit to moreati/mitogen that referenced this pull request 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ansible_ssh_password missing from mitogen
2 participants