forked from jakub/ansible
Refactor health check playbook to update host target from 'proxmox' to 'nextcloud_stack' and streamline stack health script content
This commit is contained in:
5
inv_linuxes_portainer
Normal file
5
inv_linuxes_portainer
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[linux_servers]
|
||||||
|
proxmox ansible_host=192.168.69.2
|
||||||
|
|
||||||
|
[nextcloud_stack]
|
||||||
|
vm_portainer ansible_host=192.168.69.X ansible_user=root ansible_python_interpreter=/usr/bin/python3
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
|
# Comments in English in code:
|
||||||
---
|
---
|
||||||
- name: Upload and run stack health checks
|
- name: Upload and run stack health checks
|
||||||
hosts: proxmox
|
hosts: nextcloud_stack # <-- dříve 'proxmox'
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
health_script_path: /data/compose/nextcloud/stack-health.sh
|
health_script_path: /data/compose/nextcloud/stack-health.sh
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Ensure target directory exists
|
- name: Ensure target directory exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
@@ -18,7 +17,6 @@
|
|||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: "{{ health_script_path }}"
|
dest: "{{ health_script_path }}"
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
# Comments in English: wrap the whole script with {% raw %} ... {% endraw %} so Jinja doesn't eat {{...}} in bash.
|
|
||||||
content: |-
|
content: |-
|
||||||
{% raw %}
|
{% raw %}
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
@@ -167,11 +165,7 @@
|
|||||||
echo "ALL CHECKS PASSED ✅"
|
echo "ALL CHECKS PASSED ✅"
|
||||||
else
|
else
|
||||||
echo "----------------------------------------"
|
echo "----------------------------------------"
|
||||||
echo "ONE OR MORE CHECKS FAILED ❌ (see above)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit "$EXIT"
|
|
||||||
{% endraw %}
|
|
||||||
|
|
||||||
- name: Run stack-health.sh
|
- name: Run stack-health.sh
|
||||||
ansible.builtin.shell: "{{ health_script_path }}"
|
ansible.builtin.shell: "{{ health_script_path }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user