Refactored and solved matomo variable bug

This commit is contained in:
Kevin Veen-Birkenbach 2025-02-17 11:04:40 +01:00
parent 62f9bab052
commit 326f048639
10 changed files with 31 additions and 34 deletions

View File

@ -1,3 +1,5 @@
# This file is also used by docker-matrix-compose
- name: Display all database variables
debug:
msg: |

View File

@ -1,6 +1,6 @@
# Docker Matomo Role
This Ansible role deploys a Matomo analytics platform instance using Docker.
This Ansible role deploys a [Matomo](https://matomo.org/) analytics platform instance using Docker.
## Requirements
@ -16,17 +16,8 @@ This Ansible role deploys a Matomo analytics platform instance using Docker.
- `http_port`: The host port that Matomo will be accessible on.
- `matomo_database_password`: Password for the Matomo database.
## Dependencies
- `nginx-docker-reverse-proxy`: An Ansible role for configuring the reverse proxy.
## Example Playbook
```yaml
- hosts: servers
roles:
- { role: docker-matomo, domain: 'example.com', http_port: 8080 }
```
## AI Generated
This script was created with the help of ChatGPT. The full conversation is [here](https://chat.openai.com/share/49e0c7e4-a2af-4a04-adad-7a735bdd85c4) available.
## Author
- [Kevin Veen-Birkenbach](https://www.veen.world/)

View File

@ -2,6 +2,7 @@
application_id: "matomo"
database_type: "mariadb"
database_password: "{{matomo_database_password}}"
domain: "{{domains.matomo}}"
# Disable matomo tracking for matomo, because otherwise recursiv loading technics would be neccessary
# global_matomo_tracking_enabled: false

View File

@ -10,4 +10,4 @@
when: enable_central_database | bool
- name: "include seed-database-to-backup.yml"
include_tasks: seed-database-to-backup.yml
include_tasks: ""{{ playbook_dir }}/roles/backup-docker-to-local/tasks/seed-database-to-backup.yml"

View File

@ -3,8 +3,8 @@
include_role:
name: docker-central-database
- name: "include tasks create-proxy-with-domain-replace.yml"
include_tasks: create-proxy-with-domain-replace.yml
- name: "include tasks setup-domain.yml with {{domain}}"
include_tasks: setup-domain.yml
loop: "{{ mybb_domains + [source_domain] }}"
loop_control:
loop_var: domain

View File

@ -0,0 +1,13 @@
# Recieves https certificate and setup proxy with domain replace
- name: "include role receive certbot certificate"
include_role:
name: nginx-https-recieve-certificate
- name: configure {{domain}}.conf
template:
src: "roles/nginx-docker-reverse-proxy/templates/domain.conf.j2"
dest: "{{nginx.directories.http.servers}}{{domain}}.conf"
notify: restart nginx
vars:
nginx_docker_reverse_proxy_extra_configuration: "sub_filter '{{source_domain}}' '{{domain}}';"

View File

@ -1,7 +1,7 @@
- name: Activate Global Matomo tracking
include_role:
name: nginx-global-matomo
when: global_matomo_tracking_enabled | bool and domain is defined # @toto: Do I try run without is defined checking for domain
when: global_matomo_tracking_enabled | bool and domain is defined # @todo: Do I try run without is defined checking for domain
- name: Activate Global CSS
include_role:

View File

@ -1,5 +0,0 @@
- name: configure {{domain}}.conf
template:
src: "roles/nginx-docker-reverse-proxy/templates/domain.conf.j2"
dest: "{{nginx.directories.http.servers}}{{domain}}.conf"
notify: restart nginx

View File

@ -1,8 +0,0 @@
- name: "include role receive certbot certificate"
include_role:
name: nginx-https-recieve-certificate
- name: "include task create-domain-conf.yml"
include_tasks: create-domain-conf.yml
vars:
nginx_docker_reverse_proxy_extra_configuration: "sub_filter '{{source_domain}}' '{{domain}}';"

View File

@ -2,8 +2,11 @@
include_role:
name: nginx-https-recieve-certificate
- name: "include task create-domain-conf.yml"
include_tasks: create-domain-conf.yml
- name: "copy nginx domain configuration to {{nginx.directories.http.servers}}{{domain}}.conf"
template:
src: "roles/nginx-docker-reverse-proxy/templates/domain.conf.j2"
dest: "{{nginx.directories.http.servers}}{{domain}}.conf"
notify: restart nginx
- name: include the docker-oauth2-proxy role
include_role: