diff --git a/awx/api/templates/api/system_job_template_launch.md b/awx/api/templates/api/system_job_template_launch.md index a50e3fdae3..3a5d2d3b7a 100644 --- a/awx/api/templates/api/system_job_template_launch.md +++ b/awx/api/templates/api/system_job_template_launch.md @@ -8,16 +8,20 @@ on the host system via the `tower-manage` command. For example on `cleanup_jobs` and `cleanup_activitystream`: -`{"days": 30}` +`{"extra_vars": {"days": 30}}` Which will act on data older than 30 days. For `cleanup_facts`: -`{"older_than": "4w", "granularity": "3d"}` +`{"extra_vars": {"older_than": "4w", "granularity": "3d"}}` Which will reduce the granularity of scan data to one scan per 3 days when the data is older than 4w. +For `cleanup_activitystream` and `cleanup_jobs` commands, providing +`"dry_run": true` inside of `extra_vars` will show items that will be +removed without deleting them. + Each individual system job task has its own default values, which are applicable either when running it from the command line or launching its system job template with empty `extra_vars`. diff --git a/awx/main/tasks.py b/awx/main/tasks.py index e9205f4187..194cc3c837 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -1914,6 +1914,8 @@ class RunSystemJob(BaseTask): json_vars = json.loads(system_job.extra_vars) if 'days' in json_vars and system_job.job_type != 'cleanup_facts': args.extend(['--days', str(json_vars.get('days', 60))]) + if 'dry_run' in json_vars and json_vars['dry_run'] and system_job.job_type != 'cleanup_facts': + args.extend(['--dry-run']) if system_job.job_type == 'cleanup_jobs': args.extend(['--jobs', '--project-updates', '--inventory-updates', '--management-jobs', '--ad-hoc-commands', '--workflow-jobs',