I’m wondering is it a good way share a complete playbook using the ansible galaxy.
and yes, I’ve read documentation:" Instead of creating giant playbooks with hundreds of tasks we can use roles to organise tasks, …"
however, the role approach is not suitable for complex cluster applications when services(roles) depend on each other and in the turn depends on hosts.
also, as I understand, ansible galaxy is not supposed to deliver the ready to use solution - it just provides recipes and makes a user to _create_a playbook( cut and paste)
according to the provided by the role documentation - so it’s not even supposes to deliver a ready to use playbook/template configuration file - am I wrong ?
what I think:
well, consider a regular book you are eventually reading. if you apply the ansible galaxy approach to the human reading books, than the book store
should look like a swedish table where you can pick chapters like ‘crime’, ‘love’,‘nature’,‘programming in 24 hours’, ‘happy end’, etc - and compose your own book.
so the another question:
do I understand the ansible-galaxy correctly or did I miss any thing ?
the questions are not abstract - I have the playbook - https://github.com/sergevs/ansible-cloudera-hadoop which is tested, documented, doing that it states and I hope is really easy to use for the end user.
I do think that If I would try to broke it to ansible galaxy roles it will ruin the work and make it unusable for the end user with unpredictable final result.
I really would appreciate ansible galaxy experts advices.
I believe Galaxy roles can have role dependencies stated in meta/main.yml, just like any other Ansible role on your system. So, individual roles could be written, and then encapsulated into a more elaborate role. For example, in the role you have provided a link, you could separate out hue and oozie into separate roles/repositories, and then list them in the dependencies in your cloudera-hadoop role.
#cloudera-hadoop/meta/main.yml
dependencies:
I like your bookshop analogy. A powerful element of writing code for computers is to reuse code that someone has already written, so it is important to have code stored in repositories in small, manageable pieces. Using role dependencies, we can wrap the roles we write into sculpted mega-roles. Some of my roles I use are simply a dependency list of six or seven other roles. Those may be beneficial on Galaxy as well, but I haven’t actually seen a Galaxy role with role dependencies yet.
As Ansible’s community matures, we’ll find a balance between roles that look like encyclopedias (which are prone to breaking due to outdated information) and paragraphs (which the user would have to build into a book).
Sorry, tab works differently in chrome than vim. Maybe I can find a plugin to fix my browser. :).
I was going to write this small example of a list of dependencies that could be listed in your meta/main.yml file:
#cloudera-hadoop/meta/main.yml
dependencies:
serge.common
serge.postgresql
serge.hue
serge.oozie
However, I am by no means a Galaxy expert. I haven’t even published any of my own roles yet. Someday I will.
Galaxy carries with it strange challenges for scope and naming conventions when you are trying to work with two or more roles to accomplish one end goal. It would be great to have roles wrapped into useful mega-roles that use the same naming conventions for variables. I’d be happy to see a mega-role that neatly wraps up the variables and defaults for all the minor roles. Also, if I needed one or two of the minor roles and not the rest, it would be great to be able to install that role by itself rather than write a new one.