/ansible-role-matomo

Consensus Enterprises Ansible role for provisioning Matomo (mirrored from Gitlab)

Primary LanguageHTMLGNU Affero General Public License v3.0AGPL-3.0

Consensus Enterprises' Matomo

Consensus Enterprises' Ansible role for provisioning Matomo (formerly known as "Piwik").

Overview

This role does the following:

  1. Adds an Nginx site configuration.
  2. Gets an HTTPS certificate (if HTTPS support is enabled).
  3. Adds a configuration file for the application.
  4. Creates and populates the application's database.
  5. Installs the Debian package, automatically updating the database if the template is too old.
  6. Installs the recommended GeoIP data file, which can be enabled in the application's settings.

Requirements

  • A Debian-based OS (e.g. Ubuntu)
  • The Nginx Web server
  • MySQL (version 5.5 or greater) or MariaDB
  • A DNS record pointing to the instance (e.g. matomo.example.com)

We'd be happy to include support for other operating systems, Web servers or anything else. Patches welcome!

Role Variables

See defaults/main.yml for all role variables.

Dependencies

geerlingguy.certbot

geerlingguy/certbot is used for the HTTPS certificate management, installation and renewals.

See the default variables used when calling it.

Example Playbook

- hosts: servers
  become: true
  roles:
    - ansible-role-matomo
  vars:
    # https://github.com/ansible/ansible/issues/45852
    # https://www.toptechskills.com/ansible-tutorials-courses/how-to-fix-usr-bin-python-not-found-error-tutorial/
    ansible_python_interpreter: /usr/bin/python3
    # Main role variable settings.
    matomo_domain: matomo.example.com
    matomo_https_certificate_admin_email: tech@example.com
    matomo_superuser_password: YOUR_SUPER_SECRET_ADMIN_PASSWORD_FOR_THE_WEB_UI

Testing

Tests can be run like so (with more or fewer "v"s for verbosity):

ansible-playbook -vv --ask-become-pass --inventory TARGET_HOSTNAME, /path/to/this/role/tests/TEST_NAME.yml

Feel free to add your own tests in tests/, using existing ones as examples. Contributions welcome.

Issue Tracking

For bugs, feature requests, etc., please visit the issue tracker.

License

GNU AGPLv3

Author Information

Written by Colan Schwartz and other folks at Consensus Enterprises. To contact us, please use our Web contact form.