# Multiple patterns for hosts?

**URL:** <https://forum.ansible.com/t/multiple-patterns-for-hosts/13597>\
**Category:** Ansible Project\
**Created:** [October 3, 2013, 5:53am UTC](https://forum.ansible.com/t/multiple-patterns-for-hosts/13597 "2013-10-03T05:53:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaniv\_Kaul](https://avatars.discourse-cdn.com/v4/letter/y/bc79bd/32.png) [@Yaniv\_Kaul](https://forum.ansible.com/u/Yaniv_Kaul)\
**Post date:** [October 3, 2013, 5:53am UTC](https://forum.ansible.com/t/multiple-patterns-for-hosts/13597/1 "2013-10-03T05:53:34Z")

</div>

I’m trying to monitor clusters of hosts, all of which have 2 nodes.  
Their hostnames are host200-n1 for 1st node and host200-n2 for the 2nd node and so on.  
For this I wanted to use the following pattern in my hosts file:  
host[100:200]-n[1:2].example.com

This does not seem to work.  
As a workaround I’ve defined:  
host[100:200]-n1.example.com  
host[100:200]-n2.example.com

Thanks,  
Y.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 3, 2013, 7:31am UTC](https://forum.ansible.com/t/multiple-patterns-for-hosts/13597/2 "2013-10-03T07:31:09Z")

</div>

You are correct. This is not a bug.

You can only use one host pattern, and we’ve only documented things that _do_ work, so coming up with alternative syntaxes will not 🙂

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 3, 2013, 7:35am UTC](https://forum.ansible.com/t/multiple-patterns-for-hosts/13597/3 "2013-10-03T07:35:04Z")

</div>

Also wanted to point out, seeing you appear to have a lot of hosts, you may also be interested in sourcing your inventory from a dynamic inventory script.

You don’t have to define them in that one particular format if they already exist somewhere else, or if you want to import from cloud storage or some other database, etc.
