Hi,

I understand the suggestion about adding more variables to your templates to be 
able to steer with variables; and I understand defaults - this is exactly how 
we try to build roles for galaxy. The problem lies with roles beyond your own 
control - i.e. roles by other people where you want to make a change in the 
template that was not made possible with variables (a pull-request on that role 
might also do the trick).

I think I would draw the line at overriding files/templates though. Or perhaps 
a whole task lists. If you want to add tasks to a role - i'd suggest adding a 
separate role to the playlist following the previous role you wanted to adjust 
- or adding pre_tasks/post_tasks to your playbook. Extending tasks sounds like 
a bridge too far... 

for me, Ansible works because of it's simplicity, and I "extending" roles would 
hurt that. BC-Break or not, it adds complexity to maintain. 
My 2cts.

-- 
Ramon



> Hi Ramon,
> 
> What you suggest could be useful only if you just want to override some 
> templates and/or files. But you may also want your 'extend' role to have some 
> new tasks of its own, so that they are run after the invocation of the 'base' 
> role. So that' s where the OO-like approach I suggest applies. You write a 
> new role that can override relative paths when invoking the base role and 
> which may also add new functionality with tasks of its own. It's not fully 
> object oriented because you still cannot override tasks in a single pass 
> (though this could be done with added syntax complexity), but you can have 
> tasks in the 'extend' role that work to override changes made by tasks in the 
> 'base' role. 
> Above all, the approach I suggest is very simple and, by having an explicit 
> option to enable this mode in the dependency statement, it's totally harmless 
> and backwards-compatible.
> 
> The above applies also to the suggestion of Strahinja to use the same role 
> with a parameter that changes the template. It is bound to the functionality 
> of a single role and does not allow for new (extended) functionality. Think 
> that you may want to have multiple roles that each one extends the same base 
> role, but has it's own set of overridden templates/files and new tasks.
> 
> -- 


-- 
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/8C41BF79-B5DB-400A-8741-1FBAC459BBA4%40future500.nl.
For more options, visit https://groups.google.com/d/optout.

Reply via email to