pytest-testinfra
pytest-testinfra copied to clipboard
ansible_runner doesn't accept ansible's user password via ansible_password variable
When using testinfra with ansible_runner the only acceptable variable that can contain the password for ansible's user is ansible_ssh_pass. Based on ansible documentation if the user wants to use ansible with a password the ansible_password must be set. The reason why only ansible_ssh_pass is accepted is that the password parameter is directly pulled from ansible_ssh_pass. See code here I plan to create a PR to fix this if it is okay.
Hi @lmesz-bitrise thanks for adding this issue. It took me a long time to find the solution to this. I have always used the ansible_password: variable name for my ansible inventorys..
Some google phrases i used
- testinfra promts for password
- testinfra ask for password
- testinfra ansible promts for password
After looking around in the code, I think that the errors are here https://github.com/pytest-dev/pytest-testinfra/blob/master/testinfra/utils/ansible_runner.py#L148
Possibel solution to this issue
password = get_config("ansible_ssh_pass")
if password == None:
password = get_config("ansible_password")