title: ansible - run playbook serialized on two groups of hosts
body: <p>I have a georedundant setup of a service, as example one backend, one balancer in front, rz1 and rz2 are the different locations.</p>
  
  <p>inventory</p>
  
  <pre><code>[middlewarerz1]
  servicerz1-qa01.server.lan
  
  [middlewarerz2]
  servicerz2-qa01.server.lan
  
  [balancerrz1]
  servicerz1lb-qa01.server.lan
  
  [balancerrz2]
  servicerz2lb-qa01.server.lan
  </code></pre>
  
  <p>and two playbooks under my site.tml</p>
  
  <pre><code>  - import_playbook: middleware.yml
    - import_playbook: loadbalancers.yml
  </code></pre>
  
  <p>What i need is that the playbook run makes middleware.yml/loadbalancers.yml for RZ1 hostgroups, then for RZ2 serialized. Both playbooks need the information of both hostgroups to configure the firewall/balancing.</p>
  
  <p>The Todo is </p>
  
  <ul>
  <li>Do "middleware.yml" for group "middlewarerz1" and use group "balancerrz1" variables</li>
  <li>Do "loadbalancers.yml" for group "balancerrz1" and use group "middlewarerz1" variables</li>
  <li>Do "middleware.yml" for group "middlewarerz2" and use group "balancerrz2" variables</li>
  <li>Do "loadbalancers.yml" for group "balancerrz2" and use group "middlewarerz2" variables</li>
  </ul>
  
  <p>Is there a way to map hostgroups one one generic hostgroup in the site.yml like</p>
  
  <pre><code>## Do RZ1
    - hosts: [middleware:children]
              middlewarerz1
             [balancer:children]
              balancerrz1
    - import_playbook: middleware.yml
    - import_playbook: loadbalancers.yml
  
  ## Do RZ2
    - hosts: [middleware:children]
              middlewarerz2
             [balancer:children]
              balancerrz2
    - import_playbook: middleware.yml
    - import_playbook: loadbalancers.yml
  </code></pre>