From f18018b6e50f29e1232b5e3f021704b1005f7edc Mon Sep 17 00:00:00 2001 From: Mark van Driel Date: Thu, 11 Feb 2021 15:01:45 +0100 Subject: [PATCH] Remove old pem and ocsp files --- templates/usr/local/bin/haproxy-letsencrypt-ocsp-deploy.j2 | 2 ++ templates/usr/local/bin/haproxy-letsencrypt-ssl-deploy.j2 | 2 ++ 2 files changed, 4 insertions(+) diff --git a/templates/usr/local/bin/haproxy-letsencrypt-ocsp-deploy.j2 b/templates/usr/local/bin/haproxy-letsencrypt-ocsp-deploy.j2 index 52c6571e..85637455 100644 --- a/templates/usr/local/bin/haproxy-letsencrypt-ocsp-deploy.j2 +++ b/templates/usr/local/bin/haproxy-letsencrypt-ocsp-deploy.j2 @@ -31,6 +31,8 @@ for path in $(ls -1d {{ haproxy_letsencrypt_ssl_src_path }}/*/); do rm -f "{{ haproxy_global_crt_base }}/${removePrefix}-${cert}.pem.ocsp"; done +find "{{ haproxy_global_crt_base }}" -mindepth 1 -name "*.ocsp" -mtime +0 -delete; + {% if ansible_service_mgr == 'systemd' %} systemctl reload haproxy; {% else %} diff --git a/templates/usr/local/bin/haproxy-letsencrypt-ssl-deploy.j2 b/templates/usr/local/bin/haproxy-letsencrypt-ssl-deploy.j2 index f9e2dbc9..e388df76 100644 --- a/templates/usr/local/bin/haproxy-letsencrypt-ssl-deploy.j2 +++ b/templates/usr/local/bin/haproxy-letsencrypt-ssl-deploy.j2 @@ -25,4 +25,6 @@ for path in $(ls -1d {{ haproxy_letsencrypt_ssl_src_path }}/*/); do rm -f "{{ haproxy_global_crt_base }}/${removePrefix}-${cert}.pem"; done +find "{{ haproxy_global_crt_base }}" -mindepth 1 -name "*.pem" -mtime +0 -delete; + {{ haproxy_letsencrypt_ocsp_deploy }};