Skip to content

Commit

Permalink
MariaDB: Fix hostnames
Browse files Browse the repository at this point in the history
  • Loading branch information
owine committed Jan 5, 2024
1 parent 6fd551c commit eea0358
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion roles/docspell/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ docspell_docker_envs_default:
DOCSPELL_SERVER_ADMIN__ENDPOINT_SECRET: "{{ docspell_admin_key.stdout }}"
# DOCSPELL_SERVER_AUTH_SERVER__SECRET: ""
DOCSPELL_SERVER_BACKEND_JDBC_PASSWORD: "{{ mariadb_docker_env_password }}"
DOCSPELL_SERVER_BACKEND_JDBC_URL: "jdbc:mariadb://{{ docspell_name }}_mariadb:3306/{{ docspell_name }}"
DOCSPELL_SERVER_BACKEND_JDBC_URL: "jdbc:mariadb://{{ docspell_name }}-mariadb:3306/{{ docspell_name }}"
DOCSPELL_SERVER_BACKEND_JDBC_USER: "root"
DOCSPELL_SERVER_BIND_ADDRESS: "0.0.0.0"
DOCSPELL_SERVER_FULL__TEXT__SEARCH_ENABLED: "true"
Expand Down
11 changes: 8 additions & 3 deletions roles/docspell/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@
path: "{{ server_appdata_path }}/{{ docspell_paths_folder }}/mariadb"
register: stat_docspell_db_folder

- name: Remove legacy MariaDB Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml"
vars:
var_prefix: "{{ docspell_name }}_mariadb"

- name: MariaDB Role
ansible.builtin.include_role:
name: mariadb
vars:
mariadb_instances: ["{{ docspell_name }}_mariadb"]
mariadb_instances: ["{{ docspell_name }}-mariadb"]
mariadb_paths_folder: "{{ docspell_name }}"
mariadb_paths_location: "{{ server_appdata_path }}/{{ docspell_paths_folder }}/mariadb"

- name: Create docspell database
community.mysql.mysql_db:
name: "{{ docspell_name }}"
login_host: "{{ docspell_name }}_mariadb"
login_host: "{{ docspell_name }}-mariadb"
login_user: "root"
login_password: "{{ mariadb_docker_env_password }}"
state: present
Expand Down Expand Up @@ -82,7 +87,7 @@
DOCSPELL_JOEX_FULL__TEXT__SEARCH_ENABLED: "true"
DOCSPELL_JOEX_FULL__TEXT__SEARCH_SOLR_URL: "http://{{ docspell_name }}_solr:{{ solr_docker_env_port }}/solr/{{ docspell_name }}"
DOCSPELL_JOEX_JDBC_PASSWORD: "{{ mariadb_docker_env_password }}"
DOCSPELL_JOEX_JDBC_URL: "jdbc:mariadb://{{ docspell_name }}_mariadb:3306/{{ docspell_name }}"
DOCSPELL_JOEX_JDBC_URL: "jdbc:mariadb://{{ docspell_name }}-mariadb:3306/{{ docspell_name }}"
DOCSPELL_JOEX_JDBC_USER: "root"
DOCSPELL_JOEX_ADDONS_EXECUTOR__CONFIG_RUNNER: "docker,trivial"
DOCSPELL_JOEX_CONVERT_HTML__CONVERTER: "weasyprint"
Expand Down
2 changes: 1 addition & 1 deletion roles/koel/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ koel_docker_ports: "{{ koel_docker_ports_defaults
koel_docker_envs_default:
TZ: "{{ tz }}"
DB_CONNECTION: "mysql"
DB_HOST: "{{ koel_name }}_mariadb"
DB_HOST: "{{ koel_name }}-mariadb"
DB_PORT: "3306"
DB_DATABASE: "{{ koel_name }}"
DB_USERNAME: "root"
Expand Down
11 changes: 8 additions & 3 deletions roles/koel/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@
path: "{{ server_appdata_path }}/{{ koel_paths_folder }}/db"
register: stat_koel_db_folder

- name: Remove legacy MariaDB Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml"
vars:
var_prefix: "{{ koel_name }}_mariadb"

- name: MariaDB Role
ansible.builtin.include_role:
name: mariadb
vars:
mariadb_instances: ["{{ koel_name }}_mariadb"]
mariadb_instances: ["{{ koel_name }}-mariadb"]
mariadb_paths_folder: "{{ koel_name }}"
mariadb_paths_location: "{{ server_appdata_path }}/{{ koel_paths_folder }}/db"

- name: MariaDB | Create koel database
community.mysql.mysql_db:
name: "koel"
login_host: "{{ koel_name }}_mariadb"
login_host: "{{ koel_name }}-mariadb"
login_user: "root"
login_password: "{{ mariadb_docker_env_password }}"
state: present
Expand Down Expand Up @@ -96,7 +101,7 @@
- name: Edit Admin user
community.mysql.mysql_query:
login_db: "koel"
login_host: "{{ koel_name }}_mariadb"
login_host: "{{ koel_name }}-mariadb"
login_user: "root"
login_password: "{{ mariadb_docker_env_password }}"
query: 'UPDATE `users` SET `id` = "1", `name` = "{{ user.name }}", `email` = "{{ user.email }}", `password` = "{{ koel_admin_password_hash.stdout }}", `is_admin` = "1", `preferences` = NULL, `remember_token` = NULL, `created_at` = "{{ koel_date.stdout }}", `updated_at` = "{{ koel_date.stdout }}" WHERE ((`id` = "1"));'
Expand Down
9 changes: 7 additions & 2 deletions roles/plexshare/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,24 @@
path: "{{ server_appdata_path }}/{{ plexshare_paths_folder }}/mariadb"
register: stat_plexshare_db_folder

- name: Remove legacy MariaDB Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml"
vars:
var_prefix: "{{ plexshare_name }}_mariadb"

- name: MariaDB Role
ansible.builtin.include_role:
name: mariadb
vars:
mariadb_instances: ["{{ plexshare_name }}_mariadb"]
mariadb_instances: ["{{ plexshare_name }}-mariadb"]
mariadb_docker_image_tag: "latest"
mariadb_paths_folder: "{{ plexshare_name }}"
mariadb_paths_location: "{{ server_appdata_path }}/{{ plexshare_paths_folder }}/mariadb"

- name: MariaDB | Create plexshare database
community.mysql.mysql_db:
name: "plexshare"
login_host: "{{ plexshare_name }}_mariadb"
login_host: "{{ plexshare_name }}-mariadb"
login_user: "root"
login_password: "{{ mariadb_docker_env_password }}"
state: present
Expand Down

0 comments on commit eea0358

Please sign in to comment.