working state
This commit is contained in:
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@@ -1,4 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager">
|
<component name="ProjectRootManager">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
|||||||
@@ -1,40 +1,11 @@
|
|||||||
---
|
---
|
||||||
- name: "Run Update-Check"
|
- name: "Run main loop"
|
||||||
become: true
|
include_tasks: "main_loop.yml"
|
||||||
become_user: "{{ nextcloud_user }}"
|
|
||||||
shell:
|
|
||||||
cmd: "{{ php_binary }} {{ php_arguments }} {{ nextcloud_path }}/occ update:check --no-interaction --no-warnings"
|
|
||||||
register: nextcloud_update_check_output
|
|
||||||
|
|
||||||
- name: "Parse Update-Check Output"
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
nextcloud_update_needed: "{{ nextcloud_update_check_output.stdout | regex_search('Nextcloud\\s[^\\n]*\\sis\\savailable') | bool }}"
|
|
||||||
|
|
||||||
- name: "Enable Maintenance-Mode"
|
|
||||||
include_tasks: "occ_command.yml"
|
|
||||||
vars:
|
vars:
|
||||||
occ_command: "maintenance:mode --on"
|
nextcloud_user: "{{ nc_instance.nextcloud_user }}"
|
||||||
|
nextcloud_path: "{{ nc_instance.nextcloud_path }}"
|
||||||
- name: "Run Update"
|
php_binary: "{{ nc_instance.php_binary }}"
|
||||||
include_tasks: "update.yml"
|
php_arguments: "{{ nc_instance.php_arguments }}"
|
||||||
when: nextcloud_update_needed
|
loop_control:
|
||||||
|
loop_var: "nc_instance"
|
||||||
- name: "Run Maintenance tasks"
|
loop: "{{ nextcloud_instances }}"
|
||||||
include_tasks: "occ_command.yml"
|
|
||||||
vars:
|
|
||||||
occ_command: "{{ item }}"
|
|
||||||
loop:
|
|
||||||
- "maintenance:repair --no-interaction"
|
|
||||||
- "app:update --all --no-interaction"
|
|
||||||
- "maintenance:update:htaccess --no-interaction"
|
|
||||||
- "db:add-missing-columns --no-interaction"
|
|
||||||
- "db:add-missing-indices --no-interaction"
|
|
||||||
- "db:add-missing-primary-keys --no-interaction"
|
|
||||||
- "db:convert-filecache-bigint --no-interaction"
|
|
||||||
- "db:convert-mysql-charset --no-interaction"
|
|
||||||
|
|
||||||
- name: "Disable Maintenance-Mode"
|
|
||||||
include_tasks: "occ_command.yml"
|
|
||||||
vars:
|
|
||||||
occ_command: "maintenance:mode --off"
|
|
||||||
|
|
||||||
42
tasks/main_loop.yml
Normal file
42
tasks/main_loop.yml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
- name: "Run Update-Check"
|
||||||
|
become: true
|
||||||
|
become_user: "{{ nextcloud_user }}"
|
||||||
|
shell:
|
||||||
|
cmd: "{{ php_binary }} {{ php_arguments }} {{ nextcloud_path }}/occ update:check --no-interaction --no-warnings"
|
||||||
|
register: nextcloud_update_check_output
|
||||||
|
|
||||||
|
- name: "Parse Update-Check Output"
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
nextcloud_update_needed: "{{ nextcloud_update_check_output.stdout | regex_search(update_regex) }}"
|
||||||
|
vars:
|
||||||
|
update_regex: 'Nextcloud [\d\.]+ is available'
|
||||||
|
|
||||||
|
- name: "Main Update block"
|
||||||
|
when: "nextcloud_update_needed"
|
||||||
|
block:
|
||||||
|
- name: "Run Update"
|
||||||
|
include_tasks: "update.yml"
|
||||||
|
when: nextcloud_update_needed
|
||||||
|
|
||||||
|
|
||||||
|
- name: "Run Maintenance tasks (after update)"
|
||||||
|
include_tasks: "occ_command.yml"
|
||||||
|
vars:
|
||||||
|
occ_command: "{{ item }}"
|
||||||
|
loop:
|
||||||
|
- "maintenance:repair --no-interaction"
|
||||||
|
when: "nextcloud_update_needed"
|
||||||
|
|
||||||
|
- name: "Run Maintenance tasks"
|
||||||
|
include_tasks: "occ_command.yml"
|
||||||
|
vars:
|
||||||
|
occ_command: "{{ item }}"
|
||||||
|
loop:
|
||||||
|
- "app:update --all --no-interaction"
|
||||||
|
- "maintenance:update:htaccess --no-interaction"
|
||||||
|
- "db:add-missing-columns --no-interaction"
|
||||||
|
- "db:add-missing-indices --no-interaction"
|
||||||
|
- "db:add-missing-primary-keys --no-interaction"
|
||||||
|
- "db:convert-filecache-bigint --no-interaction"
|
||||||
|
- "db:convert-mysql-charset --no-interaction"
|
||||||
@@ -4,3 +4,4 @@
|
|||||||
become_user: "{{ nextcloud_user }}"
|
become_user: "{{ nextcloud_user }}"
|
||||||
shell:
|
shell:
|
||||||
cmd: "{{ php_binary }} {{ php_arguments }} {{ nextcloud_path }}/occ {{ occ_command }}"
|
cmd: "{{ php_binary }} {{ php_arguments }} {{ nextcloud_path }}/occ {{ occ_command }}"
|
||||||
|
register: nc_occ_output
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
become: true
|
become: true
|
||||||
become_user: "{{ nextcloud_user }}"
|
become_user: "{{ nextcloud_user }}"
|
||||||
shell:
|
shell:
|
||||||
cmd: "{{ php_binary }} {{ php_arguments }} {{ nextcloud_path }}/updater/updater.phar --no-interaction"
|
cmd: "alias \"php={{ php_binary }} {{ php_arguments }}\"; php {{ nextcloud_path }}/updater/updater.phar --no-interaction"
|
||||||
|
|
||||||
- name: "Disable Maintenance-Mode"
|
- name: "Disable Maintenance-Mode"
|
||||||
include_tasks: "occ_command.yml"
|
include_tasks: "occ_command.yml"
|
||||||
@@ -18,4 +18,4 @@
|
|||||||
- name: "Disable Maintenance-Mode"
|
- name: "Disable Maintenance-Mode"
|
||||||
include_tasks: "occ_command.yml"
|
include_tasks: "occ_command.yml"
|
||||||
vars:
|
vars:
|
||||||
occ_command: "maintenance:mode --on"
|
occ_command: "maintenance:mode --off"
|
||||||
Reference in New Issue
Block a user