Merge "ara_api: Add conjobs"

This commit is contained in:
Zuul 2021-02-24 18:51:06 +00:00 committed by Gerrit Code Review
commit dc0596ca3f
2 changed files with 28 additions and 0 deletions

View File

@ -204,3 +204,16 @@ ara_api_database_conn_max_age: 0
# timezone but Ansible doesn't provide, for example, an ansible_timezone fact
# that we could use here. With that in mind, UTC is the best default for now.
ara_api_time_zone: UTC
# ARA cleanup settings
# The following settings configure daily maintenance cronjobs
ara_api_configure_cron: false
# When configuring cronjobs, only provide the arguments for the ara CLI utility
ara_api_cleanup_crons:
- name: ara_api expire running playbooks
arguments: 'expire --server http://localhost:8000 --client http --confirm --hours 24'
special_time: 'daily' # you can also use other time arguments from the cron module
- name: ara_api prune old reports
arguments: 'playbook prune --server http://localhost:8000 --client http --confirm --days 30'
special_time: 'daily'

View File

@ -110,3 +110,18 @@
notify:
- restart ara-api
no_log: "{{ ara_api_secure_logging }}"
- name: Set up ARA API cronjobs
cron:
name: "{{ job['name'] }}"
special_time: "{{ job['special_time'] | default(omit) }}"
minute: "{{ job['minute'] | default(omit) }}"
hour: "{{ job['hour'] | default(omit) }}"
day: "{{ job['day'] | default(omit) }}"
weekday: "{{ job['weekday'] | default(omit) }}"
month: "{{ job['month'] | default(omit) }}"
job: "{{ ara_api_venv_path }}/bin/ara {{ job['arguments'] }} >/dev/null 2>&1"
loop: "{{ ara_api_cleanup_crons }}"
loop_control:
loop_var: 'job'
when: ara_api_configure_cron