ansible requiring ansible_ssh_pass

I’m running Ansible 2.1.1.0 on OS X 10.11.6 and I’m having a problem that I haven’t had before. The issue the same as outlined in this SO question;

https://stackoverflow.com/questions/37213551/ansible-ssh-connection-fail

If I don’t put ansible_ssh_pass in the inventory file then SSH doesn’t work. I can use any value for that variable and it will be ignored in favour of the SSH cert and everything works, e.g.;

ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com ansible_ssh_user=ec2-user ansible_ssh_pass=dummy

The problem is that running with that inventory file on Linux fails because the password doesn't match. I've tried quite a few permutations of settings but I can't find something that works on both systems. I haven't had this issue with Ansible before using older versions.


Anyone else having the same issue?

Graham


To provide a bit more detail, if I have this in my inventory file;

ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com ansible_ssh_user=ec2-user ansible_ssh_pass=dummy

And run this;

$ ansible all -i inventory/aws -m ping -vvvv
No config file found; using defaults
Loaded callback minimal of type stdout, v2.0
<ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com> ESTABLISH CONNECTION FOR USER: ec2-user on PORT 22 TO ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com
<ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo $HOME/.ansible/tmp/ansible-tmp-1472737036.6-208605390381784” && echo ansible-tmp-1472737036.6-208605390381784=“echo $HOME/.ansible/tmp/ansible-tmp-1472737036.6-208605390381784” ) && sleep 0’
<ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com> PUT /var/folders/vt/jn8svt1j333c31rspxhcsb8r0000gp/T/tmpElWP2d TO /home/ec2-user/.ansible/tmp/ansible-tmp-1472737036.6-208605390381784/ping
<ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com> EXEC /bin/sh -c ‘LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /home/ec2-user/.ansible/tmp/ansible-tmp-1472737036.6-208605390381784/ping; rm -rf “/home/ec2-user/.ansible/tmp/ansible-tmp-1472737036.6-208605390381784/” > /dev/null 2>&1 && sleep 0’
ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com | SUCCESS => {
“changed”: false,
“invocation”: {
“module_args”: {
“data”: null
},
“module_name”: “ping”
},
“ping”: “pong”
}

Everything works ok, but if i set the inventory to;

ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com ansible_ssh_user=ec2-user


$ ansible all -i inventory/aws -m ping -vvvv
No config file found; using defaults
Loaded callback minimal of type stdout, v2.0
<ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ec2-user
<ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/Users/graham/.ansible/cp/ansible-ssh-%h-%p-%r ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com ‘/bin/sh -c ‘"’"’( umask 77 && mkdir -p “echo $HOME/.ansible/tmp/ansible-tmp-1472737048.41-168621408771185” && echo ansible-tmp-1472737048.41-168621408771185=“echo $HOME/.ansible/tmp/ansible-tmp-1472737048.41-168621408771185” ) && sleep 0’“'”‘’
ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com | UNREACHABLE! => {
“changed”: false,
“msg”: “Failed to connect to the host via ssh.”,
“unreachable”: true
}

It fails :confused:

Graham