fix: standardize comments formatting in Nextcloud update playbook

This commit is contained in:
martin.fencl
2026-08-17 11:33:10 +02:00
parent 8f86d00351
commit c20991d13d
+57 -58
View File
@@ -8,40 +8,40 @@
become_method: sudo
vars:
# vm_pass is stored in Semaphore Secrets as an environment variable.
# vm_pass is stored in Semaphore Secrets as an environment variable.
vm_password: "{{ lookup('ansible.builtin.env', 'vm_pass') }}"
# Values stored in Semaphore Extra variables.
# Values stored in Semaphore Extra variables.
vm_use_sudo: "{{ use_sudo | default(false) | bool }}"
debug_level: "{{ DEBUG | default(0) | int }}"
retry_count: "{{ RETRIES | default(25) | int }}"
# Docker Compose configuration.
# Docker Compose configuration.
nextcloud_project: "nextcloud-collabora"
nextcloud_service: "nextcloud"
# Compose file stored in Git.
# Compose file stored in Git.
nextcloud_compose_local_file: >-
{{ playbook_dir }}/../docker-compose/docker-compose-nextcloud.yml
# Compose file location on the Nextcloud VM.
# Compose file location on the Nextcloud VM.
nextcloud_compose_file: >-
/data/compose/nextcloud/docker-compose-nextcloud.yml
# Temporary Compose file on the Proxmox host.
# Temporary Compose file on the Proxmox host.
nextcloud_compose_controller_staging_file: >-
/tmp/docker-compose-nextcloud-{{ backup_timestamp }}.yml
# Temporary Compose file on the Nextcloud VM.
# Temporary Compose file on the Nextcloud VM.
nextcloud_compose_vm_staging_file: >-
/tmp/docker-compose-nextcloud-{{ backup_timestamp }}.yml
# Container names.
# Container names.
nextcloud_container: "nextcloud"
nextcloud_db_container: "nextcloud-db"
redis_container: "redis"
# Public endpoints.
# Public endpoints.
nextcloud_base_url: "https://cloud.martinfencl.eu"
nextcloud_status_url: "{{ nextcloud_base_url }}/status.php"
@@ -49,10 +49,10 @@
collabora_discovery_url: >-
https://collabora.martinfencl.eu/hosting/discovery
# Backup configuration.
# Backup configuration.
backup_root: "/data/compose/nextcloud"
# Docker command without CLI hints.
# Docker command without CLI hints.
docker_cmd: "env DOCKER_CLI_HINTS=0 docker"
nextcloud_version_command: >-
@@ -65,9 +65,9 @@
{{ nextcloud_container | quote }}
php occ maintenance:mode --off
# -------------------------------------------------------------------------
# Compose installation script
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Compose installation script
# -------------------------------------------------------------------------
compose_install_script: |
set -Eeuo pipefail
@@ -138,9 +138,9 @@
echo "Compose file updated"
# -------------------------------------------------------------------------
# Preflight script
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Preflight script
# -------------------------------------------------------------------------
preflight_script: |
set -Eeuo pipefail
@@ -252,9 +252,9 @@
echo "Preflight checks completed successfully"
# -------------------------------------------------------------------------
# Backup script
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Backup script
# -------------------------------------------------------------------------
backup_script: |
set -Eeuo pipefail
@@ -275,7 +275,6 @@
php occ maintenance:mode --off >/dev/null 2>&1 || true
fi
exit "${rc}"
}
trap cleanup EXIT
@@ -392,9 +391,9 @@
echo "Backup completed successfully"
echo "Backup directory: {{ backup_dir }}"
# -------------------------------------------------------------------------
# Upgrade script
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Upgrade script
# -------------------------------------------------------------------------
upgrade_script: |
set -Eeuo pipefail
@@ -640,9 +639,9 @@
echo "Nextcloud upgrade commands completed successfully"
# -------------------------------------------------------------------------
# Post-upgrade script
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Post-upgrade script
# -------------------------------------------------------------------------
postcheck_script: |
set -Eeuo pipefail
@@ -793,9 +792,9 @@
state: present
update_cache: true
# -------------------------------------------------------------------------
# Compose synchronization
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Compose synchronization
# -------------------------------------------------------------------------
- name: Nextcloud | Check Compose file in repository
ansible.builtin.stat:
@@ -952,9 +951,9 @@
failed_when: false
no_log: true
# -------------------------------------------------------------------------
# Preflight
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Preflight
# -------------------------------------------------------------------------
- name: Nextcloud | Run preflight checks on VM
ansible.builtin.command:
@@ -1021,9 +1020,9 @@
{{ nc_preflight.stderr | default('') | trim }}
quiet: true
# -------------------------------------------------------------------------
# Current version
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Current version
# -------------------------------------------------------------------------
- name: Nextcloud | Read current version before upgrade
ansible.builtin.command:
@@ -1070,9 +1069,9 @@
| trim
}}
# -------------------------------------------------------------------------
# Backup and upgrade
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Backup and upgrade
# -------------------------------------------------------------------------
- name: Nextcloud | Run backup and upgrade
block:
@@ -1097,11 +1096,11 @@
- "{{ vm_user }}@{{ vm_ip }}"
- >-
{{
('sudo -n bash -lc ' ~
('sudo -n bash -c ' ~
(backup_script | quote))
if vm_use_sudo
else
('bash -lc ' ~
('bash -c ' ~
(backup_script | quote))
}}
environment:
@@ -1213,11 +1212,11 @@
quiet: true
always:
# Disable maintenance mode when:
# - the backup failed before the upgrade task was started, or
# - the upgrade completed successfully.
#
# Do not disable maintenance mode after a failed OCC upgrade.
# Disable maintenance mode when:
# - the backup failed before the upgrade task was started, or
# - the upgrade completed successfully.
#
# Do not disable maintenance mode after a failed OCC upgrade.
- name: Nextcloud | Disable maintenance mode
ansible.builtin.command:
argv:
@@ -1288,9 +1287,9 @@
when:
- nc_upgrade is not defined or nc_upgrade.rc == 0
# -------------------------------------------------------------------------
# Public Nextcloud readiness
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Public Nextcloud readiness
# -------------------------------------------------------------------------
- name: Nextcloud | Wait for public status.php
ansible.builtin.uri:
@@ -1313,9 +1312,9 @@
- not (nc_status.json.needsDbUpgrade | default(true) | bool)
changed_when: false
# -------------------------------------------------------------------------
# Post-upgrade checks
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Post-upgrade checks
# -------------------------------------------------------------------------
- name: Nextcloud | Run post-upgrade checks on VM
ansible.builtin.command:
@@ -1382,9 +1381,9 @@
{{ nc_postcheck.stderr | default('') | trim }}
quiet: true
# -------------------------------------------------------------------------
# External Collabora checks
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# External Collabora checks
# -------------------------------------------------------------------------
- name: Nextcloud | Check external Collabora root endpoint
ansible.builtin.uri:
@@ -1421,9 +1420,9 @@
('<wopi-discovery' not in
(collabora_discovery.content | default('')))
# -------------------------------------------------------------------------
# Final result
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Final result
# -------------------------------------------------------------------------
- name: Nextcloud | Print final status
ansible.builtin.debug: