1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

roles/nextcloud Spring Cleaning for Nextcloud 22+

This commit is contained in:
root 2021-07-06 14:44:54 -04:00
parent 97afe223e4
commit f805e0ab8a
8 changed files with 31 additions and 43 deletions

View file

@ -41,10 +41,9 @@
# February 2020: See @m-anish's PR #2119 and follow-up PR #2258.
# 2021-04-11: If you're running Nextcloud 21+ in production, carefully check the latest required AND recommended prereqs:
# 2021-07-06: If you're running Nextcloud 22+ in production, carefully check the latest required AND recommended prereqs:
# https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
# https://docs.nextcloud.com/server/21/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
# 2021-06-27: Use this after Nextcloud 22 is released "2021-07-06" :
# https://docs.nextcloud.com/server/22/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
- name: Install ffmpeg + libxml2 + 11 PHP packages (run 'php -m' or 'php -i' to verify)
package:
name:
@ -56,7 +55,8 @@
- php{{ php_version }}-bz2 # OPTIONAL (for extraction of apps)
#- php{{ php_version }}-common # Auto-installed as an apt dependency. REGARDLESS: php{{ php_version }}-common superset php{{ php_version }}-cli is auto-installed by php{{ php_version }}-fpm in nginx/tasks/install.yml
- php{{ php_version }}-curl # Likewise installed in moodle/tasks/install.yml, pbx/tasks/freepbx_dependencies.yml, wordpress/tasks/install.yml
#- php{{ php_version }}-exif # Optional (for image rotation in pictures app) but somehow already installed in our PHP core.
#- php{{ php_version }}-exif # OPTIONAL (for image rotation in pictures app) but somehow already installed with PHP's core, as confirmed by 'php -m'
#- php{{ php_version }}-fileinfo # OPTIONAL (enhances file analysis performance) but somehow already installed with PHP's core, as confirmed by 'php -m'
- php{{ php_version }}-gd # Likewise installed in moodle/tasks/install.yml, pbx/tasks/freepbx_dependencies.yml
- php{{ php_version }}-gmp # OPTIONAL (for SFTP storage)
- php-imagick # OPTIONAL (for preview generation). BUT drags in Apache's libapache2-mod-phpX.Y etc, as confirmed by 'apt depends php-imagick' -- while php{{ php_version }}-imagick installs (despite not being shown within 'apt list "php*imagick"') it's no better -- and 'apt depends phpX.Y-imagick' mysteriously does NOT show its deps. Likewise installed in wordpress/tasks/install.yml
@ -85,22 +85,6 @@
# state: present
# when: php_version is version('8.0', '<')
# https://docs.nextcloud.com/server/18/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
#- name: Install 9 additional php packages, if OS is not Raspbian (these are not available on Raspbian on RPi, as of Feb 2020)
# package:
# name:
# - php{{ php_version }}-ctype
# - php{{ php_version }}-dom
# - php{{ php_version }}-exif # Optional (for image rotation in pictures app)
# - php{{ php_version }}-fileinfo # Optional (enhances file analysis performance)
# - php{{ php_version }}-iconv
# - php{{ php_version }}-posix
# - php{{ php_version }}-simplexml
# - php{{ php_version }}-xmlreader
# - php{{ php_version }}-xmlwriter
# state: present
# when: not is_raspbian
- name: Create dir {{ nextcloud_root_dir }}
file:
@ -121,12 +105,6 @@
- name: Provision Nextcloud's MySQL DB, run Nextcloud's install wizard, etc
include_tasks: setup.yml
- name: Install /etc/{{ apache_conf_dir }}/nextcloud.conf from template, for http://box{{ nextcloud_url }} # http://box/nextcloud
template:
src: nextcloud.conf.j2
dest: "/etc/{{ apache_conf_dir }}/nextcloud.conf" # apache2/sites-available on debuntu
when: apache_installed is defined
# RECORD Nextcloud AS INSTALLED

View file

@ -24,11 +24,7 @@
when: nextcloud_installed is undefined
- name: Enable/Disable/Restart Apache if primary
include_tasks: apache.yml
when: not nginx_enabled
- name: Enable/Disable/Restart NGINX if primary
- name: Enable/Disable/Restart NGINX
include_tasks: nginx.yml
when: nginx_enabled

View file

