Files
computer-playbook/roles/svc-db-mariadb/tasks/02_init.yml
Kevin Veen-Birkenbach 86dd36930f Refactor MariaDB role to stabilize initialization:
- Unify encoding/collation variables
- Improve connection logic for mysql_db module
- Switch to PyMySQL install path to avoid mysqlclient build failures
- Update healthcheck to container-friendly CMD-SHELL usage
- Normalize network and port configuration

These changes were applied during CI/CD pipeline debugging. The root CI/CD connectivity issue is still not fixed.

Reference: https://chatgpt.com/share/6931adf0-ce7c-800f-86f3-f867fbd3191f
2025-12-04 16:52:43 +01:00

25 lines
867 B
YAML

- name: "Create database: {{ database_name }}"
community.mysql.mysql_db:
name: "{{ database_name }}"
state: present
login_user: root
login_password: "{{ MARIADB_ROOT_PWD }}"
login_host: "{{ MARIADB_HOST }}"
login_port: "{{ MARIADB_PORT }}"
encoding: "{{ MARIADB_ENCODING }}"
collation: "{{ MARIADB_COLLATION }}"
config_file: ""
- name: "Create database user: {{ database_username }}"
community.mysql.mysql_user:
name: "{{ database_username }}"
password: "{{ database_password }}"
host: "%"
priv: '`{{ database_name }}`.*:ALL'
state: present
login_user: root
login_password: "{{ MARIADB_ROOT_PWD }}"
login_host: "{{ MARIADB_HOST }}"
login_port: "{{ MARIADB_PORT }}"
config_file: ""