Initial commit
This commit is contained in:
31
tasks/update.yaml
Normal file
31
tasks/update.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
- 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.yaml
|
||||
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]
|
||||
Reference in New Issue
Block a user