LIMIT as extra_vars

620 views
Skip to first unread message

speci...@gmail.com

unread,
Sep 3, 2020, 7:54:41 PM9/3/20
to AWX Project
In AWX, you can pop-up 'LIMIT' option to limit the host list for playbook run.

Is it possible to take the value of LIMIT like --extra-vars

I have a python script to take the value from --extra-vars on playbook running and want to use the value of 'LIMIT' as well.

Thanks,
Jerry

Sergio

unread,
Sep 4, 2020, 4:03:16 AM9/4/20
to AWX Project
Hi,

I think what you want is to use the ansible_limit variable.

Cheers!

Rod Oliver

unread,
Sep 4, 2020, 4:13:05 AM9/4/20
to speci...@gmail.com, AWX Project
Hi Jerry,

We do precisely this by setting an arbitrary variable with the ‘—limit’ value and using that variable in the ‘hosts’ field. It works just fine. 

Rod

--


You received this message because you are subscribed to the Google Groups "AWX Project" group.


To unsubscribe from this group and stop receiving emails from it, send an email to awx-project...@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/6842913a-d6ef-4582-a42d-d4217b14dcccn%40googlegroups.com.


Jerry Hwang

unread,
Sep 4, 2020, 9:22:46 AM9/4/20
to Rod Oliver, AWX Project
Hi Rod,

The python script I mentioned is ansible callback plugin
https://docs.ansible.com/ansible/latest/plugins/callback.html

When I use --extra-vars "host_limit=linux1"
the callback plugin takes the value like this

vm = play.get_variable_manager()
self.hosts = vm.extra_vars["host_limit"]

In AWX, we would like to use the 'LIMIT' option instead of --extra-vars.

Do you know how the callback plugin can take the value of 'LIMIT'?

Thanks,
Jerry
Reply all
Reply to author
Forward
0 new messages