60 lines
1.8 KiB
YAML
60 lines
1.8 KiB
YAML
---
|
|
- name: "set local variables from overrides and defaults"
|
|
set_fact:
|
|
nextcloud: "{{ (nextcloud_defaults | combine(nextcloud_override, recursive=True)) if nextcloud_override else nextcloud_defaults }}"
|
|
|
|
- name: ensure that path exists
|
|
file:
|
|
path: "{{ path }}/config/nextcloud"
|
|
state: directory
|
|
|
|
- name: template compose
|
|
template:
|
|
src: compose.yml.j2
|
|
dest: "{{ path }}/compose.yml"
|
|
|
|
- name: template nc config
|
|
template:
|
|
src: importconfig.json.j2
|
|
dest: "{{ path }}/config/nextcloud/importconfig.json"
|
|
register: _importconfig
|
|
|
|
- block:
|
|
- name: recreate nextcloud so the configfile gets updated
|
|
community.docker.docker_compose_v2:
|
|
project_src: "{{ path }}"
|
|
project_name: "{{ role_name }}"
|
|
state: present
|
|
recreate: always
|
|
services: "nextcloud"
|
|
wait: true
|
|
|
|
- name: import config
|
|
community.docker.docker_container_exec:
|
|
container: "{{ nextcloud_container }}"
|
|
chdir: "/var/www/html/"
|
|
user: "www-data"
|
|
command: "php occ config:import /tmp/importconfig.json"
|
|
when: "_importconfig.changed or 'installed: false' in nextcloud_status_check.stdout"
|
|
|
|
- name: ensure containers are running
|
|
community.docker.docker_compose_v2:
|
|
project_src: "{{ path }}"
|
|
project_name: "{{ role_name }}"
|
|
state: "present"
|
|
pull: "always"
|
|
wait: true
|
|
services: >-
|
|
{{ ['db', 'redis', 'nextcloud'] +
|
|
(['collabora'] if nextcloud.collabora.url | default('') else []) +
|
|
(['drawio'] if nextcloud.drawio.url | default('') else []) }}
|
|
register: _compose_result
|
|
|
|
- name: import config
|
|
community.docker.docker_container_exec:
|
|
container: "{{ nextcloud_container }}"
|
|
chdir: "/var/www/html/"
|
|
user: "www-data"
|
|
command: "php occ config:import /tmp/importconfig.json"
|
|
when: "_importconfig.changed or 'installed: false' in nextcloud_status_check.stdout"
|