fix: Correctly identify the correct db user password

This commit is contained in:
2025-10-20 21:53:22 +02:00
parent f4530da75d
commit c86969177b
+7 -2
View File
@@ -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 }}"