I've created a GitHub user on the target server with a private key in ~/.ssh/id_rsa (and added the public key to GitHub). If I "sudo su deploy" I can then clone my repo via the command line without error:
$ git clone [email protected]:me/my-repo.git target_folder However, I cannot clone from my Ansible playbook using the git module: yii.yml -------- - hosts: yii user: ubuntu sudo: yes roles: - { role: common, tags: [ 'common' ] } - hosts: yii user: deploy sudo: no roles: - { role: yii-deploy, tags: [ 'yii-deploy' ] } main.yml in yii role ------------------------ - name: checkout yii-admin git: [email protected]:me/my-repo.git dest=/mnt/live/yii-admin When I run the above I get this error: TASK: [yii-deploy | checkout yii-admin] *************************************** failed: [54.185.9.246] => {"cmd": "/usr/bin/git ls-remote origin -h refs/heads/master", "failed": true, "item": "", "rc": 128} stderr: Permission denied (publickey). fatal: The remote end hung up unexpectedly msg: Permission denied (publickey). fatal: The remote end hung up unexpectedly FATAL: all hosts have already failed -- aborting My best guess is that "user: deploy" is being ignored in yii.yml and that the git module is executing as the "ubuntu" user? Any suggestions greatly appreciated. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/01f82227-8619-40c5-8305-5953a5b02aac%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
