title: Ansible - is it possible to add tags to hosts inside inventory?
body: <p>As the topic says, my question is if its possible to add tags to the hosts described inside the inventory? </p>
  
  <p>My goal is to be able to run the ansible-playbook on specific host/group of hosts which has that specific tag e.g only on servers with tag 'Env=test and Type=test'</p>
  
  <p>So for example when I run the playbook:</p>
  
  <pre><code>ansible-playbook -i hosts test.yml --extra-vars "Env=${test} Type=${test}"
  </code></pre>
  
  <p>I will pass the tags in the command and it will run only on the filtered hosts.</p>
  
  <p>Thanks a lot!</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Alternatively maybe doing something like in dynamic inventory? <a href="https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html#developing-inventory" rel="noreferrer">https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html#developing-inventory</a></p>
  
  <pre><code>[tag_Name_staging_foo]
  
  [tag_Name_staging_bar]
  
  [staging:children]
  tag_Name_staging_foo
  tag_Name_staging_bar
  </code></pre>