From 21728ab60ff949d7312e2bf0cf4a4b099aac9804 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 29 Jan 2025 17:01:54 +0100 Subject: [PATCH] Added cleanup mode for certs and solved peertube variable bug --- group_vars/all/{01_mode.yml => 01_modes.yml} | 3 ++- tasks/recieve-certbot-certificate.yml | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) rename group_vars/all/{01_mode.yml => 01_modes.yml} (88%) diff --git a/group_vars/all/01_mode.yml b/group_vars/all/01_modes.yml similarity index 88% rename from group_vars/all/01_mode.yml rename to group_vars/all/01_modes.yml index f72347c8..aedbf74e 100644 --- a/group_vars/all/01_mode.yml +++ b/group_vars/all/01_modes.yml @@ -6,4 +6,5 @@ mode_debug: false # Prints well formated debug information mode_test: false # Executes test routines instead of productive routines mode_update: true # Executes updates mode_backup: true # Activates the backup before the update procedure -mode_setup: false # Execute the setup and initializing procedures \ No newline at end of file +mode_setup: false # Execute the setup and initializing procedures +mode_cleanup: false # Cleanup unused files and configurations \ No newline at end of file diff --git a/tasks/recieve-certbot-certificate.yml b/tasks/recieve-certbot-certificate.yml index 71894346..83740e82 100644 --- a/tasks/recieve-certbot-certificate.yml +++ b/tasks/recieve-certbot-certificate.yml @@ -12,6 +12,12 @@ {{ '--test-cert' if mode_test | bool else '' }} when: enable_one_letsencrypt_cert_for_all and run_once_recieve_certificate is not defined +- name: "cleanup dedicated cert for {{ domain }}" + command: >- + certbot delete --cert-name {{ domain }} --non-interactive + when: mode_cleanup and enable_one_letsencrypt_cert_for_all and run_once_recieve_certificate is not defined + + - name: run the recieve_certificate tasks once set_fact: run_once_recieve_certificate: true