From 0aaf6fc1f2befcb2d8afddb348514dc28f59e5a0 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 18 Nov 2023 21:25:51 +0100 Subject: [PATCH] solved wordpress tracking bug --- playbook.yml | 11 ++++++++--- roles/docker-wordpress/tasks/main.yml | 14 ++++++++------ roles/nginx-matomo-tracking/Readme.md | 4 ++-- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/playbook.yml b/playbook.yml index 1cd6660f..5b26991b 100644 --- a/playbook.yml +++ b/playbook.yml @@ -74,11 +74,16 @@ - name: setup wordpress hosts hosts: wordpress become: true - roles: - - role: docker-wordpress + tasks: + - name: Include docker-wordpress role for each domain + include_role: + name: docker-wordpress vars: - domains: "{{wordpress_domains}}" + domain: "{{ item }}" http_port: 8003 + loop: "{{ wordpress_domains }}" + loop_control: + loop_var: item - name: setup mediawiki hosts hosts: mediawiki become: true diff --git a/roles/docker-wordpress/tasks/main.yml b/roles/docker-wordpress/tasks/main.yml index 6eece92d..838122ff 100644 --- a/roles/docker-wordpress/tasks/main.yml +++ b/roles/docker-wordpress/tasks/main.yml @@ -1,14 +1,16 @@ --- -- name: recieve wordpress certificates - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{item}} - loop: "{{domains}}" +- name: recieve wordpress certificates for {{domain}} + command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} + +- name: Activate NGINX matomo tracking for {{domain}} + include_role: + name: nginx-matomo-tracking + when: nginx_matomo_tracking_active - name: configure wordpress nginx configurations vars: client_max_body_size: "{{wordpress_max_upload_size}}" - domain: "{{item}}" - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{ item }}.conf - loop: "{{domains}}" + template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{ domain }}.conf notify: restart nginx - name: "create {{docker_compose_wordpress_path}}" diff --git a/roles/nginx-matomo-tracking/Readme.md b/roles/nginx-matomo-tracking/Readme.md index da18bc80..4d66428f 100644 --- a/roles/nginx-matomo-tracking/Readme.md +++ b/roles/nginx-matomo-tracking/Readme.md @@ -13,8 +13,8 @@ This Ansible role automates the integration of Matomo tracking code into Nginx-s ## Role Variables - `matomo_domain`: The domain of your Matomo installation. -- `base_domain`: The base domain of the website you wish to track. -- `matomo_site_id`: The site ID configured in your Matomo dashboard. +- `domain`: The domain of the website you wish to track. +- `matomo_auth_token`: Matomo auth token ## Dependencies - None. This role is designed to be included in Nginx server block configurations.