title: Ansible: How to Include all hosts but run roles on particular hosts?
body: <p>I'm trying to include all hosts as I want to use one host facts in other host configuration. </p>
  
  <p>But I have </p>
  
  <ul>
  <li>tasks common for all</li>
  <li>tasks common for two groups</li>
  <li>tasks for individual group.</li>
  </ul>
  
  <p>When I tried the below way, all tasks are running on all hosts. How can I make sure to apply a role on the specific group ?</p>
  
  <pre><code>- hosts: Local:Global:Stream
  
    tasks:
    - include_role:
        name: global
      when: host in groups['Global']
  
    - include_role:
        name: local
      when: host in groups['Local']
  
    - include_role:
        name: stream
      when: host in groups['Stream']
  </code></pre>