forked from jakub/ansible
36 lines
916 B
YAML
36 lines
916 B
YAML
---
|
|
- name: Upload and run stack health checks
|
|
hosts: proxmox
|
|
gather_facts: false
|
|
become: false
|
|
|
|
vars:
|
|
health_script_path: /data/compose/nextcloud/stack-health.sh
|
|
|
|
tasks:
|
|
- name: Ensure script exists (upload if missing)
|
|
ansible.builtin.stat:
|
|
path: "{{ health_script_path }}"
|
|
register: hs
|
|
|
|
- name: Upload stack-health.sh
|
|
ansible.builtin.copy:
|
|
src: files/stack-health.sh
|
|
dest: "{{ health_script_path }}"
|
|
mode: '0755'
|
|
when: not hs.stat.exists
|
|
|
|
- name: Run stack-health.sh
|
|
ansible.builtin.shell: "{{ health_script_path }}"
|
|
register: health
|
|
args:
|
|
executable: /bin/bash
|
|
|
|
- name: Show health output
|
|
ansible.builtin.debug:
|
|
msg: "{{ health.stdout | default('no stdout') }}"
|
|
|
|
- name: Fail if checks failed
|
|
ansible.builtin.fail:
|
|
msg: "Health checks failed"
|
|
when: health.rc != 0 |