# Changing the way inverted matches work to make them more obvious

**URL:** <https://forum.ansible.com/t/changing-the-way-inverted-matches-work-to-make-them-more-obvious/11800>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [August 15, 2012, 2:49pm UTC](https://forum.ansible.com/t/changing-the-way-inverted-matches-work-to-make-them-more-obvious/11800 "2012-08-15T14:49:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seth\_Vidal](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Seth\_Vidal](https://forum.ansible.com/u/Seth_Vidal)\
**Post date:** [August 15, 2012, 2:49pm UTC](https://forum.ansible.com/t/changing-the-way-inverted-matches-work-to-make-them-more-obvious/11800/1 "2012-08-15T14:49:56Z")

</div>

Just want to make sure I understand this.

Right now if I want to negate something I do:

-i myinventory 'hostgroup!hostname'

and that will hit all systems in the hostgroup whose names are not hostname?

do I have that right?

-sv

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 15, 2012, 3:03pm UTC](https://forum.ansible.com/t/changing-the-way-inverted-matches-work-to-make-them-more-obvious/11800/2 "2012-08-15T15:03:24Z")

</div>

> Just want to make sure I understand this.
> 
> Right now if I want to negate something I do:
> 
> -i myinventory ‘hostgroup!hostname’
> 
> and that will hit all systems in the hostgroup whose names are not  
> hostname?
> 
> do I have that right?
> 
> -sv

I sent a follow up email, but this was just my imagination and it was working the same way earlier and I didn’t change anything.

Your usage is correct, everything in “host group”, that does not match “hostname”

(multiple patterns in the same host spec are ORs, except “!patterns”, which work like ANDs, and --limit is also an AND.)

---

<div class="post-metadata">

**Author:** ![Seth\_Vidal](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Seth\_Vidal](https://forum.ansible.com/u/Seth_Vidal)\
**Post date:** [August 15, 2012, 3:04pm UTC](https://forum.ansible.com/t/changing-the-way-inverted-matches-work-to-make-them-more-obvious/11800/3 "2012-08-15T15:04:04Z")

</div>

okay - that works. thanks  
-sv
