I am trying to generate inventory data based on instance_id that will be given as a input as EXTRA_VARS
ansible-inventory -i inventory/my_inventory.py --list -e "instance_id=198"
url = https://api.myapp.com/id=<instance_id>
sample url: https://api.myapp.com/id=198
above URL shall give the list of hosts, using Dynamic inventory script
1a. get the instance_id from the EXTRA_VARS, in this case its instance_id and its value is 198
1b. query the url mentioned above
1c. Get the list of hosts
1d. build the inventory data in JSON
I am stuck at point (1a) above on how to get the instance_id into my Dynamic inventory script
how can I achieve this through dynamic inventory script? or please let me know any other way to achieve this