ServiceNowITOM / ansible-sn-inventory

Ansible Dynamic Inventory for ServiceNow
Apache License 2.0
79 stars 45 forks source link

Deleting hosts in Ansible tower dynamically. #13

Open arun31101992 opened 6 years ago

arun31101992 commented 6 years ago

I am working on deleting the hosts which are generated dynamically by integrating Ansible with ServiceNow CMDB.

For this I am creating workflow in ansible tower with 2 jobs. The first one will be python script(inventory sync) which will generate hosts and the second one is a playbook which has to delete hosts using ansible API's.

I am able to delete the hosts by providing id of the inventory source manually in playbook. Link which I am providing in playbook is: 'htps:///api/v2/inventory_sources/{id}/groups/'.

But I want to get the id of the inventory source from the 1st job when the workflow runs and it must be passed dynamically to 2nd job. please share your ideas how to do this?