This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
pi-ansible/roles/docker/tasks/services/nextcloud.yml

91 lines
2.7 KiB
YAML

# vim: ft=yaml.ansible
---
- name: Create Nextcloud volume directories
file:
name: "{{ services.nextcloud.volume }}/{{ dir.name }}"
owner: "{{ dir.owner | default('root') }}"
mode: "{{ dir.mode | default('u=rwx,g=rx,o=rx') }}"
state: directory
loop:
- name: apache2
- name: app
- name: postgres
owner: '70'
mode: u=rwx,go=
loop_control:
loop_var: dir
- name: Copy Apache2 config files
copy:
src: "nextcloud/apache2/{{ file }}"
dest: "{{ services.nextcloud.volume }}/apache2/{{ file }}"
owner: root
mode: u=rw,g=r,o=r
loop:
- apache2.conf
- remoteip.conf
loop_control:
loop_var: file
- name: Deploy Nextcloud with Docker Compose
docker_compose:
project_name: nextcloud
pull: true
definition:
version: '3.8'
services:
postgres:
image: "postgres:{{ services.nextcloud.postgres_version }}"
restart: unless-stopped
environment:
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: "{{ secrets.nextcloud.postgres_pw }}"
volumes:
- "{{ services.nextcloud.volume }}/postgres:/var/lib/postgresql/data:rw"
redis:
image: "redis:{{ services.nextcloud.redis_version }}"
restart: unless-stopped
command: "redis-server --requirepass {{ secrets.nextcloud.redis_pw }}"
tmpfs:
- /var/lib/redis
cron:
image: "nextcloud:{{ services.nextcloud.version }}"
restart: unless-stopped
entrypoint: /cron.sh
volumes:
- "{{ services.nextcloud.volume }}/app:/var/www/html:rw"
depends_on:
- postgres
- redis
app:
image: "nextcloud:{{ services.nextcloud.version }}"
restart: unless-stopped
environment:
POSTGRES_HOST: postgres
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: "{{ secrets.nextcloud.postgres_pw }}"
REDIS_HOST: redis
REDIS_HOST_PASSWORD: "{{ secrets.nextcloud.redis_pw }}"
PHP_MEMORY_LIMIT: 2G
PHP_UPLOAD_LIMIT: 16G
networks:
- default
- services
volumes:
- "{{ services.nextcloud.volume }}/app:/var/www/html:rw"
- "{{ services.nextcloud.volume }}/apache2/apache2.conf:/etc/apache2/apache2.conf:ro"
- "{{ services.nextcloud.volume }}/apache2/remoteip.conf:/etc/apache2/conf-enabled/remoteip.conf:ro"
depends_on:
- postgres
- redis
networks:
services:
external: true