How to specify author and version of a dependency of a role?

96 views
Skip to first unread message

Andrew Pashkin

unread,
May 21, 2014, 4:58:52 AM5/21/14
to ansible...@googlegroups.com
Here in the docs the way to define dependencies for a role is described.

But since role is often a reusable module, it must specify its exact dependencies to be independent from whatever roles user have in his "roles" folder. If I define dependency like postgres in my role how would I ensure, that the postgres role is exactly that role what I used when built my dependent role - so it takes all variables which I expected and works as expected in general?
-- 
With kind regards, Andrew Pashkin.
cell phone - +7 (985) 898 57 59
Skype - waves_in_fluids
e-mail - andrew....@gmx.co.uk

James Cammarata

unread,
May 21, 2014, 7:57:36 AM5/21/14
to ansible...@googlegroups.com

You control which roles are installed on your system, so that is really a matter of personal preference. If you use the ansible-galaxy tool to install roles from galaxy.ansible.com, you can specify both the version of the role (if the author is using versions) as well as the directory to save the role. That way, you could have multiple versions of the same role if you needed to.

The author and other information about each role is stored in the roles meta/main.yml, but is not used when declaring the dependency.

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/537C6ACC.7090602%40gmx.co.uk.
For more options, visit https://groups.google.com/d/optout.

Andrew Pashkin

unread,
May 21, 2014, 8:13:21 AM5/21/14
to ansible...@googlegroups.com
On 21.05.2014 15:57, James Cammarata wrote:
>
> You control which roles are installed on your system, so that is
> really a matter of personal preference.
>
Yes, but I can't control what user of my role will have installed. And
user do not want to dig through all downloaded roles guessing which
exactly version from which author he need to be sure that nothing will
break.
Is there some reason behind that Ansible does not take in attention
versions like Pip for example? With Pip I can just set exact versions of
dependencies that I need to run my project, and don't worry about
anything, but this option is absent in Ansible, where there is a similar
use case.

Michael DeHaan

unread,
May 21, 2014, 6:13:29 PM5/21/14
to ansible...@googlegroups.com
"Is there some reason behind that Ansible does not take in attention versions like Pip for example?"

Ansible-galaxy (you mean ansible-galaxy, not ansible) here, as a command line tool does take requirements files.

You can easily have one like

username1.rolename2,1.2.3
username3.rolename4,4.5.6

and use it just like a pip requirements file

We've also said we're happy to entertain pull requests to add more features to the galaxy CLI, if you find something else in need of upgrades.




--
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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/537C9861.3030505%40gmx.co.uk.

Andrew Pashkin

unread,
May 25, 2014, 8:08:31 AM5/25/14
to ansible...@googlegroups.com
How pull requests for Ansible are happen? Do I need to create an issue on GitHub at first?

Thoughts on topic:

from the user perspective:
- I want to have option to automatically install all needed dependencies to run my playbook (Berkshelf can do that, but it, as well as Chef - pretty unpythonic tool)
from roles developer perspective:
- I want to specify dependencies in a way that user who will use it will be able to fetch them and run my role in same environent as I intend.
issues that that features lead to:
- How to solve version clashes between roles?
PS
Can I specify versions in meta/main.yml in such format: username1.rolename2,1.2.3?



On 22.05.2014 02:13, Michael DeHaan wrote:
"Is there some reason behind that Ansible does not take in attention versions like Pip for example?"

Ansible-galaxy (you mean ansible-galaxy, not ansible) here, as a command line tool does take requirements files.

You can easily have one like

username1.rolename2,1.2.3
username3.rolename4,4.5.6

and use it just like a pip requirements file

We've also said we're happy to entertain pull requests to add more features to the galaxy CLI, if you find something else in need of upgrades.


On Wed, May 21, 2014 at 8:13 AM, Andrew Pashkin <andrew....@gmx.co.uk> wrote:
On 21.05.2014 15:57, James Cammarata wrote:

You control which roles are installed on your system, so that is really a matter of personal preference.

Yes, but I can't control what user of my role will have installed. And user do not want to dig through all downloaded roles guessing which exactly version from which author he need to be sure that nothing will break.
Is there some reason behind that Ansible does not take in attention versions like Pip for example? With Pip I can just set exact versions of dependencies that I need to run my project, and don't worry about anything, but this option is absent in Ansible, where there is a similar use case.


--
With kind regards, Andrew Pashkin.
cell phone - +7 (985) 898 57 59
Skype - waves_in_fluids
e-mail - andrew....@gmx.co.uk

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgxYfTZH653Buew6VfUmQogF1%2B1ibUEN7Nq%2BE-6xMCE6wA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Guillaume DEDRIE

unread,
May 25, 2014, 4:38:05 PM5/25/14
to ansible...@googlegroups.com
Hi,
Using a "galaxy.yml" file as describe by Michael is pretty useful. (check an example there: https://github.com/guillaumededrie/ansible-private-cloud).


PS
Can I specify versions in meta/main.yml in such format: username1.rolename2,1.2.3?
 
I don't see any of this  https://github.com/ansible/ansible/blob/devel/bin/ansible-galaxy#L707.

I'm adding a thought:
 - How to handle role which are not on the Galaxy repository ?
(gitmodule ? Galaxy command improvements to add direct link to  meta/main.yml from a repository ? ...)

Regards,
--
Guillaume

Michael DeHaan

unread,
May 25, 2014, 5:12:00 PM5/25/14
to ansible...@googlegroups.com
On Sun, May 25, 2014 at 8:08 AM, Andrew Pashkin <andrew....@gmx.co.uk> wrote:
How pull requests for Ansible are happen? Do I need to create an issue on GitHub at first?


No, just submit the pull request.  Pull requests are also issue tickets for GitHub.
 

Thoughts on topic:

from the user perspective:
- I want to have option to automatically install all needed dependencies to run my playbook (Berkshelf can do that, but it, as well as Chef - pretty unpythonic tool)

ansible-galaxy's CLI already does this.

Michael DeHaan

unread,
May 25, 2014, 5:13:15 PM5/25/14
to ansible...@googlegroups.com


I'm adding a thought:
 - How to handle role which are not on the Galaxy repository ?
(gitmodule ? Galaxy command improvements to add direct link to  meta/main.yml from a repository ? ...)


I'd be very open to taking pull requests to teach ansible-galaxy about dependencies outside of Galaxy, such as git repos.

I'd probably suggest a syntax like git:// and ssh://user[:password]@hostname/foo/foo.git, etc.

 
Reply all
Reply to author
Forward
0 new messages