What I tried:
1) Copy the private key from the local machine to the server and clone it:
- name: clone repo sudo: yes git: repo={{ app_repo }} dest={{ app_repo_dir }} accept_hostkey=true key_file={{ssh_key}} version=master force=yes
But he is hanging. As I understand it, this problem occurs because the key has a passphrase.
2) Use ForwardAgent in ansible.cfg :
[ssh_connection] ssh_args = -o ForwardAgent=yes
But to connect to the server, I use a non-standard ssh 22 port.
How to set passphrase for key for git clone task in Ansible? Or any other ways to clone a remote repository using Ansible?
PS Yes, I can try to remove the passphrase from the key. But security aspects ...
source share