diff --git a/collections/ansible_collections/nullified/infrastructure/roles/postgresql/tasks/server.yml b/collections/ansible_collections/nullified/infrastructure/roles/postgresql/tasks/server.yml index c55a7ab..8cfdfe3 100644 --- a/collections/ansible_collections/nullified/infrastructure/roles/postgresql/tasks/server.yml +++ b/collections/ansible_collections/nullified/infrastructure/roles/postgresql/tasks/server.yml @@ -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 }}'