Ok great will have a look into that thanks Sent from iPhone
> On 24 Sep 2014, at 19:29, Michael DeHaan <[email protected]> wrote: > > > >> On Wed, Sep 24, 2014 at 1:53 PM, James Morgan <[email protected]> wrote: >> Hi, >> >> I see you point and I guess it should be improve the execution time to >> define a role once before the others rather than having each role check its >> dependency even if it is idempotent. >> >> I think the idea was that each role would be more encapsulated and that it >> ought to define the dependencies instead of somebody else having to work it >> out. > > There is already the "allow_duplicates" setting in Ansible that will prevent > a role from being loaded more than once, if called from the same parameters. > > This should apply within the same play. > > >> >> I solved my initial problem by ensuring that all my shared roles reference >> the directory they were packaged in. Instead of defining it in the project >> that imports it. >> >> All works fine and yes the tagging works perfectly. >> >> Will look to reduce the role dependencies. >> >> Thanks for your help >> >> James >> >>> On 24 September 2014 17:25, Michael DeHaan <[email protected]> wrote: >>> It's beside the point, but I really don't like role dependencies in ansible >>> - they were needed to end particular academic mailing list discussions >>> about composability, and I think they are appropriate in some cases, but in >>> *MOST* cases they overcomplicate setup. >>> >>> It would usually be easier to just list roles that need to run first ahead >>> of other roles, and that way the list is more clearly shown in the >>> playbook, rather than somewhat obfuscated in terms of order. Still, they >>> aren't going away. >>> >>> All being said, tagging a role should tag the dependent roles - if that >>> appears to not be working, definitely file a bug on GitHub for it. >>> >>> >>> >>>> On Tue, Sep 23, 2014 at 2:15 PM, James Morgan <[email protected]> >>>> wrote: >>>> The folder the roles get added to was created as part of the build process >>>> in Maven. >>>> >>>> I had a think and decided that if I move that back into Ansible and >>>> reference it in all the role dependencies then it should work >>>> >>>> I originally wanted to let the calling ansible project dictate the >>>> structure of the shared roles but I think doing this makes sense >>>> >>>> Open to all suggestions >>>> >>>> Thanks >>>> >>>>> On 23 September 2014 18:23, James Morgan <[email protected]> wrote: >>>>> Hi, >>>>> >>>>> I'm currently trying this but running into some problems. >>>>> >>>>> My plan is to package groups of roles then include them with the project >>>>> playbooks and roles. >>>>> >>>>> i.e >>>>> >>>>> roles/role1/ >>>>> roles/role2/ >>>>> roles/projectA/role3 >>>>> roles/projectA/role4 >>>>> roles/projectA/role5 >>>>> ... >>>>> >>>>> The issue I have found is that, whilst I can reference projectA/role3 >>>>> >>>>> --- >>>>> dependencies: >>>>> - { role: projectA/role3 } >>>>> >>>>> If projectA/role3 has dependencies that are relative to its directory >>>>> they aren't found. >>>>> >>>>> My thinking at the moment is to package every role in the roles directory >>>>> and forego nested directory structure but its not as clean >>>>> >>>>> I have many projects and a growing number of common role packages I need >>>>> to share. >>>>> >>>>> I'm free to move things around if that helps >>>>> >>>>> Any help most appreciated. >>>>> >>>>> James >>>>> >>>>>> On Monday, 23 September 2013 17:01:49 UTC+1, James Cammarata wrote: >>>>>> Yes, it's perfectly valid to pass a path as the role name, which allows >>>>>> you to more easily keep a common directory for your roles rather than >>>>>> requiring they be located in the same directory as the playbook. >>>>>> >>>>>> >>>>>>> On Mon, Sep 23, 2013 at 10:23 AM, Dan <[email protected]> wrote: >>>>>>> Hey, >>>>>>> >>>>>>> I noticed that I can create roles inside roles in dirs of roles. >>>>>>> >>>>>>> For example I can have the following structure: >>>>>>> - roles/php5-fpm >>>>>>> - roles/php5-fpm/pool >>>>>>> >>>>>>> And then, inside a playbook I can do: >>>>>>> >>>>>>> Roles: >>>>>>> - { role: php5-fpm, var1=something, var2=something } >>>>>>> - { role: php5-fpm/pool, var3=asdasd } >>>>>>> >>>>>>> Such structure seems really logical for me. >>>>>>> Using that structure I can also share tasks. >>>>>>> >>>>>>> For example in /roles/php5-fpm/handlers/main.yml I can do: >>>>>>> include: ../handlers/main.yml >>>>>>> >>>>>>> And that way I won't need to rewrite some stuff... >>>>>>> >>>>>>> I didn't see it documented anywhere, so I'm curious, will it be a good >>>>>>> practice to use such structure? >>>>>>> >>>>>>> Thanks. >>>>>>> -- >>>>>>> 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]. >>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>> James Cammarata <[email protected]> >>>>>> Sr. Software Engineer, AnsibleWorks, Inc. >>>>>> http://www.ansibleworks.com/ >>>>> >>>>> -- >>>>> You received this message because you are subscribed to a topic in the >>>>> Google Groups "Ansible Project" group. >>>>> To unsubscribe from this topic, visit >>>>> https://groups.google.com/d/topic/ansible-project/2as7VmaoHXY/unsubscribe. >>>>> To unsubscribe from this group and all its topics, 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/5bed79dd-4fa0-42e6-9c04-d82a7df3d35a%40googlegroups.com. >>>>> 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/CAGU9yvTfUm7JOj8JTV8WrXSD2o0nb31rtyBUUx0dpX5_Ev6BBA%40mail.gmail.com. >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Ansible Project" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/ansible-project/2as7VmaoHXY/unsubscribe. >>> To unsubscribe from this group and all its topics, 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%2BnsWgy0UsGcJkPc2R43dGGmAx1tDwULzehY%2BROmoC6dPpU0rg%40mail.gmail.com. >>> >>> 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/CAGU9yvR8yFWZ8_%2B_9hsDt7Ey0oZ5dTqz-THiontL5bJd6mSd-A%40mail.gmail.com. >> >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to a topic in the Google > Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/2as7VmaoHXY/unsubscribe. > To unsubscribe from this group and all its topics, 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%2BnsWgysCjezbj_bnYjdHKDrchp8NYEdzd6%3DpMPF9GTsTG%2BvJA%40mail.gmail.com. > 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/0B82077F-C10C-4ECD-A717-2A3158D19B5B%40gmail.com. For more options, visit https://groups.google.com/d/optout.
