# How to get the --limit command line option

**URL:** <https://forum.ansible.com/t/how-to-get-the-limit-command-line-option/23909>\
**Category:** Ansible Project\
**Created:** [March 8, 2017, 11:30am UTC](https://forum.ansible.com/t/how-to-get-the-limit-command-line-option/23909 "2017-03-08T11:30:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Buttu](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@Marco\_Buttu](https://forum.ansible.com/u/Marco_Buttu)\
**Post date:** [March 8, 2017, 11:30am UTC](https://forum.ansible.com/t/how-to-get-the-limit-command-line-option/23909/1 "2017-03-08T11:30:34Z")

</div>

Hi all, I would like to read the --limit command line option. For instance, let’s have the following:

$ ansible-playbook site.yml --limit foo

I would like the tasks to read {{ limit }}. Is it possibile or do I have to duplicate thinks like in the following?

$ ansible-playbook site.yml --limit foo --extra-vars “limit=foo”

Thanks, Marco

---

<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:** [March 12, 2017, 11:22pm UTC](https://forum.ansible.com/t/how-to-get-the-limit-command-line-option/23909/2 "2017-03-12T23:22:35Z")

</div>

That is info is not available direclty in play, but you could check  
ansible\_play\_hosts vs the hosts pattern to see what the difference is.

If you supply multiple options for --limit, only the last one is heeded.
