--- - block: - name: "✅ Ensure initdb.d dir exists: {{ _database_initdb_dir }}" ansible.builtin.file: path: "{{ _database_initdb_dir }}" state: directory mode: "0755" - name: "📄 For '{{ application_id }}/{{ _database_consumer_id }}': Render extensions.sql" stack_host_template: src: "initdb.d/extensions.sql.j2" dest: "{{ _database_initdb_dir }}extensions.sql" mode: "0644" notify: compose-up when: (_database_extensions | length) > 0 - block: - name: "✅ Ensure postgres build dir exists: {{ _database_build_dir }}" ansible.builtin.file: path: "{{ _database_build_dir }}" state: directory mode: "0755" - name: "📄 For '{{ application_id }}/{{ _database_consumer_id }}': Render libs Dockerfile" stack_host_template: src: "{{ lookup('path_absolute', 'roles/svc-db-postgres/templates/Dockerfile.j2') }}" dest: "{{ _database_build_dir }}Dockerfile" mode: "0644" vars: POSTGRES_IMAGE: "{{ lookup('database', _database_consumer_id, 'image') }}" POSTGRES_VERSION: "{{ lookup('database', _database_consumer_id, 'version') }}" POSTGRES_VERSION_MAJOR: "{{ lookup('database', _database_consumer_id, 'version') | regex_replace('^([0-9]+).*', '\\1') }}" POSTGRES_LIBRARIES: "{{ _database_libraries }}" notify: - compose-build - compose-up when: (_database_libraries | length) > 0