When I’m first setting up a vm, I need to set which user to use and the ssh and sudo passwords.
So, my host file looks something like:
[apache]
192.168.77.2 ansible_ssh_user=vagrant ansible_ssh_pass=vagrant ansible_sudo_pass=vagrant
[mysql]
192.168.77.3 ansible_ssh_user=vagrant ansible_ssh_pass=vagrant ansible_sudo_pass=vagrant
The initial setup includes configuring ssh to use sshkey auth, block password auth, and adds my ssh pub key to the vagrant user.
After that first run, my playbooks fail.
ansible-playbook -i provisioning/vagrant.ansible.hosts --sudo --limit=“192.168.77.3” provisioning/play.testowncloud.yml
PLAY [apache] *****************************************************************
skipping: no hosts matchedPLAY [mysql] ******************************************************************
GATHERING FACTS ***************************************************************
fatal: [192.168.77.3] => SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issueTASK: [aspects_mysql_server | include_vars {{ ansible_os_family }}.yml] *******
FATAL: no hosts matched or all hosts have already failed – abortingPLAY RECAP ********************************************************************
to retry, use: --limit @/home/localuser/play.testowncloud.retry192.168.77.3 : ok=0 changed=0 unreachable=1 failed=0
If I remove the ansible_ssh_pass variable from my hosts file, it starts working.
Why is that? Shouldn’t having the ansible_ssh_pass set not matter?
In case it’s useful, my /etc/ssh/sshd_config:
See the sshd_config(5) manpage for details on what options you can set.
Protocol 2
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
UsePrivilegeSeparation yes
AcceptEnv LANG LC_*
HostKey /etc/ssh/ssh_host_rsa_key
Port 22
PubkeyAuthentication yes
ServerKeyBits 768
PrintMotd no
AllowUsers otherusers localuser vagrant
PrintLastLog yes
HostbasedAuthentication no
LoginGraceTime 120
SyslogFacility AUTH
X11DisplayOffset 10
IgnoreRhosts yes
PasswordAuthentication no
TCPKeepAlive yes
KeyRegenerationInterval 3600
UsePAM yes
LogLevel INFO
RhostsRSAAuthentication no
PermitEmptyPasswords no
PermitRootLogin no
Subsystem sftp /usr/lib/openssh/sftp-server
X11Forwarding yes
RSAAuthentication yes
ChallengeResponseAuthentication no
Both desktop and vm are Ubuntu 14.04. Using ansible devel branch current as of a couple weeks ago.