# Cannot define a role dependency with source control repository url

**URL:** <https://forum.ansible.com/t/cannot-define-a-role-dependency-with-source-control-repository-url/16268>\
**Category:** Ansible Project\
**Tags:** awx\
**Created:** [September 18, 2014, 9:45am UTC](https://forum.ansible.com/t/cannot-define-a-role-dependency-with-source-control-repository-url/16268 "2014-09-18T09:45:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent\_Jestin](https://avatars.discourse-cdn.com/v4/letter/v/f05b48/32.png) [@Vincent\_Jestin](https://forum.ansible.com/u/Vincent_Jestin)\
**Post date:** [September 18, 2014, 9:45am UTC](https://forum.ansible.com/t/cannot-define-a-role-dependency-with-source-control-repository-url/16268/1 "2014-09-18T09:45:10Z")

</div>

Hello,

This might be a dummy question but I’m stuck with role dependency definition in ansible.

I’d like to use a role defined in a git repository as a dependency for another role. In the [doc](http://docs.ansible.com/playbooks_roles.html) I can see that:

> Role dependencies can also be installed from source control repos or tar files, using a comma separated format of path, an optional version (tag, commit, branch etc) and optional friendly role name (an attempt is made to derive a role name from the repo name or archive filename):
> 
> > * * *
> > 
> > dependencies:
> > 
> > - { role: ‘git+http://git.example.com/repos/role-foo,v1.1,foo’ }
> > - { role: ‘/path/to/tar/file.tgz,friendly-name’ }

I tried with a public github repo, let say something like [https://github.com/myuser/my-role-test.git](https://github.com/myuser/my-role-test.git)

I put this in the meta/main.yml file:

> dependencies:
> 
> > - { role: ‘git+https://github.com/myuser/my-role-test.git,master,test-dep’ }

Then I run my playbook, and I get the following error:

> ERROR: cannot find role in /var/lib/awx/projects/\_1\_\_myproject/roles/git+https:/github.com/myuser/test.git,master,test-dep or /var/lib/awx/projects/\_1\_\_myproject/git+https:/github.com/myuser/test.git,master,test-dep or /etc/ansible/roles/git+https:/github.com/myuser/test.git,master,test-dep

(Here you can guess I’m using tower. But for the purpose of this issue, I’m trying to run the playbook directly with ansible-playbook command.)

When I see this error message, I guess that the git url is just parsed like a directory structure. I’ve tried several url format like git@, git+ssh://, ssh://… No success.

So I had a look at ansible source code to figure out how the role value was parsed (play.py). I’m not a python expert however I can just see a \_get\_role\_path method dealing exclusively with filesystem path stuff.

Is this “role dependency from git repo” feature real?

On the other side I can see this recent [thread](https://groups.google.com/forum/#!msg/ansible-project/TawjChwaV08/3p6Zv24rMWgJ) with famous people here talking about this feature…

I’m probably missing something. Can someone help?

Thank you!

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [September 18, 2014, 1:19pm UTC](https://forum.ansible.com/t/cannot-define-a-role-dependency-with-source-control-repository-url/16268/2 "2014-09-18T13:19:48Z")

</div>

Hi Vincent,

Right now, you can install roles and dependencies via the ansible-galaxy command, however when those roles are executed via ansible-playbook, they need to be local. So I would recommend installing them first via the ansible-galaxy command. If you’re not familiar with it, please see this documentation page on how to install roles directly from git repositories:

[http://docs.ansible.com/galaxy.html#advanced-control-over-role-requirements-files](http://docs.ansible.com/galaxy.html#advanced-control-over-role-requirements-files)

Thanks!

---

<div class="post-metadata">

**Author:** ![Vincent\_Jestin](https://avatars.discourse-cdn.com/v4/letter/v/f05b48/32.png) [@Vincent\_Jestin](https://forum.ansible.com/u/Vincent_Jestin)\
**Post date:** [September 18, 2014, 3:36pm UTC](https://forum.ansible.com/t/cannot-define-a-role-dependency-with-source-control-repository-url/16268/3 "2014-09-18T15:36:35Z")

</div>

Ok, thank you.

I will wait for the 1.8 to be released then…

---

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [October 3, 2017, 5:55pm UTC](https://forum.ansible.com/t/cannot-define-a-role-dependency-with-source-control-repository-url/16268/4 "2017-10-03T17:55:47Z")

</div>

I’m using ansible v2.3.2.0. How come I still can’t use git repos for role dependencies in a role’s meta/main.xml file? I’m using the OP’s syntax.

`  
dependencies:

- { role: ‘git+[http://git.example.com/repos/role-foo.git](http://git.example.com/repos/role-foo,v1.1,foo)’}

or

dependencies:

- { role: ‘git+[ssh://git.example.com:9999/repos/role-foo,v1.1,foo](http://git.example.com/repos/role-foo,v1.1,foo)’ }  
`

---

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [October 3, 2017, 6:09pm UTC](https://forum.ansible.com/t/cannot-define-a-role-dependency-with-source-control-repository-url/16268/5 "2017-10-03T18:09:12Z")

</div>



---

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [October 3, 2017, 6:09pm UTC](https://forum.ansible.com/t/cannot-define-a-role-dependency-with-source-control-repository-url/16268/6 "2017-10-03T18:09:30Z")

</div>

[RTFM](http://docs.ansible.com/ansible/latest/galaxy.html#dependencies)
