Add playbooks/nextcloud-upgrade.yml
This commit is contained in:
@@ -0,0 +1,68 @@
|
|||||||
|
---
|
||||||
|
- name: Upgrade Nextcloud via CLI on Rocky Linux
|
||||||
|
hosts: nextcloud_servers
|
||||||
|
become: yes
|
||||||
|
vars:
|
||||||
|
nextcloud_dir: /var/www/nextcloud
|
||||||
|
web_user: apache
|
||||||
|
php_cli: /usr/bin/php
|
||||||
|
service_name: httpd
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Reminder to ensure backups
|
||||||
|
debug:
|
||||||
|
msg: "⚠️ Ensure database and data directory backups are taken before running upgrade!"
|
||||||
|
|
||||||
|
- name: Enable maintenance mode
|
||||||
|
command: "{{ php_cli }} occ maintenance:mode --on"
|
||||||
|
args:
|
||||||
|
chdir: "{{ nextcloud_dir }}"
|
||||||
|
become_user: "{{ web_user }}"
|
||||||
|
|
||||||
|
- name: Run Nextcloud CLI updater (non-interactive)
|
||||||
|
command: "{{ php_cli }} updater/updater.phar --no-interaction"
|
||||||
|
args:
|
||||||
|
chdir: "{{ nextcloud_dir }}"
|
||||||
|
become_user: "{{ web_user }}"
|
||||||
|
|
||||||
|
- name: Perform Nextcloud database upgrade
|
||||||
|
command: "{{ php_cli }} occ upgrade"
|
||||||
|
args:
|
||||||
|
chdir: "{{ nextcloud_dir }}"
|
||||||
|
become_user: "{{ web_user }}"
|
||||||
|
|
||||||
|
- name: Run DB maintenance - add missing indices
|
||||||
|
command: "{{ php_cli }} occ db:add-missing-indices"
|
||||||
|
args:
|
||||||
|
chdir: "{{ nextcloud_dir }}"
|
||||||
|
become_user: "{{ web_user }}"
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Run DB maintenance - convert bigint fields
|
||||||
|
command: "{{ php_cli }} occ db:convert-filecache-bigint --no-interaction"
|
||||||
|
args:
|
||||||
|
chdir: "{{ nextcloud_dir }}"
|
||||||
|
become_user: "{{ web_user }}"
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Disable maintenance mode
|
||||||
|
command: "{{ php_cli }} occ maintenance:mode --off"
|
||||||
|
args:
|
||||||
|
chdir: "{{ nextcloud_dir }}"
|
||||||
|
become_user: "{{ web_user }}"
|
||||||
|
|
||||||
|
- name: Restart Apache (httpd)
|
||||||
|
service:
|
||||||
|
name: "{{ service_name }}"
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: Verify Nextcloud version and status
|
||||||
|
command: "{{ php_cli }} occ status"
|
||||||
|
args:
|
||||||
|
chdir: "{{ nextcloud_dir }}"
|
||||||
|
become_user: "{{ web_user }}"
|
||||||
|
register: occ_status
|
||||||
|
|
||||||
|
- name: Display Nextcloud version info
|
||||||
|
debug:
|
||||||
|
var: occ_status.stdout
|
||||||
Reference in New Issue
Block a user