Newer
Older
---
# file: roles/matomo/tasks/install.yml
- block:
- name: Set facts without jail
set_fact:
webRoot: /var/www/matomo/{{ matomo.id }}
apacheUser: www-data
apacheLogDir: /var/log/apache2
when: matomo.jail is not defined
- name: Set facts with jail
set_fact:
webRoot: '{{ jailroot }}/{{ matomo.id }}/var/www/matomo'
apacheUser: '{{ matomo.id }}'
apacheLogDir: '{{ jailroot }}/{{ matomo.id }}/var/log/apache2'
when: matomo.jail is defined
- '{{ webRoot }}'
path: '{{ item }}'
state: directory
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
mode: 0775
- '{{ webRoot }}'
path: '{{ webRoot }}'
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
mode: g+w
recurse: yes
follow: no
repo: 'git@github.com:matomo-org/matomo.git'
dest: '{{ webRoot }}'
track_submodules: yes
force: yes
version: '{{ matomo_version }}'
GIT_LFS_SKIP_SMUDGE: 1
tags:
- deploy

jurgenhaas
committed
- name: Download plugins
unarchive:
src: '{{ item }}'
dest: '{{ webRoot }}/plugins'
remote_src: yes
with_items:
- https://plugins.matomo.org/api/2.0/plugins/LoginOIDC/download/0.1.4

jurgenhaas
committed
tags:
- deploy
src: config.ini.php
dest: '{{ webRoot }}/config/config.ini.php'
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
mode: 0664
command: update
working_dir: '{{ webRoot }}'
no_dev: yes
optimize_autoloader: yes
prefer_dist: yes
ignore_errors: yes
path: '{{ item }}'
state: directory
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
mode: 0775
- '{{ webRoot }}/tmp'
- name: Enable Plugins
command: '{{ webRoot }}/console plugin:activate {{ item }}'
become_user: '{{ apacheUser }}'
ignore_errors: yes
with_items: '{{ matomo_plugins }}'
tags:
- deploy
- name: Enable Extra Plugins
command: '{{ webRoot }}/console plugin:activate {{ item }}'
become_user: '{{ apacheUser }}'
ignore_errors: yes
with_items:
- LoginOIDC
tags:
- deploy
path: '{{ webRoot }}'
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
mode: a-w
recurse: yes
follow: no
path: '{{ webRoot }}/.git'
mode: og+w
recurse: yes
follow: no
mode: ug+w
recurse: yes
follow: no
name: matomo_{{ matomo.id }}
login_user: root
login_password: '{{ mysql_root_password|default("root") }}'
login_host: 127.0.0.1
login_port: '{{ matomo.db_port|default("3306") }}'
command: '{{ webRoot }}/console core:update --yes --no-interaction'
become_user: '{{ apacheUser }}'
- name: Ensure Log Directory
file:
path: /var/log/matomo
state: directory
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
mode: 0775
tags:
- cron
- name: Configure cron
cron:
name: Matomo Cron {{ matomo.id }}
minute: 20
job: cd /var/www/matomo/{{ matomo.id }} && ./console core:archive --url=https://{{ matomo.domain }}/ >> /var/log/matomo/{{ matomo.id }}.log 2>&1
user: '{{ apacheUser }}'
disabled: '{{ crons_disabled|default(false) }}'
tags:
- cron