-
Notifications
You must be signed in to change notification settings - Fork 664
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
Set ansible_ssh_pass with ansible_password because of a testinfra issue #2927
Set ansible_ssh_pass with ansible_password because of a testinfra issue #2927
Conversation
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.
Can you please provide some links that clarify the difference between ansible_ssh_pass
and ansible_password
.
If we fix it we better know what we are doing, maybe even including a clarifying comment in the source code.
- Do we need both?
- Do we have a case where one may be different than another?
- Are you aware that you can mention inventory variables directly in molecule file, bypassing any need to process them with molecule.
I can't find |
I believe that |
If we fix it we better know what we are doing, maybe even including a clarifying comment in the source code.
If we only use that inventory for pytest than we don't need
Unfortunately, I don't know but if it is only for pytest then no.
Ohh I wasn't aware of it, will check it. How can I do this? Sorry I was not clear with the change. The parameter is not for ansible but for testinfra verifier. For test it uses pytest and pytest to establish the connection uses ansible backend. The documentation can be found here |
When in doubt, try to ask on |
Alright trying to connect. Old version of which component?
I mean I doubt a little cause the documentation exactly says that to use that variable. |
@tadeboro Gave a very useful link: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/ssh_connection.html#parameter-password -- which indicates that there are 3 variables around password, not two. I suspect that the bug may be a testinfra related bug? I see you already ruled out an outdated Ansible issue. |
Do you suggest setting all three variables?
Sorry I don't understand that part. What kind of bug? |
As far as Ansible is concerned, setting |
Nothing strange happened. Based on testinfra code it is intended. |
@ssbarnea you were right, your suggestion also works:
|
So, this seems like a testinfra bug, not a molecule bug, and should be fixed there. But for the sake of end-user convenience, I guess this workaround should be added to Molecule also. I would just add a comment over the added line that describes the why behind the change. Something like "testinfra expects older alias for SSH password here" just to make sure we know why this line of code is there in a year or two. And I guess this same information should go into commit message also because right now, it is next to impossible to determine why this change is needed (the commit message says nothing about testinfra at all). |
I have maintainer rights on testinfra so I could help use merging a fix there. Here are few action points:
Once done, I will approve the workaround. |
I created a testinfra bug, I hope added all the necessary information.
Added with the bug in it.
Updated accordingly.
Thank you for the help with the whole PR. |
We are using delegated driver to connect to a recently created host on which ssh keys are not set yet, when we had tried to execute molecule test on that it stopped and asked for password in the verify phase even though the password was set in the create.yml.
For verification we use testinfra, under the hood it uses pytest with ansible backend.
After some investigation figured out the reason is that ansible_ssh_pass is not set and based on the doc it is mandatory if key is not set. This issue has been reported to testinfra, but until it is not fixed this PR implements a small workaround.