From c86969177b1f19c3839813b3ed3428b0087cfd25 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Mon, 20 Oct 2025 21:53:22 +0200 Subject: [PATCH] fix: Correctly identify the correct db user password --- ansible/roles/pretix/tasks/database.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ansible/roles/pretix/tasks/database.yaml b/ansible/roles/pretix/tasks/database.yaml index 6c105be..25ff371 100644 --- a/ansible/roles/pretix/tasks/database.yaml +++ b/ansible/roles/pretix/tasks/database.yaml @@ -6,15 +6,20 @@ - name: Read in postgres password ansible.builtin.command: cmd: cat ~/.pretix_db_password - register: pretix_db_password + register: pretix_db_password_existing when: pretix_db_password_file.stat.exists changed_when: false - name: Create DB user password ansible.builtin.command: cmd: openssl rand -hex 32 - register: pretix_db_password + register: pretix_db_password_new changed_when: false when: not pretix_db_password_file.stat.exists +- name: Determine DB user password + ansible.builtin.shell: + cmd: echo "{{ pretix_db_password_existing.stdout if pretix_db_password_file.stat.exists else pretix_db_password_new.stdout }}" + register: pretix_db_password + changed_when: false - name: Create DB user community.postgresql.postgresql_user: login_user: "{{ ssh_user }}"