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

Provides support for remote database access. #31

Open
wants to merge 2 commits 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 @@ -18,6 +18,9 @@ crayfish_pgsql_user: postgres
crayfish_db_user: crayfish
crayfish_db_password: islandora
crayfish_db_name: gemini
crayfish_db_host: 127.0.0.1
crayfish_db_root_user: "{% if crayfish_db == 'mysql' %}root{% elif crayfish_db == 'pgsql' %}{{ crayfish_pgsql_user }}{% endif %}"
crayfish_db_root_password: "{{ crayfish_db_password }}"
crayfish_db_driver: "{% if crayfish_db == 'mysql' %}pdo_mysql{% elif crayfish_db == 'pgsql' %}pdo_pgsql{% endif %}"
crayfish_db_port: "{% if crayfish_db == 'mysql' %}3306{% elif crayfish_db == 'pgsql' %}5432{% endif %}"

Expand All @@ -38,7 +41,7 @@ crayfish_gemini_jwt_config: ../syn-settings.xml

crayfish_gemini_db_options:
driver: "{{ crayfish_db_driver }}"
host: 127.0.0.1
host: "{{ crayfish_db_host }}"
port: "{{ crayfish_db_port }}"
dbname: "{{ crayfish_db_name }}"
user: "{{ crayfish_db_user }}"
Expand Down
10 changes: 10 additions & 0 deletions tasks/db-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@
- name: Create Gemini DB (mysql)
mysql_db:
name: "{{ crayfish_db_name }}"
login_host: "{{ crayfish_db_host }}"
login_port: "{{ crayfish_db_port }}"
login_user: "{{ crayfish_db_root_user }}"
login_password: "{{ crayfish_db_root_password }}"
state: present
register: gemini_db_exists

- name: Create Gemini DB User (mysql)
mysql_user:
name: "{{ crayfish_db_user }}"
password: "{{ crayfish_db_password }}"
login_host: "{{ crayfish_db_host }}"
login_port: "{{ crayfish_db_port }}"
login_user: "{{ crayfish_db_root_user }}"
login_password: "{{ crayfish_db_root_password }}"
state: present
priv: "{{crayfish_db_name}}.*:ALL"
host: "%"

8 changes: 8 additions & 0 deletions tasks/db-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
postgresql_user:
name: "{{ crayfish_db_user }}"
password: "{{ crayfish_db_password }}"
login_host: "{{ crayfish_db_host }}"
login_port: "{{ crayfish_db_port }}"
login_user: "{{ crayfish_db_root_user }}"
login_password: "{{ crayfish_db_root_password }}"

- name: Create Gemini DB (pgsql)
postgresql_db:
name: "{{ crayfish_db_name }}"
state: present
owner: "{{ crayfish_db_user }}"
login_host: "{{ crayfish_db_host }}"
login_port: "{{ crayfish_db_port }}"
login_user: "{{ crayfish_db_root_user }}"
login_password: "{{ crayfish_db_root_password }}"
register: gemini_db_exists
10 changes: 5 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
- crayfish-install
- crayfish-gemini

- include: install.yml
tags:
- crayfish
- crayfish-install

- include: db-mysql.yml
when: crayfish_db == 'mysql'
tags:
Expand All @@ -66,11 +71,6 @@
- crayfish-install
- crayfish-gemini

- include: install.yml
tags:
- crayfish
- crayfish-install

- include: gemini.yml
tags:
- crayfish
Expand Down
3 changes: 3 additions & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ __crayfish_packages:
- tesseract-ocr-srp
- ffmpeg
- poppler-utils
- python-psycopg2
- python-mysqldb
- mysql-client
__crayfish_db: mysql
3 changes: 3 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ __crayfish_packages:
- tesseract-langpack-srp
- ffmpeg
- poppler-utils
- python-psycopg2
- python-mysqldb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be MySQL-python instead of python-mysqldb and mysql instead of mysql-client for CENTOS.

- mysql-client
__crayfish_db: mysql