Skip to content

Commit

Permalink
Add run_once to PgPool test user creation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ianvdl committed Apr 25, 2024
1 parent d36c677 commit 28ecc44
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions roles/setup_pgpool2/tasks/validate_setup_pgpool2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 28ecc44

Please sign in to comment.