24 lines
860 B
YAML
24 lines
860 B
YAML
---
|
|
- name: Deploy PostgreSQL stack
|
|
community.docker.docker_compose_v2:
|
|
project_src: "{{ postgresql_stack_path }}"
|
|
state: present
|
|
pull: always
|
|
register: postgresql_compose_result
|
|
|
|
- name: Check PostgreSQL container status
|
|
shell: |
|
|
docker compose -f {{ postgresql_stack_path }}/docker-compose.yml ps postgres | grep -Eiq "Up|running"
|
|
register: postgresql_state
|
|
changed_when: false
|
|
until: postgresql_state.rc == 0
|
|
retries: "{{ ((postgresql_wait_timeout | int) + (postgresql_wait_interval | int) - 1) // (postgresql_wait_interval | int) }}"
|
|
delay: "{{ postgresql_wait_interval | int }}"
|
|
failed_when: postgresql_state.rc != 0
|
|
when: not ansible_check_mode
|
|
|
|
- name: Record PostgreSQL deployment facts
|
|
set_fact:
|
|
postgresql_stack_changed: "{{ postgresql_compose_result.changed | default(false) }}"
|
|
postgresql_log_hint: ""
|