From ab1e956db85951b73f52220de2c308fabc0f1896 Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Tue, 23 Apr 2024 08:53:41 -0400 Subject: [PATCH 1/3] Add playbook to cleanup pg_repack on pgbouncer_a6 --- .../ansible/cleanup_pg_repack.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/commcare_cloud/ansible/cleanup_pg_repack.yml diff --git a/src/commcare_cloud/ansible/cleanup_pg_repack.yml b/src/commcare_cloud/ansible/cleanup_pg_repack.yml new file mode 100644 index 0000000000..4f07114ece --- /dev/null +++ b/src/commcare_cloud/ansible/cleanup_pg_repack.yml @@ -0,0 +1,30 @@ +- name: Cleanup pg_repack configuration + hosts: pgbouncer_a6 + tasks: + - include_vars: + file: roles/postgresql_base/defaults/main.yml + + - name: Check if pg_repack is installed + stat: + path: "{{ postgres_install_dir }}/bin/pg_repack" + register: pg_repack_stat + + - name: Display if pg_repack is installed + debug: + msg: "pg_repack is installed" + when: pg_repack_stat.stat.exists == True + + - name: Check if pg_repack cron exists + stat: + path: "/etc/cron.d/pg_repack_commcarehq_synclogs" + register: pg_repack_cron + + - name: Display if pg_repack cron exists + debug: + msg: "pg_repack cron is configured" + when: pg_repack_cron.stat.exists == True + + - name: Remove pg_repack cron file + file: + path: "/etc/cron.d/pg_repack_commcarehq_synclogs" + state: absent From 9202b99dd0704a509d642bdb1c0b56dbdcbf05c5 Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Mon, 27 May 2024 15:06:03 -0400 Subject: [PATCH 2/3] Remove debug tasks --- src/commcare_cloud/ansible/cleanup_pg_repack.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/commcare_cloud/ansible/cleanup_pg_repack.yml b/src/commcare_cloud/ansible/cleanup_pg_repack.yml index 4f07114ece..a9577783c9 100644 --- a/src/commcare_cloud/ansible/cleanup_pg_repack.yml +++ b/src/commcare_cloud/ansible/cleanup_pg_repack.yml @@ -9,21 +9,11 @@ path: "{{ postgres_install_dir }}/bin/pg_repack" register: pg_repack_stat - - name: Display if pg_repack is installed - debug: - msg: "pg_repack is installed" - when: pg_repack_stat.stat.exists == True - - name: Check if pg_repack cron exists stat: path: "/etc/cron.d/pg_repack_commcarehq_synclogs" register: pg_repack_cron - - name: Display if pg_repack cron exists - debug: - msg: "pg_repack cron is configured" - when: pg_repack_cron.stat.exists == True - - name: Remove pg_repack cron file file: path: "/etc/cron.d/pg_repack_commcarehq_synclogs" From 468ceae2bbda44e34b2b4669d90364cfc7af1419 Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Tue, 28 May 2024 09:37:05 -0400 Subject: [PATCH 3/3] Add conditional check for removing cron --- src/commcare_cloud/ansible/cleanup_pg_repack.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commcare_cloud/ansible/cleanup_pg_repack.yml b/src/commcare_cloud/ansible/cleanup_pg_repack.yml index a9577783c9..2bd14bd777 100644 --- a/src/commcare_cloud/ansible/cleanup_pg_repack.yml +++ b/src/commcare_cloud/ansible/cleanup_pg_repack.yml @@ -18,3 +18,4 @@ file: path: "/etc/cron.d/pg_repack_commcarehq_synclogs" state: absent + when: pg_repack_cron.stat.exists == True