Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Adds support for using a remote database. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ console_install: true
# Database
matomo_db: mysql
matomo_pgsql_user: postgres
matomo_db_root_user: "{% if matomo_db == 'mysql' %}root{% elif matomo_db == 'pgsql' %}{{ matomo_pgsql_user }}{% endif %}"
matomo_db_root_password: ""
matomo_db_user: matomo
matomo_db_password: islandora
matomo_db_name: matomo
matomo_db_driver: "{% if matomo_db == 'mysql' %}pdo_mysql{% elif matomo_db == 'pgsql' %}pdo_pgsql{% endif %}"
matomo_db_port: "{% if matomo_db == 'mysql' %}3306{% elif matomo_db == 'pgsql' %}5432{% endif %}"
matomo_db_host: 127.0.0.1

matomo_db_options:
driver: "{{ matomo_db_driver }}"
host: 127.0.0.1
host: "{{ matomo_db_host }}"
port: "{{ matomo_db_port }}"
dbname: "{{ matomo_db_name }}"
user: "{{ matomo_db_user }}"
Expand Down
6 changes: 5 additions & 1 deletion tasks/console_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
name: "{{ matomo_db_name }}"
target: "{{ webserver_document_root }}/matomo.sql"
state: import
login_host: "{{ matomo_db_host }}"
login_port: "{{ matomo_db_port }}"
login_user: "{{ matomo_db_root_user }}"
login_password: "{{ matomo_db_root_password }}"
ignore_errors: yes
when: motomo_sql_dump_create | changed

Expand All @@ -26,4 +30,4 @@
group: "{{ matomo_user }}"
mode: 0664
force: no
register: motomo_config_create
register: motomo_config_create
9 changes: 9 additions & 0 deletions tasks/db-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
- name: Create Matomo DB (mysql)
mysql_db:
name: "{{ matomo_db_name }}"
login_host: "{{ matomo_db_host }}"
login_port: "{{ matomo_db_port }}"
login_user: "{{ matomo_db_root_user }}"
login_password: "{{ matomo_db_root_password }}"
state: present
register: matomo_db_exists

- name: Create Matomo DB User (mysql)
mysql_user:
name: "{{ matomo_db_user }}"
password: "{{ matomo_db_password }}"
login_host: "{{ matomo_db_host }}"
login_port: "{{ matomo_db_port }}"
login_user: "{{ matomo_db_root_user }}"
login_password: "{{ matomo_db_root_password }}"
host: "%"
state: present
priv: "{{matomo_db_name}}.*:ALL"
8 changes: 8 additions & 0 deletions tasks/db-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
postgresql_user:
name: "{{ matomo_db_user }}"
password: "{{ matomo_db_password }}"
login_host: "{{ matomo_db_host }}"
login_port: "{{ matomo_db_port }}"
login_user: "{{ matomo_db_root_user }}"
login_password: "{{ matomo_db_root_password }}"

- name: Create Matomo DB (pgsql)
become: yes
Expand All @@ -14,6 +18,10 @@
name: "{{ matomo_db_name }}"
state: present
owner: "{{ matomo_db_user }}"
login_host: "{{ matomo_db_host }}"
login_port: "{{ matomo_db_port }}"
login_user: "{{ matomo_db_root_user }}"
login_password: "{{ matomo_db_root_password }}"
register: matomo_db_exists


Expand Down