Skip to content

Ansible role to install MySQL Community Server

License

Notifications You must be signed in to change notification settings

miguel-chacon/mysql_role

 
 

Repository files navigation

Logo

MySQL Ansible role

Build Status Ansible Galaxy

This ansible role installs an Oracle MySQL or MariaDB server in a debian environment.

Getting Started

These instructions will get you a copy of the role for your Ansible playbook. Once launched, it will install an MySQL Database or MariaDB server in a Debian system.

Prerequisities

Ansible 2.7.9.0 version installed. Inventory destination should be a Debian environment.

For testing purposes, Molecule with Docker as driver and Goss as verifier.

Installing

Create or add to your roles dependency file (e.g requirements.yml):

- src: idealista.mysql_role
  version: 3.0.0
  name: mysql

Install the role with ansible-galaxy command:

ansible-galaxy install -p roles -r requirements.yml -f

Use in a playbook:

---
- hosts: someserver
  roles:
    - role: mysql

Usage

Installation tasks follows the install guide: https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/

Look to the defaults properties file to see the possible configuration properties.

Set at least mysql_root_user and mysql_root_password:

mysql_root_user: mysql         # Change mysql root user
mysql_root_password: secret    # Change mysql root password

Add any number of databases and create users with privs on them

mysql_databases:
   - name: example_DB
     encoding: utf8
   - name: anotherExample_DB

mysql_users:
   - name: admin_user
     host: 127.0.0.1
     password: secret
     priv: [ *.*:USAGE ]
   - name: example_user
     host: *
     password: secret
     priv: [ example_DB.*:ALL ]

Testing

$ pipenv sync
$ pipenv run molecule test --all

To check the installation, example with Oracle's MySQL implementation:

$ pipenv run molecule converge --scenario-name=mysql
$ pipenv run molecule login --scenario-name=mysql

root@mysql:/# mysql -u root -ptesting

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test01             |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)

Built With

Ansible Molecule Goss

Versioning

For the versions available, see the tags on this repository.

Additionaly you can see what change in each version in the CHANGELOG.md file.

Authors

See also the list of contributors who participated in this project.

License

Apache 2.0 License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

About

Ansible role to install MySQL Community Server

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published