How to read the --limit command line option

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

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.