-
Notifications
You must be signed in to change notification settings - Fork 199
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
Conversation
Notes to self
|
There was a problem hiding this 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
ansible_mitogen/transport_config.py
Outdated
@@ -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 |
There was a problem hiding this comment.
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
@moreati I'm not fully over the codebase, happy for you to make those addition/changes. :) |
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. |
…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
Fixes #1106