refactor: switch deployment from command to community.docker.docker_compose_v2

This commit is contained in:
Iurii Tatishchev 2024-06-28 22:55:05 -07:00
parent e1f3a22a23
commit f9d590170d
Signed by: CaZzzer
GPG Key ID: E0EBF441EA424369

View File

@ -23,13 +23,12 @@
when: item.state == "file"
- name: Deploy docker-compose for {{ current_stack_name }}
command: docker compose -f "{{ current_stack_dest }}/docker-compose.yml" up -d --pull always --remove-orphans
community.docker.docker_compose_v2:
project_src: "{{ current_stack_dest }}"
state: present
pull: always
remove_orphans: yes
register: docker_compose_output
# Not perfect idempotency, but the built-in docker_compose module doesn't support docker-compose v2
# And of course there's an IPv6 bug in docker-compose v1, smh
# https://github.com/docker/compose/issues/7670
changed_when: "'created' in docker_compose_output.stderr.lower()"
failed_when: docker_compose_output.rc != 0
- debug:
var: docker_compose_output