Delete Executions in Rundeck – Wrapping it all Up

Posted by in IT, Software, Tutorial

The previous posts have built the components to allow us to get projects, jobs, executions and remove executions from a Rundeck instance via its API.

Now, we can just wrap them up :)

The list of packages we need is:

For convenience, I’ve declared a bunch of constants we can use throughout the project:

As we already have all the helper functions defined, we only need to wrap them in a convenient execution command:

The logis is fairly simple:

  1. Get the list of projects
  2. For each project, get its list of jobs
  3. For each job, get its list of executions
  4. Build a list of executions older than EXPIRE_DAYS
  5. Remove the old executions, 30 at a time.

It then gets simply wrapped:

Now, you can call the script:

HTH,


A little experiment: If you find this post and ad below useful, please check the ad out :-)