# Host Inventory Patterns (Many Hosts) Exclude a single host in between

**URL:** <https://forum.ansible.com/t/host-inventory-patterns-many-hosts-exclude-a-single-host-in-between/15870>\
**Category:** Ansible Project\
**Created:** [August 6, 2014, 12:40pm UTC](https://forum.ansible.com/t/host-inventory-patterns-many-hosts-exclude-a-single-host-in-between/15870 "2014-08-06T12:40:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Schmitt](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@Christian\_Schmitt](https://forum.ansible.com/u/Christian_Schmitt)\
**Post date:** [August 6, 2014, 12:40pm UTC](https://forum.ansible.com/t/host-inventory-patterns-many-hosts-exclude-a-single-host-in-between/15870/1 "2014-08-06T12:40:09Z")

</div>

Hello is there a way to exclude a host inside a Host pattern in a inventory file?

Example, I have the following inventory:

[hosts]  
www[01:50].example.com

is it possible to exclude host 25 ?

---

<div class="post-metadata">

**Author:** ![Henry\_Finucane](https://avatars.discourse-cdn.com/v4/letter/h/94ad74/32.png) [@Henry\_Finucane](https://forum.ansible.com/u/Henry_Finucane)\
**Post date:** [August 6, 2014, 9:37pm UTC](https://forum.ansible.com/t/host-inventory-patterns-many-hosts-exclude-a-single-host-in-between/15870/2 "2014-08-06T21:37:53Z")

</div>

You could split it into two lines with 25 missing. If you think you're  
going to be doing a lot of special casing, you should consider a  
dynamic inventory too.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 7, 2014, 9:21pm UTC](https://forum.ansible.com/t/host-inventory-patterns-many-hosts-exclude-a-single-host-in-between/15870/3 "2014-08-07T21:21:20Z")

</div>

- hosts: this:&that:!those

In the above, the host must be in “this” and “that”, but cannot be part of the group named “those”.
