git module, accept_hostkey=yes doesn't work

I'm running the task:

- name: Cloning homepage repo...
  sudo_user: gitpull
  git: repo=ssh://git@git.server.com:222/websites/homepage.com.git dest=/var/www/{{ branch}}/ version={{ branch }} accept_hostkey=yes
  changed_when: False

but the task gets stuck always. I've tried ansible 1.5.5, 1.5.0, 1.5.3 and the latest git (on ArchLinux).

This is the process tree when it's stuck:

25857 pts/1    S+     0:00                      \_ /usr/bin/python /tmp/ansible-tmp-1398860300.45-147818427778432/git
25859 pts/1    S+     0:00                          \_ /usr/bin/git ls-remote ssh://git@git.server.com:222/websites/homepage.git -h refs/heads/master
25860 pts/1    S+     0:00                              \_ ssh -p 222 git@git.server.com git-upload-pack '/websites/homepage.git'

If I strace that ssh process I see it tries to read from fd 4, which acording to /proc/25860/fd/4 is /dev/tty

/home/gitpull/.ssh/known_hosts is created but is empty.

I've tried manually cloning the repo and it asks me to confirm the host key, I say 'yes' it's added to known_hosts and the clone finishes soon after.
Then I'd remove /home/gitpull/.ssh/known_hosts and the task gets stuck again.

The target OS is Debian 7.5

/home/gitpull/.ssh/known_hosts is created but is empty.

digging through the code it seems to me that the function add_host_key in module_utils/known_hosts.py doesn’t support using a different port than the standard one??

This is quite possible given the accept_hostkey magic is new (you could also manage known_hosts yourself manually to get around this).

If you think this is a bug, please make sure it’s filed on github.com/ansible/ansible.

(Patches also welcome!)

This way we won’t lose track of it.

Thanks!

Also facing the same issue

Thanks, was a ticket filed on this one?

If you can’t find a similar one, please do file a ticket.

Thanks!