Re: [ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-25 Thread Petros Moisiadis
On 04/24/2014 09:53 PM, ra...@future500.nl wrote: Hey Ernest0x, I don't think the dependencies currently stand to mean extend in the OO sense. All it means is I depend on some othe role, so make sure that role is run before me. Each role is still an independent one. I believe this is a very

Re: [ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-25 Thread Ramon de la Fuente
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

Re: [ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-25 Thread Petros Moisiadis
On 04/25/14 13:28, Ramon de la Fuente wrote: 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

Re: [ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-25 Thread Strahinja Kustudić
You are complicating things with all this, think of it a lot simpler. Regarding your example you can solve #1 in two ways: 1. Don't set hosts file with a template, but using lineinfile 2. Don't change the hosts file in common role, since from the looks of it, it is not common enough On

Re: [ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-25 Thread Strahinja Kustudić
I can see your suggestion being useful, but for now, you just have to think of roles as group of similar tasks and that is all, don't think of them as classes in an OO language. I don't see that this will change any time soon. On Friday, April 25, 2014 4:39:49 PM UTC+2, Ernest0x wrote: On

Re: [ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-25 Thread Adam Morris
On Friday, April 25, 2014 12:01:16 AM UTC-7, Ernest0x wrote: 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

Re: [ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-25 Thread 'Petros Moisiadis' via Ansible Project
On 04/25/14 17:48, Strahinja Kustudić wrote: I can see your suggestion being useful, but for now, you just have to think of roles as group of similar tasks and that is all, don't think of them as classes in an OO language. I don't see that this will change any time soon. Actually, from

Re: [ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-24 Thread Petros Moisiadis
On 04/24/14 15:50, Michael DeHaan wrote: I have not done any tests yet, but what is currently the expected behavior when a role that depends on a common role provides a template with the same name as the common role? I'm having a hard time parsing this. It might be helpful to see a

Re: [ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-24 Thread ramon
Hey Ernest0x, I don't think the dependencies currently stand to mean extend in the OO sense. All it means is I depend on some othe role, so make sure that role is run before me. Each role is still an independent one. I believe this is a very clear and useful way of thinking of the dependecies

Re: [ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-24 Thread Strahinja Kustudić
Why not use variables for what you want. If you would like to use different templates for different servers using the same role, why not define a default template file in defaults directory of the role something like this: # foo_role/defaults/main.yml --- foo_role_template_file: default.j2

[ansible-project] Overriding a template provided by a common role when invoked by a another role through dependency

2014-04-23 Thread Petros Moisiadis
Hello, I have not done any tests yet, but what is currently the expected behavior when a role that depends on a common role provides a template with the same name as the common role? Is the task in the common role (being invoked by the dependent role) executed with the template provided by the