TASK: [webservers | checkout the site] ****************************************
ESTABLISH CONNECTION FOR USER: root
REMOTE_MODULE git repo=ssh:********@intro.repositoryhosting.com/intro/onsite.git dest=/var/www/onsite accept_hostkey=true
EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘app01’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1395785319.12-187266324329683 && echo $HOME/.ansible/tmp/ansible-tmp-1395785319.12-187266324329683’”]
PUT /tmp/tmptO5e80 TO /root/.ansible/tmp/ansible-tmp-1395785319.12-187266324329683/git
EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘app01’, “/bin/sh -c ‘/usr/bin/python /root/.ansible/tmp/ansible-tmp-1395785319.12-187266324329683/git; rm -rf /root/.ansible/tmp/ansible-tmp-1395785319.12-187266324329683/ >/dev/null 2>&1’”]
failed: [app01] => {“failed”: true, “item”: “”}
msg: failed to add intro.repositoryhosting.com hostkey: getaddrinfo >>: Name or service not known
FATAL: all hosts have already failed – aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/root/webservers.retry
app01 : ok=7 changed=0 unreachable=0 failed=1
yaml code is:
git: repo=ssh://git@intro.repositoryhosting.com/intro/onsite.git dest={{ nginx_webroot }}/{{ app_name }} accept_hostkey=true
Just checked again… if I clone this repo on the host and accept the key then run the playbook it’s fine. remove the known_hosts and it bails out.
In the ansible.cfg the HostKeyChecking=False is commented out which I assume means it’s on and the git accept_hostkey setting will be parsed.