Hi,

Thanks . As I wrote, B is dependent (a child) of role A.

In B task there is no template module called with source is sudoer2.j2. A
has one like this so when a host has role B - the first role A is called
and that template module is called. But it does not use the source
sudoer2.j2 located in role B templates folder. it uses the source file from
the templates folder of role A.

At the moment I have to put the template module in role B tasks and that is
called twice - role A with role A templates source and then role B with
role B template source. The end result is OK but because each repeated run
- role A sees that the file has changed (because the source of B templates
is different from A) then it templates it again, and then B does the same.

So end result is also OK but the template module always run!

The expected behaviour are:

* We do not need to call the template task on role B.
* If in role B templates folder has the source file, then when the template
task in role A is called it should use the source file from the template
folder of role B because it is closer role to the target host.


cheers





On Mon, Jan 5, 2015 at 1:31 AM, Dan Vaida <[email protected]> wrote:

> What is the role dependency in your case?
> Depending on how your roles are written+called this can be expected (i.e.
> the file gets templated by role B and then overwritten by A).
> Share your code if you need more help.
>
> On Thursday, 18 December 2014 06:46:38 UTC+1, Steve Kieu wrote:
>>
>> Hi All,
>>
>> I have role A and then B (dependent on A).
>>
>> I have sudoers.j2 in the templates folder for each role with different
>> content.
>>
>> When a host with role B applied ansible run the task on role A and apply
>> the source file which is not the one in templates folder of role B. Is it
>> expected behaviour?
>>
>> Thanks,
>>
>>
>>  --
> 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/7hC3qZ1VwJU/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/aec5625f-f348-4c04-bff1-1b9f778dc052%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/aec5625f-f348-4c04-bff1-1b9f778dc052%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Steve Kieu

-- 
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/CAAQ-o%2B9pXSvTvjymRz%3DH1%3Df%3DWhOy9joSjE7d_AiczcXobFeB2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to