Documentation

6. Management Jobs

Management Jobs assist in the cleaning of old data from Tower, including system tracking information, tokens, job histories, and activity streams. You can use this if you have specific retention policies or need to decrease the storage used by your Tower database. Click the Management Jobs ( mgmt-jobs ) icon from the left navigation bar.

management jobs

Several job types are available for you to schedule and launch:

  • Cleanup Activity Stream: Remove activity stream history older than a specified number of days

  • Cleanup Expired OAuth 2 Tokens: Remove expired OAuth 2 access tokens and refresh tokens

  • Cleanup Expired Sessions: Remove expired browser sessions from the database

  • Cleanup Job Details: Remove job history older than a specified number of days

6.1. Removing Old Activity Stream Data

To remove older activity stream data, click on the launch (launch) button beside Cleanup Activity Stream.

activity stream launch - remove activity stream launch

Enter the number of days of data you would like to save and click Launch.

6.1.1. Scheduling

To review or set a schedule for purging data marked for deletion, click on the schedule button.

activity stream launch - remove activity stream schedule

Note that you can turn this scheduled management job on and off easily using the ON/OFF toggle button to the left of the Job Name.

Click on the Job Name, in this example “Cleanup Activity Schedule”, to review or edit the schedule settings. You can also use the add button to create a new schedule for this management job.

_images/ug-management-jobs-remove-activity-stream-schedule-details.png

Enter the appropriate details into the following fields and click Save:

  • Name (required)

  • Start Date (required)

  • Start Time (required)

  • Local Time Zone (the entered Start Time should be in this timezone)

  • Repeat Frequency (the appropriate options display as the update frequency is modified.)

The Details tab displays a description of the schedule and a list of the scheduled occurrences in the selected Local Time Zone.

Note

Jobs are scheduled in UTC. Repeating jobs that runs at a specific time of day may move relative to a local timezone when Daylight Saving Time shifts occur.

6.1.2. Notifications

To set or review notifications associated with this management job, click the Notifications ( notify ) icon.

_images/management-job-add-notification.png

If none exist, click the Notifications link to create a new notification. Notification types include:

  • Email

  • Grafana

  • IRC

  • Mattermost

  • PagerDuty

  • Rocket.Chat

  • Slack

  • Twilio

  • Webhook

_images/management-job-add-notification-details.png

Refer to Notifications in the Ansible Tower User Guide for more information.

6.2. Cleanup Expired OAuth2 Tokens

To remove expired OAuth2 tokens, click on the launch (launch) button beside Cleanup Expired OAuth2 Tokens.

You can review or set a schedule for cleaning up expired OAuth2 tokens by performing the same procedure described for activity stream management jobs. See Scheduling for detail.

You can also set or review notifications associated with this management job the same way as described in Notifications for activity stream management jobs, and refer to Notifications in the Ansible Tower User Guide for more detail.

6.3. Cleanup Expired Sessions

To remove expired sessions, click on the launch (launch) button beside Cleanup Expired Sessions.

You can review or set a schedule for cleaning up expired sessions by performing the same procedure described for activity stream management jobs. See Scheduling for detail.

You can also set or review notifications associated with this management job the same way as described in Notifications for activity stream management jobs, and refer to Notifications in the Ansible Tower User Guide for more detail.

6.4. Removing Old Job History

To remove job history older than a specified number of days, click on the launch (launch) button beside Cleanup Job Details.

management jobs - cleanup job launch

Enter the number of days of data you would like to save and click Launch.

Note

The initial job run for a Tower resource (e.g. Projects, Job Templates) is excluded from Cleanup Job Details, regardless of retention value.

You can review or set a schedule for cleaning up old job history by performing the same procedure described for activity stream management jobs. See Scheduling for detail.

You can also set or review notifications associated with this management job the same way as described in Notifications for activity stream management jobs, and refer to Notifications in the Ansible Tower User Guide for more detail.