roles/nextcloud: Switch to Fedora package

Fedora now includes a packaged version of Nextcloud.  This will be
_much_ easier to maintain than the tarball-based distribution method.
There are some minor differences in how the Fedora package works,
compared to the upstream tarball.  Notably, it puts the configuration
file in `/etc/` and makes it read-only, and it stores persistent data
separate from the application.  These differences require modifications
to the Apache and PHP-FPM configuration, but the package also included
examples to make this easier.  Since the `config.php` is read-only now,
it has to be managed by the configuration policy; it cannot be modified
by the Administration web UI.
This commit is contained in:
2021-06-24 19:58:14 -05:00
parent 0add34a9a3
commit b86e0d8f29
10 changed files with 583 additions and 73 deletions

View File

@@ -27,51 +27,25 @@
owner: nextcloud
state: present
- name: ensure nextcloud installation archive is available
become: false
delegate_to: localhost
get_url:
url: '{{ nextcloud_archive_url }}'
dest: roles/nextcloud/files/{{ nextcloud_archive_name }}
checksum: 'sha256:{{ nextcloud_archive_sha256 }}'
tags:
- unarchive
- name: ensure html directory permissions are set
file:
path: /var/www/html
- name: ensure nextcloud is configured
template:
src: config.php.j2
dest: /etc/nextcloud/config.php
mode: '0600'
owner: apache
group: apache
mode: '0755'
tags:
- config
- name: ensure nextcloud is installed
become: true
become_user: apache
unarchive:
src: '{{ nextcloud_archive_name }}'
dest: /var/www/html
extra_opts:
- --strip-components=1
- 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:
- upgrade nextcloud
- update nextcloud .htaccess
- restart php-fpm
tags:
- install
- unarchive
- name: ensure nextcloud data directories exist
file:
path: /var/www/html/{{ item.name }}
owner: apache
group: apache
mode: '{{ item.mode|d("0755") }}'
setype: httpd_sys_rw_content_t
state: directory
with_items:
- name: config
- name: custom_apps
- name: data
mode: '0770'
- php-fpm-config
- name: ensure apache is configured to serve nextcloud
template:
@@ -79,12 +53,15 @@
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