Different hosts inside a role (is it doable, or am i thibking it wrong ?)

24 views
Skip to first unread message

Alejandro Comisario

unread,
Nov 13, 2014, 7:15:23 PM11/13/14
to ansible...@googlegroups.com
Hi guys, im having a role defined like this on my main playbook.yml, this role runs on the galera hosts :

- hosts: galera
  gather_facts: True
  roles:   
    - { role: galera, tags: ['galera'] }

The main.yml in the tasks directory of the role goes like this:

---
- include: mysql.yaml
- include: rabbitmq.yaml

When i first lets say, install mysql on the galera hosts, BUT, after that i need to go to the rabbit host, and execute the tasks in the rabbitmq.yaml, and that fails of course because i want to run rabbit module things over a hosts that only has mysql in it, so, being the role executed in the playbook.yaml over the galera hosts, ive tried this without success on the roles/galera/tasks/main.yaml

---
- include: mysql.yaml
- hosts: rabbitmq
  include: rabbitmq.yaml

So my question is, how can i specify to a role, that it MIGHT do things on different hosts in whole run ?
Is that doable ?

thanks!
best regards

Brian Coca

unread,
Nov 14, 2014, 3:14:07 PM11/14/14
to ansible...@googlegroups.com
plays map hosts to tasks, not roles, you need another play.


--
Brian Coca

Alejandro Comisario

unread,
Nov 15, 2014, 8:58:34 AM11/15/14
to ansible...@googlegroups.com
got it.
thanks Brian
Reply all
Reply to author
Forward
0 new messages