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