Default variable details
========================

Some of ``debops.mariadb_server`` default variables have more extensive
configuration than simple strings or lists, here you can find documentation and
examples for them.

.. contents::
   :local:
   :depth: 1

.. _mariadb_server__ref_options:

mariadb_server__options
-----------------------

The role uses :file:`/etc/mysql/conf.d/mysqld.cnf` configuration file to manage the
MariaDB/MySQL server configuration. This configuration file is generated by
a template that uses the :envvar:`mariadb_server__mysqld_options` variable to get
the configuration data. The configuration itself is split among several
variables located in :file:`defaults/main.yml` file.

A minimal configuration is stored as a YAML dictionary. Keys of the dictionary
as MariaDB configuration option names, and values of the dictionary are the
configuration values. All values are automatically quoted in the generated
configuration file.

Example configuration section:

.. code-block:: yaml

   mariadb_server__options:
     'query_cache_type': '0'
     'key_buffer': '16M'
     'skip_name_resolve':

The dictionary keys without values will be written in the configuration file
with correct notation.

Alternative configuration notation is to use a YAML list, each element of
a list being a YAML dictionary in the above format. An example:

.. code-block:: yaml

   mariadb_server__options:

     - 'query_cache_type': '0'
       'key_buffer': '16M'

     - 'skip_name_resolve':

Yet another alternative format can be used if you use certain keys in the YAML
dictionary. The template checks for presence of the ``name`` or ``section``
keys, and if found, changes to a different format that uses YAML dictionary
keys:

``name``
  Required for the main options. Name of the option to add.

``section``
  Required for the definition of a configuration section. Create new section of
  the configuration file, written in square brackets.

``state``
  Optional. Either ``present`` or ``absent``. If not specified or ``present``,
  a given section or option will be added in the configuration file; if
  ``absent``, option or section won't be added.

``comment``
  Optional. Add a comment to a given option or section.

``value``
  Optional for main options. If specified, set a value of a given option.

``options``
  Optional. A YAML dictionary or list of YAML dictionaries with options to
  include in a given section, or multiple options specified together as
  a group. If it's specified, values of ``name`` and ``value`` are ignored.

Examples:

.. code-block:: yaml

   mariadb_server__options:

     - section: 'mysqld'
       comment: 'Global MariaDB server options'
       options:

         - name: 'skip_name_resolve'

         - name: 'key_buffer'
           value: '16M'

         - name: 'query_cache_type'
           value: '0'
           state: 'present'
