# ec2 inventory tags combination

**URL:** <https://forum.ansible.com/t/ec2-inventory-tags-combination/19519>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [October 16, 2015, 4:50am UTC](https://forum.ansible.com/t/ec2-inventory-tags-combination/19519 "2015-10-16T04:50:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [October 16, 2015, 4:50am UTC](https://forum.ansible.com/t/ec2-inventory-tags-combination/19519/1 "2015-10-16T04:50:48Z")

</div>

Hi,

Following the [https://docs.ansible.com/ansible/intro\_dynamic\_inventory.html#using-multiple-inventory-sources](https://docs.ansible.com/ansible/intro_dynamic_inventory.html#using-multiple-inventory-sources) example, I have inventory file were I have defined my physical and aws servers using ec2 tags as a group in it :

# servers.txt :

“”“”"

[tag\_Type\_Web]

[web:children]  
[web01.example.com](http://web01.example.com)

[web02.example.com](http://web02.example.com)

tag\_Type\_Web

“”“”"

For every ec2 instance I have a also an environment tag for prod , dev , qa etc.. Unfortunately I don’t see how can I combine tags to run my playbooks, for example if I want to run a playbook separately against Web in production than Web in dev environment it seems like I have to define a tag by the name tag\_Type\_web\_prod or tag\_Type\_web\_dev hardcoding the values which is no efficient.

Is this the only way to do it or I’m missing something ?
