From 82d2f1398132d1184ed6561b5c3b3ce2ab75bd5d Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Dec 2023 02:14:07 -0500 Subject: [PATCH] Add legacy config cleanup to playbook --- oneshot/update-pvc-daemons.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/oneshot/update-pvc-daemons.yml b/oneshot/update-pvc-daemons.yml index e175acb..ebeb96b 100644 --- a/oneshot/update-pvc-daemons.yml +++ b/oneshot/update-pvc-daemons.yml @@ -125,3 +125,29 @@ - name: unset PVC maintenance mode command: pvc cluster maintenance off run_once: yes + +# Clean up legacy configs if safe to do so +- hosts: all + remote_user: deploy + become: yes + become_user: root + gather_facts: yes + tasks: + - name: check if new configuration exists + stat: + path: /etc/pvc/pvc.conf + register: pvc_config_check + + - name: check if installed PVC version is above 0.9.82 + shell: "dpkg --compare-versions $(dpkg-query --showformat='${Version}' --show pvc-daemon-node) gt 0.9.82" + register: pvc_version_check + + - name: remove obsolete PVC daemon configurations + file: + dest: "/etc/pvc/{{ item }}" + state: absent + with_items: + - pvcnoded.yaml + - pvcapid.yaml + - autobackup.yaml + when: pvc_config_file_check.stat.exists and pvc_version_check.rc == 0