Take a look at the "allow_duplicates" parameter.

http://docs.ansible.com/playbooks_roles.html#id8




On Wed, Jul 16, 2014 at 6:01 PM, Ahmad Khayyat <[email protected]> wrote:

> I have a common role, which i always want executed, but only once. It is
> also a dependency of a few other roles that may be executed on their own
> (via dedicated playbooks).
>
> The problem is: in a top-level playbook, e.g. site.yml, if the common role
> is listed anywhere (in site.yml or an included playbook), and is also a
> dependency of any other role, its tasks are executed twice.
>
> What I'm thinking is to create a dummy role that depends on 'common', and
> include the dummy role in the top-level playbook for all hosts. That way,
> 'common' is *always* a dependency, and is always executed exactly once.
>
> Is there a better solution?
>
> More generally, how can I avoid executing a role more than once, whether
> it's listed explicitly or pulled in as a dependency?
> If a role is a dependency of multiple other roles, it's executed once, but
> if it's also listed explicitly, it is executed twice.
>
> --
> 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/CAM19uTCnyStH4yH9hkLg58T2MqG5Vv9CWXR1FB11%3D5hBkvXcdQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAM19uTCnyStH4yH9hkLg58T2MqG5Vv9CWXR1FB11%3D5hBkvXcdQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgyAct8nEhiJhWF0E6LeDf7hocFM5P7PiNHNmkC_R_YzPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to