@ -14,8 +14,8 @@
- localhost
# https://docs.nextcloud.com/server/18/admin_manual/installation/command_line_installation.html
- name: Create data dir {{ nextcloud_data_dir }}
# https://docs.nextcloud.com/server/latest/admin_manual/installation/command_line_installation.html
- name: Create data dir {{ nextcloud_data_dir }} ({{ apache_user }}:{{ apache_user }})
file:
state: directory
path: "{{ nextcloud_data_dir }}" # /library/www/nextcloud/data
@ -39,8 +39,7 @@
# insertafter: '^\$CONFIG = array \('
# line: " 'datadirectory' => '{{ nextcloud_data_dir }}',"
# 2020-02-16: SHOULD THIS STANZA GO AWAY IN FUTURE, in favor of 'nextcloud_installed is undefined' test below?
- name: Use php to determine if Nextcloud is installed (which would cause the install wizard to FAIL in the next step)
- name: "Run 'php {{ nextcloud_root_dir }}/occ status' to determine if Nextcloud is installed (causing INSTALL WIZARD TO FAIL in the next step)"
shell: >
php {{ nextcloud_root_dir }}/occ status |
gawk '/installed:/ { print $3 }'
@ -48,10 +47,20 @@
become_user: "{{ apache_user }}"
register: returned
# 3 of 3: New Way In 2020... use --data-dir "{{ nextcloud_data_dir }}"
# https://docs.nextcloud.com/server/18/admin_manual/installation/command_line_installation.html
# https://docs.nextcloud.com/server/18/admin_manual/configuration_server/occ_command.html#command-line-installation-label
- name: Run Nextcloud initial install wizard, seeding data dir {{ nextcloud_data_dir }} (IF THIS FAILS, CONSIDER MANUALLY DROPPING MySQL db '{{ nextcloud_dbname }}' THEN RERUN THIS)
# 3 of 3: NEW WAY IN 2020... use --data-dir "{{ nextcloud_data_dir }}"
# https://docs.nextcloud.com/server/latest/admin_manual/installation/command_line_installation.html
# https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#command-line-installation-label
# ...page lists alternative 'occ' commands. If Nextcloud's already installed,
# attempting 'maintenance:install' (below) also lists these options:
# app:install
# maintenance:data-fingerprint
# maintenance:mimetype:update-db
# maintenance:mimetype:update-js
# maintenance:mode
# maintenance:repair
# maintenance:theme:update
# maintenance:update:htaccess
- name: Run Nextcloud initial install wizard, seeding data dir {{ nextcloud_data_dir }} (IF THIS FAILS, CONSIDER 'sudo mysql' THEN 'DROP DATABASE {{ nextcloud_dbname }};' THEN RERUN THIS)
shell: >
cd {{ nextcloud_root_dir }};
php occ maintenance:install
@ -64,11 +73,13 @@
--data-dir "{{ nextcloud_data_dir }}"
become: yes
become_user: "{{ apache_user }}"
#when: nextcloud_installed is undefined
when: returned.stdout == "false" # and nextcloud_enabled
#when: nextcloud_installed is undefined
#args:
# creates: "{{ nextcloud_root_dir }}/SOME_FILE" # /library/www/nextcloud/SOME_FILE
# https://docs.nextcloud.com/server/18/admin_manual/installation/source_installation.html#php-fpm-configuration-notes
# https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html#php-fpm-configuration-notes
- name: Set 'clear_env = no' in /etc/php/{{ php_version }}/fpm/pool.d/www.conf
lineinfile:
path: "/etc/php/{{ php_version }}/fpm/pool.d/www.conf"
@ -76,7 +87,7 @@
insertafter: ';.*clear_env'
line: 'clear_env = no'
- name: 'Allow Nextcloud access from all hosts and IP addresses (SEE ALSO: /etc/apache2/sites-available/nextcloud.conf)'
- name: 'Allow Nextcloud access from all hosts and IP addresses -- SEE ALSO THE OLD WAY: https://github.com/iiab/iiab/blob/master/roles/nextcloud/templates/nextcloud.conf.j2.unused'
command: php {{ nextcloud_root_dir }}/occ config:system:set trusted_domains 1 --value=*
become: yes
become_user: "{{ apache_user }}"

View file

@ -1,3 +1,6 @@
# 2021-07-06: NGINX config should be reviewed year-by-year !
# https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html
# 2020-02-16: Customized from template...thanks to @m_anish:
#
# https://docs.nextcloud.com/server/18/admin_manual/installation/nginx.html#nextcloud-in-a-subdir-of-nginx

View file

@ -20,6 +20,7 @@
* jupyterhub
* lokole
* moodle
* nextcloud
* nodered
* OER2Go/RACHEL modules
* osm-vector-maps
@ -34,7 +35,6 @@
* kolibri
* mediawiki
* munin
* nextcloud
* sugarizer
* wordpress