27 lines
787 B
YAML
27 lines
787 B
YAML
---
|
|
- name: Restart utils stack on Docker hosts
|
|
hosts: docker_hosts
|
|
become: yes
|
|
gather_facts: no
|
|
|
|
tasks:
|
|
- name: Set utils path
|
|
set_fact:
|
|
utils_path: "{{ docker_appdata | default('/home/docker/appdata') }}/utils"
|
|
|
|
- name: Check if utils compose file exists
|
|
stat:
|
|
path: "{{ utils_path }}/docker-compose.yml"
|
|
register: compose_file
|
|
|
|
- name: Restart utils stack
|
|
shell: docker compose pull && docker compose up -d --force-recreate
|
|
args:
|
|
chdir: "{{ utils_path }}"
|
|
when: compose_file.stat.exists
|
|
register: restart_result
|
|
|
|
- name: Skip if no utils stack
|
|
debug:
|
|
msg: "{{ inventory_hostname }}: No utils stack found at {{ utils_path }}"
|
|
when: not compose_file.stat.exists
|