2020-02-16 16:29:12 +00:00
|
|
|
# CHECK FOR PHP VERSION AUTOMATICALLY, TO DETERMINE WHICH NEXTCLOUD TO INSTALL.
|
|
|
|
# INSPIRED BY: github.com/iiab/iiab/blob/master/roles/nodejs/tasks/main.yml
|
|
|
|
|
|
|
|
# - name: Try to run 'php -v' to get PHP version
|
|
|
|
# # e.g. converts multi-line "PHP 7.0.33-0ubuntu0.16.04.5 (cli) ( NTS ) ..." to "7.0.33"
|
|
|
|
# shell: php -v | head -1 | sed 's/^[^0-9.]*//' | sed 's/[^0-9.].*//'
|
|
|
|
# register: php_version_installed
|
|
|
|
# #ignore_errors: yes # NOT NEC: if php is not installed, php_version_installed.stdout will get set to ""
|
|
|
|
|
|
|
|
# - debug:
|
|
|
|
# var: php_version_installed
|
|
|
|
|
|
|
|
# # NOTE: this could easily be made to work even if PHP was not installed, e.g.
|
|
|
|
# # by pre-initializing variable 'php_new' to False here. But trapping the
|
|
|
|
# # absence of PHP (below) is a useful software safety precondition!
|
|
|
|
# #
|
|
|
|
# #- name: Initialize var 'php_new' to False
|
|
|
|
# # set_fact:
|
|
|
|
# # php_new: False
|
|
|
|
|
|
|
|
# - name: INTENTIONALLY FAIL, IF PHP (Nextcloud prerequisite) ISN'T INSTALLED
|
|
|
|
# fail:
|
|
|
|
# msg: >
|
|
|
|
# Nextcloud install cannot proceed, as it requires PHP be installed first.
|
|
|
|
# Note that as of 2019-07-04, IIAB takes care of this by forcing vars
|
|
|
|
# mysql_install and mysql_enabled to True in
|
|
|
|
# /opt/iiab/iiab/roles/0-init/tasks/main.yml, which in turn forces the
|
|
|
|
# installation of PHP in /opt/iiab/iiab/roles/mysql/tasks/main.yml, as
|
|
|
|
# invoked by /opt/iiab/iiab/roles/3-base-server/tasks/main.yml
|
|
|
|
# when: php_version_installed.stdout == ""
|
|
|
|
|
|
|
|
# - name: Set var 'php_new' indicating if installed version of PHP ({{ php_version_installed.stdout }}) >= 7.1, as required by Nextcloud 16
|
|
|
|
# set_fact:
|
|
|
|
# php_new: "{{ php_version_installed.stdout is version('7.1', '>=') }}"
|
|
|
|
# # Ansible's Version Comparison routine:
|
|
|
|
# # https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#version-comparison
|
|
|
|
# when: php_version_installed.stdout != "" # i.e. IF ABOVE 'php -v' WORKED
|
|
|
|
|
|
|
|
# - debug:
|
|
|
|
# var: php_new
|
|
|
|
|
|
|
|
|
2020-02-16 03:49:27 +00:00
|
|
|
# https://docs.nextcloud.com/server/18/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
|
2020-02-16 16:29:12 +00:00
|
|
|
- name: Install ffmpeg + libxml2 + 13 php packages
|
2019-07-05 00:43:15 +00:00
|
|
|
package:
|
|
|
|
name:
|
2020-02-16 03:49:27 +00:00
|
|
|
#- dnsutils # NOT REQUESTED by Nextcloud
|
|
|
|
- ffmpeg # Optional (for preview generation)
|
|
|
|
- libxml2 # php-libxml requires libxml2 >= 2.7.0
|
|
|
|
#- libapache2-mod-php # 2020-02-15: NO LONGER NEEDED?
|
|
|
|
- php-bz2 # Optional (for extraction of apps)
|
|
|
|
#- php-cli # NOT REQUESTED by Nextcloud
|
|
|
|
#- php-common # NOT REQUESTED by Nextcloud
|
|
|
|
- php-curl
|
2020-03-08 19:26:05 +00:00
|
|
|
- php-fpm # ALSO INSTALLED IN roles/www_base (Stage 3) for nginx_high_php_limits
|
2020-02-16 03:49:27 +00:00
|
|
|
- php-gd
|
|
|
|
- php-gmp # Optional (for SFTP storage)
|
|
|
|
- php-imagick # Optional (for preview generation)
|
|
|
|
- php-intl # Optional (increases language translation performance and fixes sorting of non-ASCII characters)
|
|
|
|
- php-json
|
|
|
|
#- php-libxml # NOT INSTALLABLE: ENABLED BY DEFAULT (https://www.php.net/manual/en/libxml.installation.php)
|
2019-07-05 00:43:15 +00:00
|
|
|
- php-mbstring
|
2020-02-16 03:49:27 +00:00
|
|
|
- php-mysql
|
|
|
|
#- php-openssl # NOT INSTALLABLE: ENABLED BY DEFAULT?
|
|
|
|
#- php-pdo_mysql # NOT INSTALLABLE: php-mysql handles this on all OS's?
|
|
|
|
#- php-redis # @m-anish future work?
|
|
|
|
#- php-session # NOT INSTALLABLE: ENABLED BY DEFAULT?
|
|
|
|
- php-smbclient # Optional (SMB/CIFS integration
|
2020-02-16 16:29:12 +00:00
|
|
|
- php-xml # NOT FORMALLY REQUESTED by Nextcloud (BUT hopefully delivers php-simplexml if not {php-xmlreader, php-xmlwriter} on Raspbian?)
|
2019-09-06 10:46:11 +00:00
|
|
|
- php-zip
|
2020-02-16 03:49:27 +00:00
|
|
|
#- php-zlib # NOT INSTALLABLE: ENABLED BY DEFAULT?
|
2019-07-05 00:43:15 +00:00
|
|
|
state: present
|
|
|
|
|
2020-02-16 16:29:12 +00:00
|
|
|
# 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-ctype
|
|
|
|
- php-dom
|
|
|
|
- php-exif # Optional (for image rotation in pictures app)
|
|
|
|
- php-fileinfo # Optional (enhances file analysis performance)
|
|
|
|
- php-iconv
|
|
|
|
- php-posix
|
|
|
|
- php-simplexml
|
|
|
|
- php-xmlreader
|
|
|
|
- php-xmlwriter
|
|
|
|
state: present
|
|
|
|
when: not is_raspbian
|
|
|
|
|
|
|
|
|
2020-02-17 01:52:01 +00:00
|
|
|
- name: Create dir {{ nextcloud_root_dir }}
|
2019-07-05 00:43:15 +00:00
|
|
|
file:
|
|
|
|
state: directory
|
2020-02-17 01:52:01 +00:00
|
|
|
path: "{{ nextcloud_root_dir }}" # /library/www/nextcloud
|
2019-07-05 00:43:15 +00:00
|
|
|
|
2020-02-17 01:52:01 +00:00
|
|
|
- name: Unarchive {{ nextcloud_dl_url }} to {{ nextcloud_root_dir }} ({{ apache_user }}:{{ apache_user }})
|
2020-02-16 03:49:27 +00:00
|
|
|
unarchive:
|
|
|
|
remote_src: yes
|
|
|
|
src: "{{ nextcloud_dl_url }}"
|
2020-02-17 01:52:01 +00:00
|
|
|
#dest: "{{ nextcloud_base_dir }}" # /library/www
|
|
|
|
dest: "{{ nextcloud_root_dir }}" # /library/www/nextcloud
|
|
|
|
owner: "{{ apache_user }}" # apache2 on debuntu
|
2019-07-05 00:43:15 +00:00
|
|
|
group: "{{ apache_user }}"
|
2020-02-17 01:52:01 +00:00
|
|
|
extra_opts: --strip-components=1 # Or use 'dest: /library/www' above
|
2020-02-16 03:49:27 +00:00
|
|
|
when: internet_available
|
|
|
|
|
|
|
|
- name: Provision Nextcloud's MySQL DB, run Nextcloud's install wizard, etc
|
|
|
|
include_tasks: setup.yml
|
2019-07-05 00:43:15 +00:00
|
|
|
|
2020-02-17 01:52:01 +00:00
|
|
|
- name: Install /etc/{{ apache_conf_dir }}/nextcloud.conf from template, for http://box{{ nextcloud_url }} # http://box/nextcloud
|
2019-09-01 07:58:04 +00:00
|
|
|
template:
|
|
|
|
src: nextcloud.conf.j2
|
2020-02-16 03:49:27 +00:00
|
|
|
dest: "/etc/{{ apache_conf_dir }}/nextcloud.conf" # apache2/sites-available on debuntu
|
2020-02-16 06:16:23 +00:00
|
|
|
when: apache_install | bool
|
2020-01-29 14:21:00 +00:00
|
|
|
|
|
|
|
|
2020-01-30 09:00:00 +00:00
|
|
|
# RECORD Nextcloud AS INSTALLED
|
|
|
|
|
|
|
|
- name: "Set 'nextcloud_installed: True'"
|
|
|
|
set_fact:
|
|
|
|
nextcloud_installed: True
|
|
|
|
|
2020-01-12 23:15:33 +00:00
|
|
|
- name: "Add 'nextcloud_installed: True' to {{ iiab_state_file }}"
|
2019-09-09 17:14:13 +00:00
|
|
|
lineinfile:
|
2020-02-04 00:54:04 +00:00
|
|
|
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
2019-09-09 17:14:13 +00:00
|
|
|
regexp: '^nextcloud_installed'
|
2019-10-07 17:11:21 +00:00
|
|
|
line: 'nextcloud_installed: True'
|