# ansible shortcut for listing hosts from inventory

**URL:** <https://forum.ansible.com/t/ansible-shortcut-for-listing-hosts-from-inventory/12127>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [December 7, 2012, 4:09pm UTC](https://forum.ansible.com/t/ansible-shortcut-for-listing-hosts-from-inventory/12127 "2012-12-07T16:09:47Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [December 7, 2012, 4:09pm UTC](https://forum.ansible.com/t/ansible-shortcut-for-listing-hosts-from-inventory/12127/1 "2012-12-07T16:09:47Z")

</div>

Ansible-playbook already has a list-hosts, so if it works the same way, yes.

--Michael

---

<div class="post-metadata">

**Author:** ![Christopher\_Snapp](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@Christopher\_Snapp](https://forum.ansible.com/u/Christopher_Snapp)\
**Post date:** [December 7, 2012, 8:01pm UTC](https://forum.ansible.com/t/ansible-shortcut-for-listing-hosts-from-inventory/12127/2 "2012-12-07T20:01:57Z")

</div>

The only difference is that --list-hosts builds the list based on the playbooks provided whereas what I’m looking for is to be able to pass only the hosts/groups/patterns in and get the expanded list of hosts out. If that is acceptable, I’ll take a look at trying to implement it. I’ll be honest though, my python skills don’t exactly exist so I’m hoping it’ll be relatively straight-forward to simply boost the primary expansion logic out of --list-hosts.

---

<div class="post-metadata">

**Author:** ![Christopher\_Snapp](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@Christopher\_Snapp](https://forum.ansible.com/u/Christopher_Snapp)\
**Post date:** [December 7, 2012, 9:25pm UTC](https://forum.ansible.com/t/ansible-shortcut-for-listing-hosts-from-inventory/12127/3 "2012-12-07T21:25:31Z")

</div>

submitted pull request #1741
