Plausible Analytics is a simple, open source, lightweight (< 1 KB) and privacy-friendly alternative to Google Analytics.
Installs Plausible as Docker container. Based on plausible's self-hosted documentation.
Docker Engine, docker
and docker-compose
Python packages need to be installed on the host.
For example, use geerlingguy.docker
and geerlingguy.pip
to install.
Most variables are counterparts of Plausible variables described in their Documentation.
Passwords and plausible_secret_key
should be (at least) included in an ansible vault!
You should at least overwrite default values for some basic variables:
docker_user: root
plausible_url: "plausible.{{ inventory_hostname }}"
plausible_db_password: postgres
plausible_secret_key: replace-me
By default Plausible won't be installed, until you set install_plausible
to true.
We set it per host to define, on which hosts we want to serve Plausible.
You may want to disable public registration. Possible values are
true
false
invite_only
(default))
plausible_disable_registration: invite_only
If you want Plausible to send emails through a smtp relay server (use ansible vault):
plausible_mail: "plausible@{{ inventory_hostname }}"
plausible_use_smtp: true
plausible_smtp_host:
plausible_smtp_port:
plausible_smtp_user:
plausible_smtp_pwd:
plausible_smtp_ssl: true
If you want to use Google Search Console or Google Analytics import you need to follow the Plausible Documentation and change some variables:
plausible_use_googlesearchintegration: false
plausible_google_client_id:
plausible_google_client_secret:
Using Traefik? The following labels are passed to the frontend Plausible container:
labels:
traefik.enable: {{ plausible_use_traefik }}
traefik.http.routers.plausible.rule: "Host(`{{ plausible_url }}`)"
traefik.http.services.plausible.loadbalancer.server.port: "8000"
plausible_use_traefik: true
If you want to update Plausible, we just need to pull the new images:
plausible_pull_images: missing
plausible_recreate: auto
If you want to uninstall Plausible (shutdown, delete container, delete configuration) just set ìnstall_plausible
to false.
Additionally, you could remove the volumes. Be careful, it will delete all Plausible data!
plausible_remove_volumes: false # !! deletes data if true !!
Some variables to fit install to your environment:
docker_user: root
plausible_dir: /var/docker/plausible
plausible_stack_name: plausible
plausible_state: present
None.
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
---
- name: Install Plausible Web Analytics
hosts: docker
become: true
vars_files:
- vars/docker_vars.yml # sets `docker_user`
- vars/plausible_vars.yml
- vars/plausible_vault.yml
vars:
pip_install_packages:
- name: docker
- name: docker-compose
roles:
- geerlingguy.pip
- docker-plausible
GPL-3.0
We are using this role to manage our own installation. Nevertheless, you should understand it before you are using it. Please consider to donate to Plausible.
Sebastian Buck platomo