# Advanced Control over Role Requirements Files (git clone ssh)

**URL:** <https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118>\
**Category:** Ansible Project\
**Tags:** galaxy-ng\
**Created:** [September 4, 2014, 7:45pm UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118 "2014-09-04T19:45:53Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Schirch](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@Patrick\_Schirch](https://forum.ansible.com/u/Patrick_Schirch)\
**Post date:** [September 4, 2014, 7:45pm UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/1 "2014-09-04T19:45:53Z")

</div>

Hi,

i want to share internal organization ansible roles from our gitlab instance with my colleagues.

1. I installed Ansible 1.8 dev from source.
2. Created a requirements.yml.
3. Added a repo from the gitlab instance (src: git+https://ourgitlabhost/example-group/example-role.git)
4. Executing ansible-galaxy install -r requirements.yml

It only uses https (with git config http.sslVerify false ) to clone the repo sucessfully.

What is the right syntax to use SSH for cloning?

```auto

```

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 5, 2014, 1:33am UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/2 "2014-09-05T01:33:46Z")

</div>

Let me make sure I understand the question …

Are you asking what to put in the requirements.yml file so that it can download the above github role?

---

<div class="post-metadata">

**Author:** ![Patrick\_Schirch](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@Patrick\_Schirch](https://forum.ansible.com/u/Patrick_Schirch)\
**Post date:** [September 5, 2014, 5:32am UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/3 "2014-09-05T05:32:35Z")

</div>

Right, I want to know how I can use SSH for cloning.

- src: git@[ourgitlabhost:example-group/example-role.git](https://www.google.com/url?q=https%3A%2F%2Fourgitlabhost%2Fexample-group%2Fexample-role.git&sa=D&sntz=1&usg=AFQjCNGEfzKxRa2OoNPCdlFpjHfL1mSglA)

doesn’t work.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 5, 2014, 7:05pm UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/4 "2014-09-05T19:05:35Z")

</div>

When you say doesn’t work, please let us know what doesn’t work means.

ssh://username:password@host/path.git

Needs to know it’s SSH, basically

---

<div class="post-metadata">

**Author:** ![Patrick\_Schirch](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@Patrick\_Schirch](https://forum.ansible.com/u/Patrick_Schirch)\
**Post date:** [September 7, 2014, 5:27pm UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/5 "2014-09-07T17:27:40Z")

</div>

ssh://git@ourgitlabhost:example-group/example-role.git

ansible-galaxy install -r requirements.yml

- downloading role from ssh://git@ourgitlabhost:example-group/example-role.git
- error: failed to download the file.
- example-role was NOT installed successfully.
- you can use --ignore-errors to skip failed roles.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 7, 2014, 5:37pm UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/6 "2014-09-07T17:37:05Z")

</div>

IIRC, an issue with role dependencies and the ansible-galaxy CLI has been recently resolved on the development branch, if you can try things with the latest (git update), that would be great.

The released version, 1.7.1 is not affected, this was a consequence of upgrading the CLI during the development branch.

---

<div class="post-metadata">

**Author:** ![Patrick\_Schirch](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@Patrick\_Schirch](https://forum.ansible.com/u/Patrick_Schirch)\
**Post date:** [September 7, 2014, 5:50pm UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/7 "2014-09-07T17:50:45Z")

</div>

Ansible \>\> ansible 1.8 (devel 8cc3543918) last updated 2014/09/07 11:14:49 (GMT +200)  
Git \>\> 1.9.1

ssh://git@ourgitlabhost:example-group/example-role.git

ansible-galaxy install -r requirements.yml

- downloading role from ssh://git@ourgitlabhost:example-group/example-role.git
- error: failed to download the file.
- example-role was NOT installed successfully.
- you can use --ignore-errors to skip failed roles.

---

<div class="post-metadata">

**Author:** ![Patrick\_Schirch](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@Patrick\_Schirch](https://forum.ansible.com/u/Patrick_Schirch)\
**Post date:** [September 9, 2014, 9:46am UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/8 "2014-09-09T09:46:52Z")

</div>

Created an [issue](https://github.com/ansible/ansible/issues/8937) on Github …

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 9, 2014, 4:44pm UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/9 "2014-09-09T16:44:44Z")

</div>

Thanks, I commented on it - I would use https:// for anonymous checkouts on GitHub but we can investigate.

---

<div class="post-metadata">

**Author:** ![Tomaz\_Strukelj](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Tomaz\_Strukelj](https://forum.ansible.com/u/Tomaz_Strukelj)\
**Post date:** [September 24, 2015, 11:39am UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/10 "2015-09-24T11:39:55Z")

</div>

This still doesn’t work for me , any of below :

`

- src: [git@git.example.com](mailto:git@git.example.com):ansible/ansible-zsh.git  
scm: git

- src: [git@git.example.com](mailto:git@git.example.com)/ansible/ansible-zsh.git  
scm: git

- src: ssh://git@git.example.com:ansible/ansible-zsh.git  
scm: git

- src: ssh://git@git.example.com/ansible/ansible-zsh.git  
scm: git

- src: git+ssh://git@git.example.com:ansible/ansible-zsh.git

- src: git+ssh://git@git.example.com/ansible/ansible-zsh.git

`

All of the above produce “command git clone … failed”

I can successfuly run “git clone [git@git.example.com](mailto:git@git.example.com):ansible/ansible-zsh.git ansible-zsh” , which gets outputed by Ansible (by using the first “src:” config above which is supposed to be incorrect syntax in the first place) :

- executing: git clone [git@git.example.com](mailto:git@git.example.com):ansible/ansible-zsh.git ansible-zsh

So Ansible seems to output here something that is not in fact executing (probably it’s not using git binary)

`$ ansible --version ansible 1.9.3`

I’m using Gitolite and have only ssh access , no http(s) . It works ok with https on Github .

---

<div class="post-metadata">

**Author:** ![Tomaz\_Strukelj](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Tomaz\_Strukelj](https://forum.ansible.com/u/Tomaz_Strukelj)\
**Post date:** [October 1, 2015, 12:30pm UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/11 "2015-10-01T12:30:57Z")

</div>

Solved , my bad , used sudo instead of “sudo -E” to pass SSH\_AUTH\_SOCK.  
And it does run git binary , the string after “executing:” is the exact command that gets executed.

---

<div class="post-metadata">

**Author:** ![Vishal\_Uderani](https://avatars.discourse-cdn.com/v4/letter/v/c4cdca/32.png) [@Vishal\_Uderani](https://forum.ansible.com/u/Vishal_Uderani)\
**Post date:** [October 1, 2015, 12:36pm UTC](https://forum.ansible.com/t/advanced-control-over-role-requirements-files-git-clone-ssh/16118/12 "2015-10-01T12:36:30Z")

</div>

write your task something like this

# Pulls the code from a remote Git repository, - name: checkout latest web app code from github git: [repo=git@repo.repo.com](mailto:repo=git@repo.repo.com):repo:repo.git dest=/some/location key\_file= path/to/key/file accept\_hostkey=yes
