From 5a6add8c8836eff51264db4b3c31081839b95fa4 Mon Sep 17 00:00:00 2001 From: Christian Zunker Date: Mon, 24 Dec 2018 09:37:41 +0100 Subject: [PATCH] Add panko-expirer cron job Automatically delete events when TTL for events is greater than zero. Change-Id: Ifecec755edc4d9b1eb202abceb7fecd5aaf87fe7 --- defaults/main.yml | 7 +++++++ tasks/panko_post_install.yml | 10 ++++++++++ templates/panko.conf.j2 | 1 + 3 files changed, 18 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index a18fe6b..d853af0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -108,6 +108,13 @@ panko_service_adminurl: "{{ panko_service_adminuri }}" panko_service_in_ldap: false +# Panko expirer +# TTL in seconds +panko_event_time_to_live: -1 +# Any of the following special times are valid: +# reboot, yearly, annually, monthly, weekly, daily, hourly +panko_expirer_job_time: daily + # Common pip packages panko_pip_packages: - alembic>=0.7.2 diff --git a/tasks/panko_post_install.yml b/tasks/panko_post_install.yml index 58450d2..949237f 100644 --- a/tasks/panko_post_install.yml +++ b/tasks/panko_post_install.yml @@ -47,3 +47,13 @@ mode: "0755" notify: - Restart web server + +- name: Create cron job for panko event expirer + cron: + name: "Purge old panko events" + user: "{{ panko_system_user_name }}" + specialtime: "{{ panko_expirer_job_time }}" + job: "{{ panko_bin }}/panko-expirer" + when: + - inventory_hostname == groups['panko_all'][0] + - panko_event_time_to_live > 0 \ No newline at end of file diff --git a/templates/panko.conf.j2 b/templates/panko.conf.j2 index 447e673..43b416b 100644 --- a/templates/panko.conf.j2 +++ b/templates/panko.conf.j2 @@ -7,6 +7,7 @@ debug = {{ debug }} [database] connection = {{ panko_connection_string }} +event_time_to_live = {{ panko_event_time_to_live }} [keystone_authtoken] auth_type = {{ panko_keystone_auth_plugin }}