DebugFactor.com | Forum

How to find and remove the unused hosts in Ansible Tower

Due to License restrictions on maximum host count, I need to remove some hosts that are not used for long time.
Can someone let me know how to perform this in Ansible Tower?

You can use the Ansible Tower API as below

https://<ansible_tower_url>/api/v2/hosts/
https://<ansible_tower_url>/api/v2/hosts/?last_job=null

This will show the hosts which has no jobs run against them.
Make sure to note that if the job cleanup or archive is done, those jobs will not be shown.

Once you get the hosts, you need to manually remove them from the inventory.

Hope this help. Thanks!