2017-12-04 15:00:27 +00:00
|
|
|
- name: See if Nextcloud version page exists
|
|
|
|
stat:
|
|
|
|
path: "{{ nextcloud_prefix }}/nextcloud/version.php"
|
|
|
|
# path: "{{ nextcloud_prefix }}/nextcloud/index.php"
|
2017-05-29 22:02:55 +00:00
|
|
|
register: nextcloud_page
|
|
|
|
|
2017-12-04 15:23:04 +00:00
|
|
|
- name: FORCE INSTALL OR REINSTALL OR UPGRADE IF /opt/nextcloud/version.php DOESN'T EXIST
|
2017-12-04 15:00:27 +00:00
|
|
|
set_fact:
|
|
|
|
nextcloud_force_install: True
|
|
|
|
when: not nextcloud_page.stat.exists
|
|
|
|
|
|
|
|
# - debug:
|
|
|
|
# msg: "nextcloud_force_install: {{ nextcloud_force_install }}"
|
2017-05-29 22:02:55 +00:00
|
|
|
|
|
|
|
|
2018-10-29 07:18:58 +00:00
|
|
|
- name: Download {{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }} to {{ downloads_dir }}/{{ nextcloud_src_file }}
|
2017-12-04 15:00:27 +00:00
|
|
|
get_url:
|
|
|
|
url: "{{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }}"
|
|
|
|
dest: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
|
2017-12-08 06:42:39 +00:00
|
|
|
timeout: "{{ download_timeout }}"
|
2018-10-29 07:18:58 +00:00
|
|
|
#force: yes
|
|
|
|
#validate_certs: False # TEMPORARY ON/AFTER 2018-07-22 AS download.nextcloud.com CERT EXPIRED: https://github.com/iiab/iiab/issues/954
|
2017-12-04 15:00:27 +00:00
|
|
|
when: internet_available and nextcloud_force_install
|
2018-10-29 07:18:58 +00:00
|
|
|
#async: 1800
|
|
|
|
#poll: 10
|
2017-05-29 22:02:55 +00:00
|
|
|
tags:
|
|
|
|
- download
|
|
|
|
|
2018-10-28 17:22:47 +00:00
|
|
|
# Ubuntu and Debian treat names differently
|
|
|
|
- name: Install 3 php packages (debian)
|
2017-12-04 15:00:27 +00:00
|
|
|
package:
|
2018-10-28 17:22:47 +00:00
|
|
|
name:
|
|
|
|
- "libapache2-mod-php{{ php_version }}"
|
|
|
|
- "php{{ php_version }}-mbstring"
|
|
|
|
- "php{{ php_version }}-zip"
|
2017-12-04 15:00:27 +00:00
|
|
|
state: present
|
2017-06-20 02:06:50 +00:00
|
|
|
when: is_debian
|
|
|
|
|
2018-10-28 17:22:47 +00:00
|
|
|
# Ubuntu and Debian treat names differently
|
|
|
|
- name: Install 4 php packages (ubuntu)
|
2017-12-04 15:00:27 +00:00
|
|
|
package:
|
2018-10-28 17:22:47 +00:00
|
|
|
name:
|
|
|
|
- libapache2-mod-php
|
|
|
|
- php-imagick
|
|
|
|
- php-zip
|
|
|
|
- php-mbstring
|
2017-12-04 15:00:27 +00:00
|
|
|
state: present
|
2017-06-20 02:06:50 +00:00
|
|
|
when: is_ubuntu
|
|
|
|
|
2018-10-28 17:22:47 +00:00
|
|
|
- name: Install 5 more php packages (debuntu)
|
2017-12-04 15:00:27 +00:00
|
|
|
package:
|
2018-10-28 17:22:47 +00:00
|
|
|
name:
|
|
|
|
- "php{{ php_version }}-gd"
|
|
|
|
- "php{{ php_version }}-json"
|
|
|
|
- "php{{ php_version }}-mysql"
|
|
|
|
- "php{{ php_version }}-curl"
|
|
|
|
- "php{{ php_version }}-intl"
|
2017-12-04 15:00:27 +00:00
|
|
|
state: present
|
2018-04-28 20:45:08 +00:00
|
|
|
when: is_debuntu
|
2018-04-28 18:50:14 +00:00
|
|
|
|
2018-10-28 21:27:48 +00:00
|
|
|
- name: 'Install php{{ php_version }}-mcrypt (debuntu but not ubuntu-18) NOTE: php7.2 dropped mcrypt'
|
2018-04-28 18:50:14 +00:00
|
|
|
package:
|
2018-04-28 20:45:08 +00:00
|
|
|
name: "php{{ php_version }}-mcrypt"
|
2018-04-28 18:50:14 +00:00
|
|
|
state: present
|
2018-04-28 20:45:08 +00:00
|
|
|
when: is_debuntu and not is_ubuntu_18
|
2017-06-26 19:24:58 +00:00
|
|
|
|
2017-12-04 15:00:27 +00:00
|
|
|
# we need to install the rpm in order to get the dependencies
|
|
|
|
# but we only need to do this the first time
|
|
|
|
|
2018-10-28 17:22:47 +00:00
|
|
|
- name: Install 7 php packages (redhat)
|
2017-12-04 15:00:27 +00:00
|
|
|
package:
|
2018-10-28 17:22:47 +00:00
|
|
|
name:
|
|
|
|
- php
|
|
|
|
- php-gd
|
|
|
|
- php-json
|
|
|
|
- php-mysql
|
|
|
|
- php-curl
|
|
|
|
- php-intl
|
|
|
|
- php-mcrypt
|
|
|
|
# CentOS does not have a package for php-imagick
|
|
|
|
#- php-imagick
|
2017-12-04 15:00:27 +00:00
|
|
|
state: present
|
2017-05-30 02:37:12 +00:00
|
|
|
when: is_redhat
|
2017-06-26 19:24:58 +00:00
|
|
|
|
2018-10-28 20:44:32 +00:00
|
|
|
- name: Unpack {{ nextcloud_src_file }} to permanent location /opt/nextcloud
|
2017-12-04 15:00:27 +00:00
|
|
|
unarchive:
|
|
|
|
src: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
|
|
|
|
dest: "{{ nextcloud_prefix }}"
|
2018-10-28 20:44:32 +00:00
|
|
|
#creates: "{{ nextcloud_prefix }}/nextcloud/version.php"
|
|
|
|
when: nextcloud_force_install
|
2017-05-29 22:02:55 +00:00
|
|
|
|
2017-10-27 13:47:06 +00:00
|
|
|
- name: In CentOS, the following config dir is symlink to /etc/nextcloud
|
2017-12-04 15:00:27 +00:00
|
|
|
file:
|
|
|
|
path: /etc/nextcloud
|
|
|
|
state: directory
|
2017-05-30 02:37:12 +00:00
|
|
|
when: is_centos
|
2017-05-29 22:02:55 +00:00
|
|
|
|
2017-11-05 05:44:34 +00:00
|
|
|
- name: Add autoconfig file (CentOS)
|
2017-12-04 15:00:27 +00:00
|
|
|
template:
|
|
|
|
src: autoconfig.php.j2
|
|
|
|
dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php"
|
|
|
|
owner: "{{ apache_user }}"
|
|
|
|
group: "{{ apache_user }}"
|
|
|
|
mode: 0640
|
2017-05-30 02:37:12 +00:00
|
|
|
when: is_centos
|
2017-05-29 22:02:55 +00:00
|
|
|
|
2017-10-27 13:47:06 +00:00
|
|
|
- name: Make Apache owner
|
2017-12-04 15:00:27 +00:00
|
|
|
file:
|
|
|
|
path: "{{ nextcloud_prefix }}/nextcloud"
|
|
|
|
owner: "{{ apache_user }}"
|
|
|
|
group: "{{ apache_user }}"
|
|
|
|
recurse: yes
|
|
|
|
state: directory
|
2017-05-29 22:02:55 +00:00
|
|
|
|
|
|
|
- name: Create data directory library
|
2017-12-04 15:00:27 +00:00
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
owner: "{{ apache_user }}"
|
|
|
|
group: "{{ apache_user }}"
|
|
|
|
mode: 0750
|
|
|
|
state: directory
|
2017-05-29 22:02:55 +00:00
|
|
|
with_items:
|
|
|
|
- "{{ nextcloud_data_dir }}"
|
|
|
|
|
2018-10-28 20:44:32 +00:00
|
|
|
- name: Create MySQL database {{ nextcloud_dbname }} for Nextcloud
|
2017-12-04 15:00:27 +00:00
|
|
|
mysql_db:
|
|
|
|
name: "{{ nextcloud_dbname }}"
|
2017-05-29 22:02:55 +00:00
|
|
|
when: mysql_enabled and nextcloud_enabled
|
|
|
|
|
2018-10-28 20:44:32 +00:00
|
|
|
- name: Create username/password for Nextcloud database
|
2017-12-04 15:00:27 +00:00
|
|
|
mysql_user:
|
|
|
|
name: "{{ nextcloud_dbuser }}"
|
|
|
|
host: "{{ item }}"
|
|
|
|
password: "{{ nextcloud_dbpassword }}"
|
|
|
|
priv: "{{ nextcloud_dbname }}.*:ALL,GRANT"
|
2017-06-20 22:10:04 +00:00
|
|
|
with_items:
|
2018-02-06 21:44:06 +00:00
|
|
|
- "{{ nextcloud_dbhost }}"
|
|
|
|
- 127.0.0.1
|
|
|
|
- ::1
|
|
|
|
- localhost
|
2017-06-20 22:10:04 +00:00
|
|
|
when: mysql_enabled and nextcloud_enabled
|
|
|
|
|
|
|
|
|
2018-10-28 20:44:32 +00:00
|
|
|
- name: Restart Apache, to enable/disable http://box/nextcloud
|
2017-12-04 15:00:27 +00:00
|
|
|
service:
|
|
|
|
name: "{{ apache_service }}"
|
|
|
|
state: restarted
|
2017-12-04 15:14:05 +00:00
|
|
|
# when: nextcloud_enabled # taken care of by nextcloud_enabled.yml below
|
|
|
|
when: not nextcloud_enabled
|
2017-05-29 22:02:55 +00:00
|
|
|
|
|
|
|
# Enable nextcloud by copying template to httpd config
|
|
|
|
|
2017-05-30 02:37:12 +00:00
|
|
|
# following enables and disables
|
2017-11-05 05:44:34 +00:00
|
|
|
- include_tasks: nextcloud_enabled.yml
|
2017-05-29 22:02:55 +00:00
|
|
|
|
2018-10-15 11:01:09 +00:00
|
|
|
- name: Add 'nextcloud' to list of services at {{ iiab_ini_file }}
|
2017-11-27 01:12:09 +00:00
|
|
|
ini_file:
|
2018-10-15 10:13:57 +00:00
|
|
|
dest: "{{ iiab_ini_file }}"
|
2017-11-27 01:12:09 +00:00
|
|
|
section: Nextcloud
|
|
|
|
option: "{{ item.option }}"
|
|
|
|
value: "{{ item.value }}"
|
2017-05-29 22:02:55 +00:00
|
|
|
with_items:
|
2017-12-08 06:42:39 +00:00
|
|
|
- option: name
|
|
|
|
value: Nextcloud
|
|
|
|
- option: description
|
|
|
|
value: '"NextCloud is a local server-based facility for sharing files, photos, contacts, calendars, etc."'
|
|
|
|
- option: path
|
|
|
|
value: "{{ nextcloud_prefix }}/nextcloud"
|
|
|
|
- option: source
|
|
|
|
value: "{{ nextcloud_src_file }}"
|
|
|
|
- option: enabled
|
|
|
|
value: "{{ nextcloud_enabled }}"
|