# Getting list of all hosts after using '--limit' switch or 'serial' command

**URL:** <https://forum.ansible.com/t/getting-list-of-all-hosts-after-using-limit-switch-or-serial-command/14408>\
**Category:** Ansible Project\
**Created:** [January 23, 2014, 1:12pm UTC](https://forum.ansible.com/t/getting-list-of-all-hosts-after-using-limit-switch-or-serial-command/14408 "2014-01-23T13:12:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martynas\_Mickevicius](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Martynas\_Mickevicius](https://forum.ansible.com/u/Martynas_Mickevicius)\
**Post date:** [January 23, 2014, 1:12pm UTC](https://forum.ansible.com/t/getting-list-of-all-hosts-after-using-limit-switch-or-serial-command/14408/1 "2014-01-23T13:12:22Z")

</div>

Hi,

is there a way to get a list of all the hosts that the playbook is being executed on?

I know there is a way to get all the hosts in a particular group by using ‘groups[‘my\_group’]’ variable. But this list does not change when ‘–limit’ or ‘serial’ is used.

Martynas

---

<div class="post-metadata">

**Author:** ![Martynas\_Mickevicius](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Martynas\_Mickevicius](https://forum.ansible.com/u/Martynas_Mickevicius)\
**Post date:** [January 23, 2014, 3:50pm UTC](https://forum.ansible.com/t/getting-list-of-all-hosts-after-using-limit-switch-or-serial-command/14408/2 "2014-01-23T15:50:04Z")

</div>

Sorry about the double post. I posted the first post and it was not approved after half a day. So I thought I pressed cancel instead of POST and posted the same question again.
