Closed mmekut closed 1 year ago
Alternatively, the {{mysql_pid_file}} role variable should defaults to '/var/lib/mysql' since that is the default directory MariaDB/MySQL server creates at boot time as data_dir for sockets and other configuration files.
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark issues as stale.
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
Before running this role as root, I had a custom role setup official Mariadb 10.6 repo on AlmaLinux 8.6 since i didnt want to use the default streams provided by the OS which is a vagrant box. Then i encounter the errors below, anytime MariaDB service starts or restarts
[ERROR] mariadbd: can't create/write to file '/var/run/mariadb/mariadb.pid (Errcode 2 'No such file or directory') [ERROR] Can't start server: can't create PID file: No such file or directory
MariaDB service starts as mysql_user which does not have permission to write to the directory specified by the default role variables mysql_log_error, mysql_pid_file.
Since the default path of mysql_log_error (/var/log) and mysql_pid_file (/var/run) as defined by the role is owned by root, we need to create the dirs (/var/log/mariadb) n (/var/run/mariadb) for the two variables and assign them to the newly created mysql_user.
Moreover a config file ({{mysql_daemon}}.conf) is needed at /etc/tmpfiles.d to override the default created by {{mysql_daemon}} at /usr/lib/tmpfiles.d which specifies the directory (/var/lib/mysql --mariadb default) systemd should create for {{mysql_daemon}} PID file at boot time.
solution: Task 1: Ensure MariaDB PID directory exist n is writable by mysql_user Task 2: Ensure MariaDB log directory exist n is writable by mysql_user Task 3: Create a config file (mariadb.conf OR {{mysql_daemon}}.conf) at /etc/tmpfiles.d that would enable systemd to create directory for PID file at system startup
Also the role should provide two new variables mysql_log_error_dir and mysql_pid_file_dir to enable admins specify directory for the variables mysql_log_error and mysql_pid_file, splitting dierctory paths from file names.
...alternatively, admins can specify writable path by overriding the default values of mysql_log_error and mysql_pid_file in their playbook variable file. ...but task 3 is still required regardless of paths specified
@geerlingguy should i spin a pull request