You can include role dependencies in the *meta/main.yml* for a role. These
are roles that will also be installed by the role, prior to the role
installing itself.
So, for common things you need on all machines, you can have a 'common'
role. Then, in the meta/main.yml for more specific roles, you can establish
'common' as a dependency. This is a snippet from one of my more complex
roles that combines a lot of smaller roles:
#~ansible/private/slack_lab/meta/main.yml
# The order listed is the order they will run.
# Tasks for this role (lab) will run after
# tasks for dependencies complete.
dependencies:
- { role: slack_common }
- { role: slack_nfsclient }
- { role: slack_nisclient }
- { role: ntpclient }
- { role: x11forwarding }
On Friday, December 4, 2015 at 7:12:13 AM UTC-6, Co S wrote:
>
> I extensively use roles and now came to idea that other roles share some
> tasks in common.
> What I've done so far I've split the initial main.yml task file into
> pieces and use include to re-use these tasks from other roles.
> May be not an elegant solution but it works.
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/81e29949-3121-4fa6-b207-37ebfa2ddf0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.