From d59c9ce1eaade4005cc10cc39987fb614420ee29 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Dec 2023 01:45:48 -0500 Subject: [PATCH] Add safety to removal of legacy configs This conditional will ensure that, the first time pvc.conf is installed (or, subsequent times, until it stabilizes), the legacy configs will not be removed. Then, on the next run in which pvc.conf does not change, they will be removed. This should provide a safety valve during a 0.9.83 update with the update-pvc-daemons playbook: if the update succeeds, on the next run, the legacy configs will be purged; otherwise, they will still be present and can be used for fallback just in case. This probably isn't needed, but just in case I'd rather be safe. --- roles/pvc/tasks/pvc/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/pvc/tasks/pvc/main.yml b/roles/pvc/tasks/pvc/main.yml index e64da53..27b7b13 100644 --- a/roles/pvc/tasks/pvc/main.yml +++ b/roles/pvc/tasks/pvc/main.yml @@ -34,6 +34,7 @@ mode: 0640 with_items: - pvc.conf + register: new_daemon_config - name: remove obsolete pvc daemon configurations file: @@ -43,6 +44,12 @@ - pvcnoded.yaml - pvcapid.yaml - autobackup.yaml + # Only apply this task when the new daemon config has NOT changed. + # In practice, this means that the first time pvc.conf is written, + # the old configs will NOT be purged. Then, the next time this is + # run (presuming no fundamental changes happen to that config), + # they will be removed. Provides safety in case of a failed update. + when: not new_daemon_config.changed - name: install API SSL certificate file copy: