# How to read the --limit command line option

**URL:** <https://forum.ansible.com/t/how-to-read-the-limit-command-line-option/23916>\
**Category:** Ansible Project\
**Created:** [March 8, 2017, 5:26pm UTC](https://forum.ansible.com/t/how-to-read-the-limit-command-line-option/23916 "2017-03-08T17:26:32Z")\
**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, 5:26pm UTC](https://forum.ansible.com/t/how-to-read-the-limit-command-line-option/23916/1 "2017-03-08T17:26:32Z")

</div>

Hi all, I would like to get the value of --limit. For instance, let’s have this command:

$ ansible-playbook site.yml --limit foo

I would like to read {{ limit }} from a task. Is there a solution or do I have to do something like the following?

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

Thanks, Marco

---

<div class="post-metadata">

**Author:** ![dan3](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@dan3](https://forum.ansible.com/u/dan3)\
**Post date:** [March 9, 2017, 11:56am UTC](https://forum.ansible.com/t/how-to-read-the-limit-command-line-option/23916/2 "2017-03-09T11:56:41Z")

</div>

Hi Marco,

Not sure you can get the raw limit string, but there is this:

`  
{{ ansible\_play\_hosts }}

`

If you are after list of target hosts for your play, after your limit has been resolved.

Thanks - Dan.
