--- - name: Upload and run stack health checks hosts: proxmox become: true vars: health_script_path: /data/compose/nextcloud/stack-health.sh tasks: - name: Upload stack-health.sh ansible.builtin.copy: src: files/stack-health.sh dest: "{{ health_script_path }}" mode: '0755' - 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 (rc != 0) ansible.builtin.fail: msg: "Health checks failed" when: health.rc != 0