# A way to get list of hosts after limiting with '--limit' or 'serial'

**URL:** <https://forum.ansible.com/t/a-way-to-get-list-of-hosts-after-limiting-with-limit-or-serial/14402>\
**Category:** Ansible Project\
**Created:** [January 23, 2014, 8:26am UTC](https://forum.ansible.com/t/a-way-to-get-list-of-hosts-after-limiting-with-limit-or-serial/14402 "2014-01-23T08:26:03Z")\
**Posts on this page:** 1\
**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, 8:26am UTC](https://forum.ansible.com/t/a-way-to-get-list-of-hosts-after-limiting-with-limit-or-serial/14402/1 "2014-01-23T08:26:03Z")

</div>

Hi,

I am looking for a way to get a list of hosts on which the playbook is being executed after limiting original inventory with ‘–limit’ flag or ‘serial’ command in the playbook.

I have found that it is possible to get all the hosts in a particular group by accessing ‘groups[‘my\_group’]’ variable. But the contents of this dictionary does not change when using ‘–limit’ or ‘serial’.

Is there a way to achieve this with the current code? If not I will start looking into implementing it and posting a pull request.

Martynas
