Files
configpolicy/roles/nextcloud/tasks/main.yml
Dustin C. Hatch 7d7dda6061 r/nextcloud: Dynamically set version in config
Nextcloud thinks it needs to run the upgrade/migration tool if the
version number in its configuration file does not match the running
version.  It then updates the config file with the correct version. The
next time the configuration policy is applied, however, the version will
revert back to whatever is set in the template.  This will re-trigger
the upgrade notification.

To avoid this problem, we now set the version in the configuration file
dynamically.  Nextcloud writes its version number in a constant in
`version.php`.
2021-12-20 22:18:14 -06:00

84 lines
1.8 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 database user exists
become: true
become_user: postgres
postgresql_user:
name: nextcloud
password: '{{ nextcloud_db_password }}'
state: present
- name: ensure nextcloud database exists
become: true
become_user: postgres
postgresql_db:
name: nextcloud
owner: nextcloud
state: present
- 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