Commit initial

This commit is contained in:
Navas 2022-08-05 15:29:05 +02:00
commit 84940b7509
6 changed files with 110 additions and 0 deletions

42
README.md Normal file
View file

@ -0,0 +1,42 @@
# Role : docker_nextcloud
## Services fournis
- main.yml : Installation de nextcloud sur un serveur docker_host
## Variables
Fournir les variables suivantes. Par exemple :
```yaml
docker_nextcloud_fqdn: nextcloud.example.com
docker_nextcloud_version: 23.0.3-apache
docker_nextcloud_data_dir: /data1
docker_nextcloud_service_id: nextcloud
docker_nextcloud_db: nextcloud
docker_nextcloud_db_user: nextcloud
docker_nextcloud_db_password: motdepassebdd
docker_nextcloud_smtp_host: smtp.example.com
docker_nextcloud_php_ini:
php_upload_max_filesize = 512M
php_post_max_size = 512M
php_max_execution_time = 200
php_memory_limit = 1024M
```
| Option | Valeur par défaut | Description |
|------------------------------|-------------------|--------------------------------------------------------------------------------------------|
| docker_nextcloud_fqdn | | Le fqdn pour accéder à nextcloud |
| docker_nextcloud_version | | Version de l'image nextcloud |
| docker_nextcloud_data_dir | | L'emplacement dans lequel se trouvent les volumes de donnees docker pour le service |
| docker_nextcloud_service_id | | Le nom de service souhaité : conditionne le nommage des dossiers et le routage par traefik |
| docker_nextcloud_db | | Le nom de la base de données |
| docker_nextcloud_db_user | | Le nom du user propriétaire de la base de données |
| docker_nextcloud_db_password | | Le mot de passe du user propriétaire de la base de données |
| docker_nextcloud_smtp_host | | FQDN du serveur smtp pour l'envoi de mails par nextcloud |
| docker_nextcloud_php_ini | | Une liste de variables d'environnement pour la configuration de healtchecks |
## Configuration de nextcloud
A compléter

0
defaults/main.yml Normal file
View file

5
handlers/main.yml Normal file
View file

@ -0,0 +1,5 @@
- name: docker-compose-up
shell: |
docker-compose up -d
args:
chdir: /opt/{{ docker_nextcloud_service_id }}/

15
tasks/main.yml Normal file
View file

@ -0,0 +1,15 @@
- name: docker directory
file:
path: /opt/{{ docker_nextcloud_service_id }}/
state: directory
- name: prepare docker-compose.yml
template:
src: "{{ item }}"
dest: /opt/{{ docker_nextcloud_service_id }}/
with_items:
- docker-compose.yml
- php.ini
notify: docker-compose-up

View file

@ -0,0 +1,46 @@
# {{ ansible_managed }}
version: '3.1'
services:
nextcloud:
image: nextcloud:{{ docker_nextcloud_version }}
volumes:
- {{ docker_nextcloud_data_dir }}/{{ docker_nextcloud_service_id }}/nextcloud:/var/www/html
- ./php.ini:/usr/local/etc/php/php.ini
restart: always
depends_on:
- db
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.{{ docker_nextcloud_service_id }}.entrypoints=web"
- "traefik.http.routers.{{ docker_nextcloud_service_id }}.rule=Host(`{{ docker_nextcloud_fqdn }}`)"
- "traefik.http.services.{{ docker_nextcloud_service_id }}.loadbalancer.server.port=80"
networks:
- nextcloud
- traefik
environment:
- POSTGRES_HOST=db
- POSTGRES_DB={{ docker_nextcloud_db }}
- POSTGRES_USER={{ docker_nextcloud_db_user }}
- POSTGRES_PASSWORD={{ docker_nextcloud_db_password }}
- SMTP_HOST={{ docker_nextcloud_smtp_host }}
db:
image: postgres:13
restart: always
volumes:
- {{ docker_nextcloud_data_dir }}/{{ docker_nextcloud_service_id }}/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB={{ docker_nextcloud_db }}
- POSTGRES_USER={{ docker_nextcloud_db_user }}
- POSTGRES_PASSWORD={{ docker_nextcloud_db_password }}
networks:
- nextcloud
networks:
traefik:
external: true
nextcloud:
internal: true

2
templates/php.ini Normal file
View file

@ -0,0 +1,2 @@
# {{ ansible_managed }}
{{ docker_nextcloud_php_ini }}