Check out example codes for "multiple hosts in same role". It will help you in understanding the concepts better.

Code Example 1

---
- hosts: groupa
  roles:
    - oracle

- hosts: groupb
  roles:
    - apache

- hosts: local
  connection: local
  tasks:
    - { debug: { msg: "Tasks to run locally" } }

Code Example 2

---
- connection: local
  gather_facts: false
  hosts: linux-srvr
  roles:  
  - linuxchk

- gather_facts: false
  hosts: jabber-srvr
  roles:  
  - jabber-msg

Learn ReactJs, React Native from akashmittal.com