From 28ecc448d83eab9262e5f813a6f64e39270bafa4 Mon Sep 17 00:00:00 2001 From: Ian van der Linde Date: Thu, 25 Apr 2024 09:01:01 +0200 Subject: [PATCH] Add run_once to PgPool test user creation In some cases I have found that the task to create the PgPool test user can run multiple times, with runs subsequent from the first failing with a duplicate key error (the user already exists on the backend after the first run). This patch prevents that from occurring. --- roles/setup_pgpool2/tasks/validate_setup_pgpool2.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/setup_pgpool2/tasks/validate_setup_pgpool2.yml b/roles/setup_pgpool2/tasks/validate_setup_pgpool2.yml index 738d0be2e..b9a1b0b60 100644 --- a/roles/setup_pgpool2/tasks/validate_setup_pgpool2.yml +++ b/roles/setup_pgpool2/tasks/validate_setup_pgpool2.yml @@ -123,6 +123,7 @@ pg_database: "{{ pg_pgpool_database }}" no_log: "{{ disable_logging }}" when: pgpool2_test_user_password|length > 1 + run_once: true - name: Add pgpool2_test_user ansible.builtin.include_role: @@ -181,6 +182,7 @@ state: absent no_log: "{{ disable_logging }}" when: pgpool2_test_user_password|length > 1 + run_once: true - name: Remove pgpool2_test_user from pgpool2 ansible.builtin.include_role: