forked from jakub/ansible
.
This commit is contained in:
@@ -8,7 +8,10 @@
|
||||
become_method: sudo
|
||||
|
||||
vars:
|
||||
# vm_pass is stored in Semaphore as a secret environment variable.
|
||||
vm_password: "{{ lookup('ansible.builtin.env', 'vm_pass') }}"
|
||||
|
||||
# Other values are loaded directly from Semaphore Extra variables.
|
||||
vm_use_sudo: "{{ use_sudo | default(false) | bool }}"
|
||||
|
||||
nextcloud_container: "nextcloud"
|
||||
@@ -24,25 +27,25 @@
|
||||
- name: Run Nextcloud cron
|
||||
command: >-
|
||||
docker exec -u www-data
|
||||
{{ nextcloud_container }}
|
||||
{{ nextcloud_container | quote }}
|
||||
php -f /var/www/html/cron.php
|
||||
|
||||
- name: Update Nextcloud applications
|
||||
command: >-
|
||||
docker exec -u www-data
|
||||
{{ nextcloud_container }}
|
||||
{{ nextcloud_container | quote }}
|
||||
php occ app:update --all
|
||||
|
||||
- name: Run Nextcloud maintenance repair
|
||||
command: >-
|
||||
docker exec -u www-data
|
||||
{{ nextcloud_container }}
|
||||
{{ nextcloud_container | quote }}
|
||||
php occ maintenance:repair --include-expensive
|
||||
|
||||
- name: Read Nextcloud status
|
||||
command: >-
|
||||
docker exec -u www-data
|
||||
{{ nextcloud_container }}
|
||||
{{ nextcloud_container | quote }}
|
||||
php occ status
|
||||
|
||||
- name: Check required containers
|
||||
@@ -62,7 +65,7 @@
|
||||
- name: Check MariaDB readiness
|
||||
command: >-
|
||||
docker exec
|
||||
{{ nextcloud_db_container }}
|
||||
{{ nextcloud_db_container | quote }}
|
||||
sh -c
|
||||
'mariadb-admin ping -h 127.0.0.1 --silent 2>/dev/null
|
||||
|| mysqladmin ping -h 127.0.0.1 --silent 2>/dev/null'
|
||||
@@ -71,7 +74,7 @@
|
||||
command: >-
|
||||
set -o pipefail;
|
||||
docker exec
|
||||
{{ redis_container }}
|
||||
{{ redis_container | quote }}
|
||||
redis-cli -h 127.0.0.1 ping
|
||||
| grep -qx PONG
|
||||
|
||||
@@ -94,7 +97,7 @@
|
||||
- vm_ip | string | trim | length > 0
|
||||
- vm_user is defined
|
||||
- vm_user | string | trim | length > 0
|
||||
- vm_password | length > 0
|
||||
- vm_password | string | length > 0
|
||||
fail_msg: >-
|
||||
Missing vm_ip, vm_user or vm_pass.
|
||||
Check the attached Semaphore Variable Group.
|
||||
@@ -169,6 +172,9 @@
|
||||
Command: {{ item.item.command }}
|
||||
RC: {{ item.rc }}
|
||||
|
||||
STDOUT:
|
||||
{{ item.stdout | default('') | trim }}
|
||||
|
||||
STDERR:
|
||||
{{ item.stderr | default('') | trim }}
|
||||
quiet: true
|
||||
@@ -189,9 +195,9 @@
|
||||
run_once: true
|
||||
changed_when: false
|
||||
failed_when: >-
|
||||
collabora_root.status | default(0) != 200
|
||||
(collabora_root.status | default(0) | int != 200)
|
||||
or
|
||||
'OK' not in (collabora_root.content | default(''))
|
||||
('OK' not in (collabora_root.content | default('')))
|
||||
|
||||
- name: Check external Collabora discovery endpoint
|
||||
ansible.builtin.uri:
|
||||
@@ -206,19 +212,25 @@
|
||||
run_once: true
|
||||
changed_when: false
|
||||
failed_when: >-
|
||||
collabora_discovery.status | default(0) != 200
|
||||
(collabora_discovery.status | default(0) | int != 200)
|
||||
or
|
||||
'<wopi-discovery' not in
|
||||
(collabora_discovery.content | default(''))
|
||||
('<wopi-discovery' not in
|
||||
(collabora_discovery.content | default('')))
|
||||
|
||||
- name: Show final health summary
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
Nextcloud VM checks: OK
|
||||
Nextcloud containers: OK
|
||||
MariaDB: OK
|
||||
Redis: OK
|
||||
Nextcloud local HTTP: OK
|
||||
Nextcloud VM connection: OK
|
||||
Nextcloud cron: OK
|
||||
Nextcloud applications: OK
|
||||
Nextcloud maintenance repair: OK
|
||||
Nextcloud status: OK
|
||||
Nextcloud container: OK
|
||||
MariaDB container: OK
|
||||
Redis container: OK
|
||||
MariaDB readiness: OK
|
||||
Redis readiness: OK
|
||||
Nextcloud local HTTP endpoint: OK
|
||||
Collabora root endpoint: OK
|
||||
Collabora discovery endpoint: OK
|
||||
run_once: true
|
||||
Reference in New Issue
Block a user