You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
3.6 KiB
YAML

---
- name: Install required dependencies
apt:
state: present
name:
# For Office / Video Previews
- ffmpeg
- libreoffice
# For SMB Access
- smbclient
# For SVG support
- libmagickcore-6.q16-6-extra
# PHP Dependencies
- php-apcu
- php-bcmath
- php-bz2
- php-curl
# - php-dom
# - php-fileinfo
- php-gd
- php-gmp
# - php-iconv
- php-imagick
- php-intl
- php-json
- php-mbstring
# - php-mcrypt
- php-mysql
# - php-posix
- php-redis
# - php-simplexml
- php-xml
# - php-xmlreader
# - php-xmlwriter
- php-zip
- name: Check if Nextcloud is already downloaded
stat:
path: "{{ nextcloud_installation_directory }}/index.php"
register: nextcloud_installed
check_mode: no
- name: Download Nextcloud
include_tasks: install.yml
when: not nextcloud_installed.stat.exists
- name: Create data directory
file:
state: directory
path: "{{ nextcloud_data_directory }}"
owner: "{{ system_user }}"
group: "{{ system_user }}"
mode: "u=rwx,g=rx,o="
- name: Install Nextcloud
become_user: "{{ system_user }}"
command: >-
/usr/bin/php occ maintenance:install
--database mysql
--database-name {{ database_name | quote }}
--database-user {{ database_user | quote }}
--database-pass {{ database_pass | quote }}
--admin-user {{ nextcloud_admin_user | quote }}
--admin-pass {{ nextcloud_admin_pass | quote }}
--data-dir {{ nextcloud_data_directory | quote }}
args:
chdir: "{{ nextcloud_installation_directory }}"
creates: "{{ nextcloud_config }}"
- name: Store additional Nextcloud configuration
copy:
content: "{{ import_config | to_nice_json }}\n"
dest: "{{ import_config_file }}"
owner: "{{ system_user }}"
group: "{{ system_user }}"
mode: u=rw,g=r,o=
register: import_config_file_task
tags:
- nextcloud_config
- name: Import additional Nextcloud configuration
become_user: "{{ system_user }}"
command: >-
/usr/bin/php occ
config:import
{{ import_config_file | quote }}
args:
chdir: "{{ nextcloud_installation_directory }}"
when: import_config_file_task.changed
tags:
- nextcloud_config
- name: Install Nextcloud apps
become_user: "{{ system_user }}"
command: >-
/usr/bin/php occ
app:install
{{ item | quote }}
args:
chdir: "{{ nextcloud_installation_directory }}"
register: nextcloud_apps_install_results
changed_when: "'already installed' not in nextcloud_apps_install_results.stdout"
failed_when: >-
nextcloud_apps_install_results.rc != 0 and
not (nextcloud_apps_install_results.rc == 1 and 'already installed' in nextcloud_apps_install_results.stdout)
loop: "{{ enabled_apps_list }}"
ignore_errors: yes # fail does not prevent further roll out
tags:
- nextcloud_apps
- name: Disable some Nextcloud apps
become_user: "{{ system_user }}"
command: >-
/usr/bin/php occ
app:disable
{{ item | quote }}
args:
chdir: "{{ nextcloud_installation_directory }}"
register: nextcloud_apps_install_results
changed_when: "'No such app enabled: ' not in nextcloud_apps_install_results.stdout"
failed_when: nextcloud_apps_install_results.rc != 0
loop: "{{ disabled_apps_list }}"
ignore_errors: yes # fail does not prevent further roll out
tags:
- nextcloud_apps
- name: Add background cron job
cron:
name: "nextcloud cron for {{ domain }}"
minute: "*/5"
job: >-
sudo -u {{ system_user | quote }}
/usr/bin/php
--define apc.enable_cli=1
--file {{ nextcloud_installation_directory | quote }}/cron.php