Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requiring roles from an external git repo doesn't work as documented #10832

Closed
msabramo opened this issue Apr 24, 2015 · 5 comments · Fixed by #10860
Closed

Requiring roles from an external git repo doesn't work as documented #10832

msabramo opened this issue Apr 24, 2015 · 5 comments · Fixed by #10860
Labels
docs This issue/PR relates to or includes documentation. feature This issue/PR relates to a feature request. P2 Priority 2 - Issue Blocks Release

Comments

@msabramo
Copy link
Contributor

According to http://docs.ansible.com/playbooks_roles.html#role-dependencies, I can do:

- { role: 'git+http://git.example.com/repos/role-foo,v1.1,foo' }

but this doesn't work; when running a playbook that has a role that has this, Ansible tries to look on the local file system which of course fails:

ERROR: cannot find role in 
/Users/marca/dev/surveymonkey/smstack/smstack/ansible/roles/git+http:/git.example.com/repos/role-foo,v1.1,foo
or /Users/marca/dev/surveymonkey/smstack/smstack/ansible/git+http:/git.example.com/repos/role-foo,v1.1,foo
or /etc/ansible/roles/git+http:/git.example.com/repos/role-foo,v1.1,foo

ansible-playbook --version
ansible-playbook 1.9.0.1
  configured module search path = None

Cc: @bcoca, @sudarkoff

@bcoca
Copy link
Member

bcoca commented Apr 24, 2015

the role will not be autodownloaded, this still needs to happen by invoking ansible-galaxy, we should really make that clearer in the docs (though it is a feature we do want).

@bcoca bcoca added feature_idea P2 Priority 2 - Issue Blocks Release labels Apr 24, 2015
@msabramo
Copy link
Contributor Author

Ah okay. Yeah, that's confusing, because the fact that it allows you to put a URL suggests that it might download it for you even though it doesn't actually say that. Why else would you put a URL instead of just the name of the role if it wasn't doing something over the network (rhetorical question)?

Would love to be able to autodownload roles from galaxy or github.

It would event be pretty good if you could just pop a requirements.yml file in the playbook directory and ansible would automatically do ansible-galaxy install -r requirements.yml. This is what I ended up doing in my case, though I do it in a separate step from a Python wrapper that we have around ansible-playbook. As it stands, you can't even put ansible-galaxy install -r requirements.yml in the same playbook as the one that uses the role, because during playbook verification, ansible will complain about the missing role and this occurs before it can execute ansible-galaxy. I guess another way to solve this is if there was some way to specify special tasks in a playbook that get run before verification, which I imagine is probably hard and/or doesn't make sense to the way that Ansible works, but I'll throw it out there just in case.

@scottjacobsen
Copy link

+1 to clearing this up. It is super confusing. I wasted a day on it. As far as I can tell ansible-galaxy cannot download roles from a git repo. Only through the ansible-galaxy api. Is that right?

@bcoca
Copy link
Member

bcoca commented Apr 28, 2015

ansible-galaxy is able to download roles from any git/mercurial repo

@msabramo
Copy link
Contributor Author

Another way to solve things is if ansible allowed you to install roles with pip. Then one could have a requirements file with ansible and all the necessary roles.

bcoca added a commit to bcoca/ansible that referenced this issue Apr 28, 2015
@ansibot ansibot added docs This issue/PR relates to or includes documentation. feature This issue/PR relates to a feature request. and removed docs_report labels Mar 1, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs This issue/PR relates to or includes documentation. feature This issue/PR relates to a feature request. P2 Priority 2 - Issue Blocks Release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants