# EC2 compound tags and limiting dynamic inventory

**URL:** <https://forum.ansible.com/t/ec2-compound-tags-and-limiting-dynamic-inventory/23492>\
**Category:** Ansible Project\
**Created:** [January 18, 2017, 3:15pm UTC](https://forum.ansible.com/t/ec2-compound-tags-and-limiting-dynamic-inventory/23492 "2017-01-18T15:15:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bass\_Slap](https://avatars.discourse-cdn.com/v4/letter/b/ecb155/32.png) [@Bass\_Slap](https://forum.ansible.com/u/Bass_Slap)\
**Post date:** [January 18, 2017, 3:15pm UTC](https://forum.ansible.com/t/ec2-compound-tags-and-limiting-dynamic-inventory/23492/1 "2017-01-18T15:15:20Z")

</div>

I’m using ec2.py dynamic inventory successfully with limiting by _multiple tags_, but my need is to be able to limit by a tag where _one_ of the compound values matches, but I haven’t found a way to do so yet.

Example: Tag = Apps Compound value = app1|app2|app3|app4

I’m kicking this off via Jenkins, using the Invoke Ansible Playbook build step, where I’m passing -i ec2.py under “Additional parameters” and passing the limit under the “Host subset” section. The “Host subset” tags are built with variables passed in:

tag\_Apps\_${appname},tag\_Location\_${location}

I’m passing in one of the compound values as appname. Is there a way to do a limit with a tag where **at least one** of the compound values matches? Obviously the way I’m building the tag now and passing it in doesn’t work since it looks for that exact tag - just showing a working example of what works for a tag with a single value.
