1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/nextcloud/tasks/main.yml

142 lines
4 KiB
YAML
Raw Normal View History

2017-05-29 22:02:55 +00:00
# we need to install the rpm in order to get the dependencies
# but we only need to do this the first time
- name: See if the nextcloud startup page exists
stat: path={{ nextcloud_prefix }}/nextcloud/index.php
register: nextcloud_page
# but we use the tar file to get the latest version
- name: Get the nextcloud software
get_url: url={{ nextcloud_dl_url }}/{{ nextcloud_src_file }} dest={{ downloads_dir }}/{{ nextcloud_src_file }}
when: internet_available
async: 900
poll: 15
2017-05-29 22:02:55 +00:00
tags:
- download
- name: ubuntu and debian treat names differently
package: name={{ item }} state=present
with_items:
- libapache2-mod-php{{ php_version }}
- php{{ php_version }}-mbstring
- php{{ php_version }}-zip
when: is_debian
- name: ubuntu and debian treat names differently
package: name={{ item }} state=present
with_items:
2017-06-19 01:16:28 +00:00
- libapache2-mod-php
- php-imagick
- php-zip
- php-mbstring
when: is_ubuntu
- name: Install list of packages for debuntu
package: name={{ item }} state=present
with_items:
2017-05-30 02:37:12 +00:00
- php{{ php_version }}-gd
- php{{ php_version }}-json
- php{{ php_version }}-mysql
- php{{ php_version }}-curl
- php{{ php_version }}-intl
- php{{ php_version }}-mcrypt
when: is_debuntu
- name: Install list of packages
package: name={{ item }} state=present
with_items:
- php
2017-05-30 02:37:12 +00:00
- php-gd
- php-json
- php-mysql
- php-curl
- php-intl
- php-mcrypt
# centos does not have a package for php-imagick
# - php-imagick
2017-05-30 02:37:12 +00:00
when: is_redhat
2017-05-29 22:02:55 +00:00
- name: Copy it to permanent location /opt
unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }}
2017-05-29 22:02:55 +00:00
dest={{ nextcloud_prefix }}
creates={{ nextcloud_prefix }}/nextcloud/version.php
when: not is_F18
# ansible 1.4.1 does not have "creates"
- name: Copy it to permanent location /opt
unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }}
2017-05-29 22:02:55 +00:00
dest={{ nextcloud_prefix }}
when: is_F18
- name: in Centos, the following config dir is symlink to /etc/nextcloud
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
- name: Add autoconfig file
template: src=autoconfig.php.j2
dest={{ nextcloud_prefix }}/nextcloud/config/autoconfig.php
owner={{ apache_user }}
group={{ apache_user }}
2017-05-29 22:02:55 +00:00
mode=0640
2017-05-30 02:37:12 +00:00
when: is_centos
2017-05-29 22:02:55 +00:00
- name: Make apache owner
file: path={{ nextcloud_prefix }}/nextcloud
owner={{ apache_user }}
group={{ apache_user }}
2017-05-29 22:02:55 +00:00
recurse=yes
state=directory
- name: Create data directory library
file: path={{ item }}
mode=0750
owner={{ apache_user }}
group={{ apache_user }}
2017-05-29 22:02:55 +00:00
state=directory
with_items:
- "{{ nextcloud_data_dir }}"
- name: Create a mysql database for nextcloud
mysql_db: name={{ nextcloud_dbname }}
when: mysql_enabled and nextcloud_enabled
- name: Create a user to access the nextcloud database
mysql_user: name={{ nextcloud_dbuser }} host={{ item }} password={{ nextcloud_dbpassword }} priv={{ nextcloud_dbname }}.*:ALL,GRANT
with_items:
- "{{ nextcloud_dbhost }}"
- 127.0.0.1
- ::1
- localhost
when: mysql_enabled and nextcloud_enabled
2017-05-29 22:02:55 +00:00
- name: Restart apache, so it picks up the new aliases
service: name={{ apache_service }} state=restarted
when: not nextcloud_enabled
# Enable nextcloud by copying template to httpd config
2017-05-30 02:37:12 +00:00
# following enables and disables
2017-05-29 22:02:55 +00:00
- include: nextcloud_enabled.yml
- name: Add nextcloud to service list
ini_file: dest='{{ service_filelist }}'
section=nextcloud
option='{{ item.option }}'
value='{{ item.value }}'
with_items:
- 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 }}"