fix(postgresql): added check to detect possible errors when executing custom init script

This commit is contained in:
NaeiKinDus 2024-07-28 00:00:00 +00:00
parent 7d6155f97e
commit f9aa2cfed5
Signed by: WoodSmellParticle
GPG key ID: 8E52ADFF7CA8AE56

View file

@ -125,6 +125,8 @@
changed_when: false
- name: run initialization file
ansible.builtin.shell: "su {{ postgresql_default_user }} -c 'psql < {{ tmp_file.path }}'"
register: run_custom_sql_exec
failed_when: run_custom_sql_exec.rc != 0 or "ERROR" in run_custom_sql_exec.get("stderr", "")
- name: cleanup
ansible.builtin.file:
path: '{{ tmp_file.path }}'