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

Nextcloud tuneup for NGINX

This commit is contained in:
root 2020-02-15 22:49:27 -05:00
parent fd26d794fa
commit cf7f776003
21 changed files with 319 additions and 324 deletions

View file

@ -9,13 +9,21 @@
password: "{{ nextcloud_dbpassword }}"
priv: "{{ nextcloud_dbname }}.*:ALL,GRANT"
with_items:
- "{{ nextcloud_dbhost }}"
- 127.0.0.1
- ::1
- localhost
# The install wizard fails if already installed.
- name: Determine if Nextcloud is installed
#- name: Install {{ nextcloud_prefix }}/nextcloud/config/autoconfig.php from template
# template:
# src: autoconfig.php.j2
# dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php"
# owner: "{{ apache_user }}"
# group: "{{ apache_user }}"
# mode: '0640'
- name: Determine if Nextcloud is installed (causes install wizard to fail)
shell: >
php {{ nextcloud_prefix }}/nextcloud/occ status |
gawk '/installed:/ { print $3 }'
@ -23,7 +31,7 @@
become_user: "{{ apache_user }}"
register: returned
- name: Run Nextcloud initial install wizard
- name: Run Nextcloud initial install wizard (if absolutely nec, manually drop MySQL db '{{ nextcloud_dbname }}')
shell: >
cd {{ nextcloud_prefix }}/nextcloud;
php occ maintenance:install
@ -35,52 +43,18 @@
--admin-pass "{{ nextcloud_admin_password }}"
become: yes
become_user: "{{ apache_user }}"
when: nextcloud_enabled and returned.stdout == "false"
when: returned.stdout == "false" # and nextcloud_enabled
# https://docs.nextcloud.com/server/18/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"
regexp: '^clear_env'
insertafter: ';.*clear_env'
line: 'clear_env = no'
# RELATED: /etc/apache2/sites-available/nextcloud.conf sourced from
# https://github.com/iiab/iiab/blob/master/roles/nextcloud/templates/nextcloud.conf.j2
- name: 'Allow Nextcloud access from all hosts and IP addresses (SEE ALSO: /etc/apache2/sites-available/nextcloud.conf)'
command: php {{ nextcloud_prefix }}/nextcloud/occ config:system:set trusted_domains 1 --value=*
become: yes
become_user: "{{ apache_user }}"
when: nextcloud_enabled and returned.stdout == "false"
# Code below was NEVER RUNNING as of 2018-10-29, as "wc | cut -d' ' -f1" ALWAYS
# returns null (rather than the intended returned_count !) This line could
# be replaced by ALTERNATIVE 1 or ALTERNATIVE 2 below IF it truly needs fixing.
#
# Or perhaps default user/password nextcloud/nextcloudmysql (from variables
# nextcloud_user/nextcloud_user_password) is just not needed in the end...
#
# NOTE: COMMENTS (FOLLOWING '#' SIGN) WITHIN A SHELL COMMAND CAUSE IT TO *FAIL*
#
#- name: Determine if Nextcloud user exists already
# shell: >
# php {{ nextcloud_prefix }}/nextcloud/occ user:list |
# grep {{ nextcloud_user }} | wc | cut -d' ' -f1 # USELESS
# #grep {{ nextcloud_user }} | wc -l # ALTERNATIVE 1
# #grep {{ nextcloud_user }} | wc | awk '{print $1}' # ALTERNATIVE 2
# become: yes
# become_user: "{{ apache_user }}"
# register: returned_count
#
# debug:
# var: returned_count
#
## nextcloud wants to make users rather than just mysql users and not done
#- name: Create the default user
# shell: >
# OC_PASS={{ nextcloud_user_password }};
# php {{ nextcloud_prefix }}/nextcloud/occ user:add
# --password-from-env --display-name={{ nextcloud_user }}
# --group="users" {{ nextcloud_user }}
# become: yes
# become_user: "{{ apache_user }}"
# when: nextcloud_enabled and returned_count == "0"
# 2019-09-04: NEXT 5 LINES APPEAR INEFFECTIVE DURING 1ST INSTALL? (possibly "overwrite.cli.url" appears later, when Nextcloud's web install completes using http://box/nextcloud ?)
- name: Try to remove overwrite.cli.url line (Rewrite URL) from /opt/nextcloud/config/config.php
lineinfile:
regexp: "overwrite.cli.url"
state: absent
path: "{{ nextcloud_prefix }}/nextcloud/config/config.php"