Network Automation     Archive

Cleaning up pending Tower Jobs

This post is a quick troubleshooting gist based on a recent problem I encountered. I had an external system make API calls to Ansible Tower and trigger a job template. Pretty standard stuff…however, the configuration on the remote system was, ummm, not very accurate and I ended up with a ton of API calls to my Tower machine.

This caused the jobs to go into a pending status and I could no longer trigger any of my normal jobs. I found the following snippet of Python code from https://github.com/ansible/awx/issues/1034 that does the trick!

from awx.main.models import UnifiedJob
for i in UnifiedJob.objects.filter():
   if(i.status == 'pending'):
     i.delete()

STEPS:

Hope this helps you too!

Tweet