# with\_inventory\_hostname error

**URL:** <https://forum.ansible.com/t/with-inventory-hostname-error/20418>\
**Category:** Ansible Project\
**Created:** [February 2, 2016, 10:12am UTC](https://forum.ansible.com/t/with-inventory-hostname-error/20418 "2016-02-02T10:12:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aurel](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Aurel](https://forum.ansible.com/u/Aurel)\
**Post date:** [February 2, 2016, 10:12am UTC](https://forum.ansible.com/t/with-inventory-hostname-error/20418/1 "2016-02-02T10:12:31Z")

</div>

Hello,

The documentation mentions “with\_inventory\_hostname” ([http://docs.ansible.com/ansible/playbooks\_loops.html#looping-over-the-inventory](http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-the-inventory)) as an attribute for a task :

```auto
# show all the hosts in the inventory
- debug: msg={{ item }}
  with_inventory_hostname: all

# show all the hosts matching the pattern, ie all but the group www
- debug: msg={{ item }}
  with_inventory_hostname: all:!www

```

But my playbook raise the following error (with ansible 2.0.0.2, installed via pip) for the same task:

"ERROR! ‘with\_inventory\_hostname’ is not a valid attribute for a Task

I did not find any mention of “with\_inventory\_hostname” in the source code.

Is it an old feature not removed from the docs ? Did I miss something else ?

Thanks in advance,  
Aurel

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 2, 2016, 2:34pm UTC](https://forum.ansible.com/t/with-inventory-hostname-error/20418/2 "2016-02-02T14:34:43Z")

</div>

missing an 's', with\_inventory\_hostnames

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 2, 2016, 2:38pm UTC](https://forum.ansible.com/t/with-inventory-hostname-error/20418/3 "2016-02-02T14:38:55Z")

</div>

made fix to docs, which were wrong.

---

<div class="post-metadata">

**Author:** ![Aurel](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Aurel](https://forum.ansible.com/u/Aurel)\
**Post date:** [February 2, 2016, 2:49pm UTC](https://forum.ansible.com/t/with-inventory-hostname-error/20418/4 "2016-02-02T14:49:25Z")

</div>

Thank you very much for this and for everything !
