2021-05-05 15:02:37 +01:00
|
|
|
mysql-formula
|
|
|
|
=============
|
2013-06-13 16:30:15 -06:00
|
|
|
|
2019-07-06 10:46:03 +01:00
|
|
|
|img_travis| |img_sr|
|
|
|
|
|
|
|
|
.. |img_travis| image:: https://travis-ci.com/saltstack-formulas/mysql-formula.svg?branch=master
|
|
|
|
:alt: Travis CI Build Status
|
|
|
|
:scale: 100%
|
|
|
|
:target: https://travis-ci.com/saltstack-formulas/mysql-formula
|
|
|
|
.. |img_sr| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
|
|
|
:alt: Semantic Release
|
|
|
|
:scale: 100%
|
|
|
|
:target: https://github.com/semantic-release/semantic-release
|
|
|
|
|
2018-10-01 16:35:13 +01:00
|
|
|
Install the MySQL client and/or server on Linux and MacOS.
|
2014-02-09 05:59:02 +00:00
|
|
|
|
2019-07-06 10:46:03 +01:00
|
|
|
.. contents:: **Table of Contents**
|
|
|
|
|
|
|
|
General notes
|
|
|
|
-------------
|
|
|
|
|
|
|
|
See the full `SaltStack Formulas installation and usage instructions
|
|
|
|
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_.
|
|
|
|
|
|
|
|
If you are interested in writing or contributing to formulas, please pay attention to the `Writing Formula Section
|
|
|
|
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#writing-formulas>`_.
|
|
|
|
|
|
|
|
If you want to use this formula, please pay attention to the ``FORMULA`` file and/or ``git tag``,
|
|
|
|
which contains the currently released version. This formula is versioned according to `Semantic Versioning <http://semver.org/>`_.
|
2014-02-09 05:59:02 +00:00
|
|
|
|
2019-07-06 10:46:03 +01:00
|
|
|
See `Formula Versioning Section <https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#versioning>`_ for more details.
|
|
|
|
|
|
|
|
Contributing to this repo
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
**Commit message formatting is significant!!**
|
|
|
|
|
2019-10-14 11:37:09 +01:00
|
|
|
Please see `How to contribute <https://github.com/saltstack-formulas/.github/blob/master/CONTRIBUTING.rst>`_ for more details.
|
2013-06-13 16:30:15 -06:00
|
|
|
|
2013-08-08 16:47:03 -06:00
|
|
|
Available states
|
2019-07-06 10:46:03 +01:00
|
|
|
----------------
|
2014-02-09 05:59:02 +00:00
|
|
|
|
|
|
|
.. contents::
|
|
|
|
:local:
|
2013-06-13 16:30:15 -06:00
|
|
|
|
2014-07-01 15:18:54 -04:00
|
|
|
``mysql``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^
|
2014-07-01 15:18:54 -04:00
|
|
|
|
2018-10-01 16:35:13 +01:00
|
|
|
Meta-state including all server packages in correct order. This meta-state does **not** include ``mysql.remove_test_database``.
|
2014-07-01 15:18:54 -04:00
|
|
|
|
2018-10-01 16:35:13 +01:00
|
|
|
``mysql.macos``
|
2021-05-05 15:02:37 +01:00
|
|
|
^^^^^^^^^^^^^^^
|
2018-10-01 16:35:13 +01:00
|
|
|
|
2018-10-02 13:19:57 +01:00
|
|
|
Install "MySQL Community Server", "MySQL Workbench", and other related mysql products on MacOS (and create Desktop shortcuts).
|
2018-10-01 16:35:13 +01:00
|
|
|
|
|
|
|
``mysql.macos.remove``
|
2021-05-05 15:02:37 +01:00
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
2018-10-01 16:35:13 +01:00
|
|
|
|
|
|
|
Remove "MySQL Community Server", "MySQL Workbench", and any other enabled products from MacOS.
|
2014-10-10 17:46:45 +10:00
|
|
|
|
2013-08-15 17:25:15 -05:00
|
|
|
``mysql.client``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^^^^^^^^
|
2014-02-09 05:59:02 +00:00
|
|
|
|
2018-10-01 16:35:13 +01:00
|
|
|
Install the MySQL client package on Linux.
|
2014-02-09 05:59:02 +00:00
|
|
|
|
2013-08-08 16:47:03 -06:00
|
|
|
``mysql.server``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^^^^^^^^
|
2014-02-09 05:59:02 +00:00
|
|
|
|
|
|
|
Install the MySQL server package and start the service.
|
2014-05-12 11:10:51 -04:00
|
|
|
|
2018-10-01 16:35:13 +01:00
|
|
|
Debian OS family supports setting MySQL root password during install via debconf.
|
2014-07-01 15:18:54 -04:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
If no root password is provided in the pillar, a random one will
|
2014-07-26 23:54:48 -07:00
|
|
|
be created. Because Hydrogen doesn't have easy access to a random
|
|
|
|
function (test.rand_str isn't introduced until Helium), instead,
|
|
|
|
we use the not-at-all random ``grains.server_id``. As this is
|
2014-07-01 15:18:54 -04:00
|
|
|
cryptographically insecure, future formula versions should use the
|
|
|
|
newly available ``random.get_str`` method.
|
2014-05-12 11:47:51 -04:00
|
|
|
|
2018-03-14 23:22:05 +01:00
|
|
|
``mysql.server_checks``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
2018-03-14 23:22:05 +01:00
|
|
|
|
|
|
|
Enforces a root password to be set.
|
|
|
|
|
|
|
|
|
2015-03-03 10:49:49 -05:00
|
|
|
``mysql.disabled``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^^^^^^^^^^
|
2015-03-03 10:49:49 -05:00
|
|
|
|
|
|
|
Ensure that the MySQL service is not running.
|
|
|
|
|
2014-05-12 11:47:51 -04:00
|
|
|
``mysql.database``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^^^^^^^^^^
|
2014-05-12 11:47:51 -04:00
|
|
|
|
2014-05-12 12:24:16 -04:00
|
|
|
Create and manage MySQL databases.
|
|
|
|
|
2014-07-01 15:18:54 -04:00
|
|
|
``mysql.python``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^^^^^^^^
|
2014-07-01 15:18:54 -04:00
|
|
|
|
|
|
|
Install mysql python bindings.
|
|
|
|
|
2014-05-12 12:29:30 -04:00
|
|
|
``mysql.user``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^^^^^^
|
2014-05-12 12:24:16 -04:00
|
|
|
|
2014-05-15 16:40:02 -04:00
|
|
|
Create and manage MySQL database users with definable GRANT privileges.
|
|
|
|
|
2014-10-10 16:43:15 +10:00
|
|
|
The state accepts MySQL hashed passwords or clear text. Hashed password have
|
|
|
|
priority.
|
2014-05-15 16:40:02 -04:00
|
|
|
|
|
|
|
.. note::
|
2014-10-10 16:43:15 +10:00
|
|
|
See the `salt.states.mysql_user
|
|
|
|
<http://docs.saltstack.com/en/latest/ref/states/all/salt.states.mysql_user.html#module-salt.states.mysql_user>`_
|
|
|
|
docs for additional information on configuring hashed passwords.
|
|
|
|
|
2014-05-15 17:08:31 -04:00
|
|
|
Make sure to **quote the passwords** in the pillar so YAML doesn't throw an exception.
|
2014-05-15 16:40:02 -04:00
|
|
|
|
2014-10-10 17:46:45 +10:00
|
|
|
``mysql.remove_test_database``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2014-10-10 17:46:45 +10:00
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
Do not use this state if your MySQL instance has a database in use called ``test``.
|
|
|
|
If you do, it will be irrevocably removed!
|
|
|
|
|
|
|
|
Remove the database called ``test``, normally created as part of a default
|
|
|
|
MySQL installation. This state is **not** included as part of the meta-state
|
|
|
|
above as this name may conflict with a real database.
|
2014-10-10 16:43:15 +10:00
|
|
|
|
2014-12-12 09:20:09 +11:00
|
|
|
``mysql.dev``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^^^^^
|
2014-12-12 09:20:09 +11:00
|
|
|
|
|
|
|
Install the MySQL development libraries and header files.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
Note that this state is not installed by the mysql meta-state unless you set
|
2015-10-05 21:44:20 +02:00
|
|
|
your pillar data accordingly.
|
2014-12-12 09:20:09 +11:00
|
|
|
|
2016-09-18 14:26:04 -07:00
|
|
|
``mysql.repo``
|
2019-07-06 10:46:03 +01:00
|
|
|
^^^^^^^^^^^^^^
|
2016-09-18 14:26:04 -07:00
|
|
|
|
|
|
|
Add the official MySQL 5.7 repository.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
Note that this state currently only supports MySQL 5.7 for RHEL systems.
|
|
|
|
Debian and Suse support to be added. Also need to add the option to allow
|
|
|
|
selection of MySQL version (5.6 and 5.5 repos are added but disabled) and
|
|
|
|
changed enabled repository accordingly.
|
2018-11-15 14:34:26 +01:00
|
|
|
|
|
|
|
``mysql.config``
|
2021-05-05 15:02:37 +01:00
|
|
|
^^^^^^^^^^^^^^^^
|
2018-11-15 14:34:26 +01:00
|
|
|
|
|
|
|
Manage the MySQL configuration.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
There are currently two common ways to configure MySQL, a monolithic configuration file
|
|
|
|
or a configuration directory with configuration files per component. By default this
|
|
|
|
state will use a configuration directory for CentOS and Fedora, and a monolithic
|
|
|
|
configuration file for all other supported OSes.
|
|
|
|
|
|
|
|
Whether the configuration directory is used or not depends on whether `mysql.config_directory`
|
|
|
|
is defined in the pillar. If it is present it will pick the configuration from individual
|
|
|
|
component keys (`mysql.server`, `mysql.galera`, `mysql.libraries`, etc) with optional global
|
|
|
|
configuration from `mysql.global`. The monolithic configuration, however, is defined separately
|
|
|
|
in `mysql.config`.
|
2019-07-06 10:46:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
Testing
|
|
|
|
-------
|
|
|
|
|
|
|
|
Linux testing is done with ``kitchen-salt``.
|
|
|
|
|
|
|
|
Requirements
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* Ruby
|
|
|
|
* Docker
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ gem install bundler
|
|
|
|
$ bundle install
|
|
|
|
$ bin/kitchen test [platform]
|
|
|
|
|
|
|
|
Where ``[platform]`` is the platform name defined in ``kitchen.yml``,
|
|
|
|
e.g. ``debian-9-2019-2-py3``.
|
|
|
|
|
|
|
|
``bin/kitchen converge``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Creates the docker instance and runs the ``mysql`` main state, ready for testing.
|
|
|
|
|
|
|
|
``bin/kitchen verify``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Runs the ``inspec`` tests on the actual instance.
|
|
|
|
|
|
|
|
``bin/kitchen destroy``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Removes the docker instance.
|
|
|
|
|
|
|
|
``bin/kitchen test``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``.
|
|
|
|
|
|
|
|
``bin/kitchen login``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Gives you SSH access to the instance for manual testing.
|