The _nextcloud_ role originally handled setting up the PostgreSQL database and assumed that it was running on the same server as Nextcloud itself. I have factored out those tasks into their own role, _nextcloud-db_, which can be applied to a separate host. I have also introduced some new variables (`nextcloud_db_host`, `nextcloud_db_name`, `nextcloud_db_user`, and `nextcloud_db_password`), which can be used to specify how to connect to the database, if it is hosted remotely. Since these variables are used by both the _nextcloud_ and _nextcloud-db_ roles, they are actually defined in a separate role, _nextcloud-base_, upon which both depend.
69 lines
1.4 KiB
YAML
69 lines
1.4 KiB
YAML
- name: ensure rpmfusion repo is installed
|
|
package:
|
|
name: >-
|
|
https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ ansible_distribution_version }}.noarch.rpm
|
|
tags:
|
|
- install
|
|
|
|
- name: ensure required packages are installed
|
|
package:
|
|
name: '{{ nextcloud_packages }}'
|
|
state: present
|
|
tags:
|
|
- install
|
|
|
|
- name: check nextcloud version
|
|
command: >-
|
|
php -r 'require "/usr/share/nextcloud/version.php";
|
|
echo join(".", $OC_Version);'
|
|
check_mode: false
|
|
changed_when: false
|
|
register: check_nc_version
|
|
tags:
|
|
- always
|
|
- name: set nc_version fact
|
|
set_fact:
|
|
nc_version: '{{ check_nc_version.stdout }}'
|
|
tags:
|
|
- always
|
|
|
|
- name: ensure nextcloud is configured
|
|
template:
|
|
src: config.php.j2
|
|
dest: /etc/nextcloud/config.php
|
|
mode: '0600'
|
|
owner: apache
|
|
group: apache
|
|
tags:
|
|
- config
|
|
|
|
- name: ensure php-fpm is configured for nextcloud
|
|
template:
|
|
src: www.php-fpm.conf.j2
|
|
dest: /etc/php-fpm.d/www.conf
|
|
mode: '0644'
|
|
notify:
|
|
- restart php-fpm
|
|
tags:
|
|
- php-fpm-config
|
|
|
|
- name: ensure apache is configured to serve nextcloud
|
|
template:
|
|
src: nextcloud.httpd.conf.j2
|
|
dest: /etc/httpd/conf.d/nextcloud.conf
|
|
mode: '0644'
|
|
notify: reload httpd
|
|
tags:
|
|
- apache-config
|
|
|
|
- name: ensure php-fpm starts at boot
|
|
service:
|
|
name: php-fpm
|
|
enabled: true
|
|
|
|
- meta: flush_handlers
|
|
- name: ensure php-fpm service is running
|
|
service:
|
|
name: php-fpm
|
|
state: started
|