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_services/tasks/services/nextcloud.yml

96 lines
2.8 KiB
YAML
Raw Normal View History

2022-12-22 19:18:27 +00:00
# vim: ft=yaml.ansible
2022-12-21 21:25:10 +00:00
---
- name: Create Nextcloud volume directories
file:
name: "{{ services.nextcloud.volume }}/{{ dir.name }}"
owner: "{{ dir.owner | default('root') }}"
2022-12-26 11:45:54 +00:00
mode: "{{ dir.mode | default('u=rwx,g=rx,o=rx') }}"
2022-12-21 21:25:10 +00:00
state: directory
loop:
- name: apache2
2022-12-26 11:45:54 +00:00
- name: app
- name: postgres
owner: '70'
mode: u=rwx,go=
2022-12-21 21:25:10 +00:00
loop_control:
2022-12-22 16:58:48 +00:00
loop_var: dir
2022-12-21 21:25:10 +00:00
- name: Copy Apache2 config files
copy:
2023-01-03 21:30:22 +00:00
src: nextcloud/apache2/{{ file }}
2022-12-21 21:25:10 +00:00
dest: "{{ services.nextcloud.volume }}/apache2/{{ file }}"
2022-12-23 14:54:29 +00:00
owner: root
2022-12-22 16:58:48 +00:00
mode: u=rw,g=r,o=r
2022-12-21 21:25:10 +00:00
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:
2022-12-26 11:45:54 +00:00
postgres:
2023-01-03 21:30:22 +00:00
image: postgres:{{ services.nextcloud.postgres_version }}
2022-12-21 21:25:10 +00:00
restart: unless-stopped
environment:
2022-12-26 11:45:54 +00:00
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: "{{ secrets.nextcloud.postgres_pw }}"
2022-12-21 21:25:10 +00:00
volumes:
2022-12-26 11:45:54 +00:00
- "{{ services.nextcloud.volume }}/postgres:/var/lib/postgresql/data:rw"
2022-12-21 21:25:10 +00:00
redis:
2023-01-03 21:30:22 +00:00
image: redis:{{ services.nextcloud.redis_version }}
2022-12-21 21:25:10 +00:00
restart: unless-stopped
2023-01-03 21:30:22 +00:00
command: redis-server --requirepass {{ secrets.nextcloud.redis_pw }}
2022-12-21 21:25:10 +00:00
tmpfs:
- /var/lib/redis
cron:
2023-01-03 21:30:22 +00:00
image: nextcloud:{{ services.nextcloud.version }}
2022-12-21 21:25:10 +00:00
restart: unless-stopped
entrypoint: /cron.sh
volumes:
2022-12-26 11:45:54 +00:00
- "{{ services.nextcloud.volume }}/app:/var/www/html:rw"
2022-12-21 21:25:10 +00:00
depends_on:
2022-12-26 11:45:54 +00:00
- postgres
2022-12-21 21:25:10 +00:00
- redis
app:
2023-01-03 21:30:22 +00:00
image: nextcloud:{{ services.nextcloud.version }}
2022-12-21 21:25:10 +00:00
restart: unless-stopped
environment:
2022-12-26 11:45:54 +00:00
POSTGRES_HOST: postgres
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: "{{ secrets.nextcloud.postgres_pw }}"
2022-12-21 21:25:10 +00:00
REDIS_HOST: redis
2022-12-22 19:18:27 +00:00
REDIS_HOST_PASSWORD: "{{ secrets.nextcloud.redis_pw }}"
2022-12-21 21:25:10 +00:00
PHP_MEMORY_LIMIT: 2G
PHP_UPLOAD_LIMIT: 16G
networks:
2022-12-28 17:24:27 +00:00
default:
2023-01-14 17:06:21 +00:00
postfix:
2022-12-28 17:24:27 +00:00
services:
aliases:
- nextcloud
2022-12-21 21:25:10 +00:00
volumes:
2022-12-26 11:45:54 +00:00
- "{{ services.nextcloud.volume }}/app:/var/www/html:rw"
2022-12-21 21:25:10 +00:00
- "{{ 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:
2022-12-26 11:45:54 +00:00
- postgres
2022-12-21 21:25:10 +00:00
- redis
networks:
2023-01-14 17:06:21 +00:00
postfix:
external: true
services:
external: true