Hi Jerome,
Like you suggested I think like what I would do is create a common
role that is included as a role dependency that includes the common
handlers that need to be invoked from multiple roles:
{some_other_role, logstash}/meta/main.yml:
dependencies:
- common
-John
On Mon, Dec 16, 2013 at 12:35 PM, Jerome Wagner <[email protected]> wrote:
> Hello,
>
> I have a role handler that I use to restart instances of node-logstash ;
> basically it does
>
> // roles/logstash/handlers/main.yml
>
> - name: restart logstash service
> service: name={{ item.initd_script }} state=restarted
> sudo: yes
> sudo_user: root
> when: item.state == "started"
> with_items: instances
>
> where instances is defined in // roles/logstash/vars/main.yml
>
> the role also takes care of node-logstash installation.
>
> I would like to re-use this handler from another play where the role is not
> invoked but it breaks because since the role is not invoked, the handler is
> not defined (and the variable either).
>
> I cannot just include the handler file because I will miss the vars.
>
> Is there a possibility to invoke a role without playing its tasks /
> dependencies ?
>
> Do you see a way to organize things so that this handler, along with its
> vars could be called easily from another play ? should I create a new role
> "logstash_common" with an empty "tasks" directory and invoke it where I need
> the handler ?
>
> 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].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
--
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].
For more options, visit https://groups.google.com/groups/opt_out.