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

114 lines
3.5 KiB
YAML
Raw Permalink Normal View History

2022-12-22 19:18:27 +00:00
# vim: ft=yaml.ansible
2022-12-21 21:25:10 +00:00
---
2023-01-25 21:35:38 +00:00
- name: Create Nextcloud apache2 directory
2023-03-22 18:31:21 +00:00
ansible.builtin.file:
2023-01-25 21:35:38 +00:00
name: "{{ services.nextcloud.volume }}/apache2"
owner: root
mode: u=rwx,g=rx,o=rx
state: directory
- name: Create Nextcloud app directory
2023-03-22 18:31:21 +00:00
ansible.builtin.file:
2023-01-25 21:35:38 +00:00
name: "{{ services.nextcloud.volume }}/app"
owner: root
group: '33'
mode: u=rwx,g=rx,o=rx
state: directory
- name: Create Nextcloud PostgreSQL directory
2023-03-22 18:31:21 +00:00
ansible.builtin.file:
2023-01-25 21:35:38 +00:00
name: "{{ services.nextcloud.volume }}/postgres"
owner: '70'
mode: u=rwx,go=
2022-12-21 21:25:10 +00:00
state: directory
- name: Copy Apache2 config files
2023-03-22 18:31:21 +00:00
ansible.builtin.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
2023-03-22 18:31:21 +00:00
community.docker.docker_compose:
2022-12-21 21:25:10 +00:00
project_name: nextcloud
state: "{{ 'absent' if stop is defined and stop else 'present' }}"
2023-04-20 22:29:19 +00:00
restarted: "{{ stop is undefined or not stop }}"
2022-12-21 21:25:10 +00:00
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 }}
2023-01-14 18:25:13 +00:00
restart: always
2022-12-21 21:25:10 +00:00
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 }}
2023-01-14 18:25:13 +00:00
restart: always
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
app:
2023-01-03 21:30:22 +00:00
image: nextcloud:{{ services.nextcloud.version }}
2023-01-14 18:25:13 +00:00
restart: always
2022-12-21 21:25:10 +00:00
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 }}"
2023-01-14 17:45:25 +00:00
MAIL_FROM_ADDRESS: noreply
MAIL_DOMAIN: "{{ services.nextcloud.domain }}"
2023-01-14 18:12:34 +00:00
SMTP_AUTHTYPE: PLAIN
2023-01-14 17:45:25 +00:00
SMTP_HOST: postfix
SMTP_PORT: 587
2023-01-14 18:12:34 +00:00
TRUSTED_PROXIES: 172.16.3.2
OVERWRITEHOST: "{{ services.nextcloud.domain }}"
OVERWRITEPROTOCOL: https
OVERWRITECLIURL: https://{{ services.nextcloud.domain }}
NEXTCLOUD_INIT_LOCK: 'true'
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
2023-01-14 18:12:34 +00:00
cron:
image: nextcloud:{{ services.nextcloud.version }}
2023-01-14 18:25:13 +00:00
restart: always
2023-01-14 18:12:34 +00:00
entrypoint: /cron.sh
volumes:
- "{{ services.nextcloud.volume }}/app:/var/www/html:rw"
depends_on:
- app
networks:
2023-01-14 17:06:21 +00:00
postfix:
external: true
services:
external: true