Première version
This commit is contained in:
commit
ddd3784a0f
9 changed files with 139 additions and 0 deletions
51
README.md
Normal file
51
README.md
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# Role : docker_matomo
|
||||||
|
|
||||||
|
|
||||||
|
## Services fournis
|
||||||
|
|
||||||
|
- main.yml : Installation d'une instance matomo sur un serveur docker_host
|
||||||
|
- configure_reverse_proxy.yml : Configuration d'un reverse proxy préalablement installé par le role reverse_proxy
|
||||||
|
|
||||||
|
|
||||||
|
## Variables
|
||||||
|
|
||||||
|
Fournir les variables suivantes. Par exemple :
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
docker_matomo_fqdn: matomo.libretic.fr
|
||||||
|
docker_matomo_data_dir: /data1
|
||||||
|
docker_matomo_service_id: matomo
|
||||||
|
docker_matomo_image_version: x.y.z
|
||||||
|
docker_matomo_db_name: matomodb
|
||||||
|
docker_matomo_db_user: user_proprietaire_bdd
|
||||||
|
docker_matomo_db_password: mdp_proprietaire_bdd
|
||||||
|
docker_matomo_rp_cert: LE
|
||||||
|
docker_matomo_rp_docker_host: machine.domaine.local
|
||||||
|
docker_matomo_rp_access_policy: OpenAccessPolicy
|
||||||
|
docker_matomo_rp_indexing: BlockCrawlerIndexing
|
||||||
|
docker_matomo_rp_waf: On
|
||||||
|
```
|
||||||
|
|
||||||
|
| Option | Valeur par défaut | Description |
|
||||||
|
|--------------------------------|-------------------|-------------------------------------------------------------------------------------------|
|
||||||
|
| docker_matomo_fqdn | | Nom de domaine pour lequel le service matomo répond |
|
||||||
|
| docker_matomo_data_dir | | L'emplacement dans lequel se trouvent les volumes de donnees docker pour le service |
|
||||||
|
| docker_matomo_service_id | | Le nom de service souhaité : conditionne le nommage des volumes et le routage par traefik |
|
||||||
|
| docker_matomo_image_version | | Version de matomo et de l'image docker |
|
||||||
|
| docker_matomo_db_name | | Nom de la base de données |
|
||||||
|
| docker_matomo_db_user | | Nom du proprietaire_de la base |
|
||||||
|
| docker_matomo_db_password | | MDP du proprietaire_de la base |
|
||||||
|
| docker_matomo_rp_docker_host | | pour configure_reverse_proxy.yml: fqdn de la machine contenant le conteneur docker |
|
||||||
|
| docker_matomo_rp_cert | LE | Type de certificat pour le reverse proxy (LE = letsencrypt) |
|
||||||
|
| docker_matomo_rp_access_policy | | Modèle d'autorisation d'accès du reverse proxy |
|
||||||
|
| docker_matomo_rp_indexing | | Stratégie du reverse proxy vis à vis des robots |
|
||||||
|
| docker_matomo_rp_waf | | Activation websecurity du reverse proxy |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Poursuite de l'installation dans matomo
|
||||||
|
|
||||||
|
Après le premier lancement :
|
||||||
|
- créer le compte administrateur interne de matomo depuis la page d'administration
|
||||||
|
|
1
defaults/main.yml
Normal file
1
defaults/main.yml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
docker_matomo_rp_cert: LE
|
10
handlers/main.yml
Normal file
10
handlers/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
- name: docker-compose-up
|
||||||
|
shell: |
|
||||||
|
docker-compose up -d
|
||||||
|
args:
|
||||||
|
chdir: /opt/{{ docker_matomo_service_id }}/
|
||||||
|
|
||||||
|
- name: reverse-proxy-reload
|
||||||
|
service:
|
||||||
|
name: apache2
|
||||||
|
state: reloaded
|
13
tasks/configure_reverse_proxy.yml
Normal file
13
tasks/configure_reverse_proxy.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
- name: prepare reverse_proxy
|
||||||
|
template:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: /etc/apache2/vhosts.d/{{ docker_matomo_fqdn }}/
|
||||||
|
with_items:
|
||||||
|
- 0_vhost.conf
|
||||||
|
- 1_vhost_additional.conf
|
||||||
|
- 2_mds_exclusion.conf
|
||||||
|
notify: reverse-proxy-reload
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
14
tasks/main.yml
Normal file
14
tasks/main.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
- name: docker directory
|
||||||
|
file:
|
||||||
|
path: /opt/{{ docker_matomo_service_id }}/
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: prepare docker-compose.yml
|
||||||
|
template:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: /opt/{{ docker_matomo_service_id }}/
|
||||||
|
with_items:
|
||||||
|
- docker-compose.yml
|
||||||
|
notify: docker-compose-up
|
||||||
|
|
||||||
|
|
2
templates/0_vhost.conf
Normal file
2
templates/0_vhost.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
Use vhost_HTTPS_Generic {{ docker_matomo_fqdn }} {{ docker_matomo_rp_cert }} http {{ docker_matomo_rp_docker_host }} info {{ docker_matomo_rp_access_policy }} {{ docker_matomo_rp_indexing }} {{ docker_matomo_rp_waf }}
|
1
templates/1_vhost_additional.conf
Normal file
1
templates/1_vhost_additional.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# {{ ansible_managed }}
|
2
templates/2_mds_exclusion.conf
Normal file
2
templates/2_mds_exclusion.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
45
templates/docker-compose.yml
Normal file
45
templates/docker-compose.yml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
version: '3.1'
|
||||||
|
services:
|
||||||
|
matomo:
|
||||||
|
image: matomo:{{ docker_matomo_image_version }}
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- {{ docker_matomo_data_dir }}/{{ docker_matomo_service_id }}/matomo_html:/var/www/html
|
||||||
|
environment:
|
||||||
|
MATOMO_DATABASE_HOST: db
|
||||||
|
MATOMO_DATABASE_ADAPTER: mysql
|
||||||
|
MATOMO_DATABASE_TABLES_PREFIX: matomo_
|
||||||
|
MATOMO_DATABASE_DBNAME: "{{ docker_matomo_db_name }}"
|
||||||
|
MATOMO_DATABASE_USERNAME: "{{ docker_matomo_db_user }}"
|
||||||
|
MATOMO_DATABASE_PASSWORD: "{{ docker_matomo_db_password }}"
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=traefik"
|
||||||
|
- "traefik.http.routers.{{ docker_matomo_service_id }}.entrypoints=web"
|
||||||
|
- "traefik.http.routers.{{ docker_matomo_service_id }}.rule=Host(`{{ docker_matomo_fqdn }}`)"
|
||||||
|
- "traefik.http.services.{{ docker_matomo_service_id }}.loadbalancer.server.port=80"
|
||||||
|
networks:
|
||||||
|
- traefik
|
||||||
|
- matomo
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mariadb:10.8.2-rc-focal
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- {{ docker_matomo_data_dir }}/{{ docker_matomo_service_id }}/mariadb:/var/lib/mysql
|
||||||
|
environment:
|
||||||
|
# genere un mdp root et l'affiche au demarrage sur stdout
|
||||||
|
MARIADB_RANDOM_ROOT_PASSWORD: "yes"
|
||||||
|
MARIADB_DATABASE: "{{ docker_matomo_db_name }}"
|
||||||
|
MARIADB_USER: "{{ docker_matomo_db_user }}"
|
||||||
|
MARIADB_PASSWORD: "{{ docker_matomo_db_password }}"
|
||||||
|
networks:
|
||||||
|
- matomo
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
matomo:
|
||||||
|
internal: true
|
Loading…
Reference in a new issue