Ansible git clone from private repo in Stash

ansiblegitstashvagrant

For the life of me I can not figure out why I can not clone a private repo from Stash. Think I have tried:

1) Create 'ansible.cfg' with

[ssh_connection]
ssh_args = -o ForwardAgent=yes

On my project directory. Keys works fine on host as I can simply clone the repo. And this is how I clone:

- name: Clone the repo
  git: >
    repo=ssh://git@stash.xyz.com:7999/pp/my-private-repo.git
    accept_hostkey=yes
    dest=/var/www

And I get 'Host key verification failed.Fatal: could not read from remote repository'

2) I tried to copy my private key file to the remote machine, via vagrant and/or Ansible and tried to use key_file=/home/vagrant/.ssh/id_rsa_stash and still no luck!

Best Answer

It sounds more like you're having problems with the host key.

Try adding

ssh_opts="-o StrictHostKeyChecking=no"

to the git module