How to read the --limit command line option

33 views
Skip to first unread message

Marco Buttu

unread,
Mar 9, 2017, 3:01:10 AM3/9/17
to Ansible Project
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

d...@heathtechnical.com

unread,
Mar 10, 2017, 8:38:49 AM3/10/17
to Ansible Project
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.
Reply all
Reply to author
Forward
0 new messages