3
0
forked from jakub/ansible

Refactor health check playbook to ensure script existence before upload and restore requirements.yml for Nextcloud collections

This commit is contained in:
fencl
2025-10-03 14:12:14 +02:00
parent 20d2aacd47
commit b4758ee0e1
2 changed files with 2 additions and 9 deletions

View File

@@ -1,24 +1,17 @@
---
- name: Upload and run stack health checks
hosts: proxmox
gather_facts: false
become: false
become: true
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 }}"
@@ -30,7 +23,7 @@
ansible.builtin.debug:
msg: "{{ health.stdout | default('no stdout') }}"
- name: Fail if checks failed
- name: Fail if checks failed (rc != 0)
ansible.builtin.fail:
msg: "Health checks failed"
when: health.rc != 0