bertvv / ansible-role-mariadb

Install MariaDB on RHEL/CentOS 7 or Fedora.
https://galaxy.ansible.com/bertvv/mariadb/
Other
144 stars 108 forks source link

Feature request #19

Closed Roxyrob closed 5 years ago

Roxyrob commented 5 years ago

Hi bertvv, can you make default variables "not mandatory" ? It'll be more flexible if one can omit params if deprecated/removed in new mariadb releases or if one want to use this playbook with previous mariadb version (e.g. mariadb 5.5) not supporting some default variables.

You can do something like this in templates/etc_my.cnf.d_server.cnf.j2

{% if mariadb_innodb_buffer_pool_load_at_startup %}innodb_buffer_pool_load_at_startup = {{ mariadb_innodb_buffer_pool_load_at_startup }} {% endif %}

{% if mariadb_table_open_cache %}table_open_cache = {{ mariadb_table_open_cache }}{% endif %}

{% if mariadb_table_open_cache_instances %}table_open_cache_instances = {{ mariadb_table_open_cache_instances }}{% endif %}

So any param can be completely omitted in server.cnf simply adding lines in a playbook like these:

mariadb_innodb_buffer_pool_load_at_startup: mariadb_table_open_cache: mariadb_table_open_cache_instances:

bertvv commented 5 years ago

That seams a good idea, I'll see if I can implement this.

bertvv commented 5 years ago

I think the way to go here is to apply the way custom.cnf works to server.cnf, i.e. to provide a dictionary with desired keys/values. When you don't set the variables, they won't show up in the config file.

The current server.cnf template is not the way to go, I realise now.