Files
ansible-collection-docker-c…/tasks/update.yml
T

31 lines
887 B
YAML

---
- name: "{{ app_name }} - Update application"
block:
- name: Stop application for update
community.docker.docker_compose_v2:
project_src: "{{ app_dir }}"
state: stopped
- name: Pull latest container images
community.docker.docker_compose_v2:
project_src: "{{ app_dir }}"
pull: always
- name: Start application with new images
community.docker.docker_compose_v2:
project_src: "{{ app_dir }}"
state: present
recreate: always
register: update_restart
- name: Verify application health after update
ansible.builtin.include_tasks: health_check.yml
when: app_health_check | default(true)
rescue:
- name: Update failed, attempt to restart application
community.docker.docker_compose_v2:
project_src: "{{ app_dir }}"
state: present
tags: [update]