pdns-ansible icon indicating copy to clipboard operation
pdns-ansible copied to clipboard

Allow mysql-specific tasks to run based when using a gmysql backend, not on pdns_mysql_databases_credentials

Open franklouwers opened this issue 1 year ago • 0 comments

When we have a gmysql backend, we do still want to run most of the Mysql-specific setup, apart from the db/user creation. Previously, the pdns_mysql_databases_credentials var was used to trigger this.

However, pdns_mysql_databases_credentials contains the database 'root' credentials, and is used when creating the DB/User. Sometimes we don't need/have the root credentials, as the db might be externally provisioned. Yet we still need the mysql-backend dependencies, and might (optionally) also load the default schema.

This PR looks at the defined backends, and will trigger the MySQL tasks if it detects a gmysql backend.

Additionally, we introduce a boolean parameter pdns_mysql_schema_load (default true) so we can allow the user to optionally skip loading the default schema.

Lastly, it adds a default host of "localhost" if not specified in the pdns_backends['gmysql'] struct. TODO for later: if host isn't defined, use the unix socket instead of localhost.

franklouwers avatar Aug 09 '23 08:08 franklouwers