Commit initial

This commit is contained in:
Navas 2022-08-15 20:00:53 +02:00
commit 5f658f2ef4
7 changed files with 111 additions and 0 deletions

35
README.md Normal file
View file

@ -0,0 +1,35 @@
# Role : docker_element
## Services fournis
Installation d'une instance element sur un serveur docker_host
## Variables
Fournir les variables suivantes. Par exemple :
```yaml
docker_element_fqdn: element.libretic.fr
docker_element_data_dir: /data1
docker_element_service_id: monsite
docker_element_image_version: v1.11.2
docker_element_matrix_server_url: https://matrix.libretic.fr
docker_element_terms_link: https://libretic.fr/reglement-interieur
docker_element_terms_text: "Conditions d'utilisation et règlement intérieur"
```
| Option | Valeur par défaut | Description |
|-----------------------------------|-------------------|-------------------------------------------------------------------------------------------|
| docker_element_fqdn | | Nom de domaine, ou liste de noms de domaines, pour lequel le service element répond |
| docker_element_data_dir | | L'emplacement dans lequel se trouvent les volumes de donnees docker pour le service |
| docker_element_service_id | | Le nom de service souhaité : conditionne le nommage des volumes et le routage par traefik |
| docker_element_image_version | | Version de element et de l'image docker |
| docker_element_matrix_server_url | | URL du serveur matrix |
| docker_element_terms_link | | URL de consultation des conditions générales |
| docker_element_terms_text | | Texte du lien vers les conditions générales |

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_element_service_id }}/

8
meta/main.yml Normal file
View file

@ -0,0 +1,8 @@
galaxy_info:
author: Olivier Navas
description: Modèle d'installation Libretic pour element
license: GPL-3.0-only
min_ansible_version: 2.9
galaxy_tags: []
dependencies: []

15
tasks/main.yml Normal file
View file

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

26
templates/config.json Normal file
View file

@ -0,0 +1,26 @@
{
"disable_custom_urls": true,
"default_server_config": {
"m.homeserver": {
"base_url": "{{ docker_element_matrix_server_url }}"
},
"m.identity_server": {
"base_url": "https://vector.im"
}
},
"brand": "Element",
"bug_report_endpoint_url": "https://element.io/bugreports/submit",
"room_directory": {
"servers": [
"matrix.org",
"gitter.im",
"libera.chat"
]
},
"terms_and_conditions_links": [
{
"url": "{{ docker_element_terms_link }}",
"text": "{{ docker_element_terms_text }}"
}
]
}

View file

@ -0,0 +1,22 @@
# {{ ansible_managed }}
version: '3.1'
services:
element:
image: vectorim/element-web:{{ docker_element_image_version }}
volumes:
- ./config.json:/app/config.json
restart: always
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.{{ docker_element_service_id }}.entrypoints=web"
- "traefik.http.routers.{{ docker_element_service_id }}.rule=Host(`{{ docker_element_fqdn }}`)"
- "traefik.http.services.{{ docker_element_service_id }}.loadbalancer.server.port=80"
networks:
- traefik
networks:
traefik:
external: true