/ansible-role-mariadb

This role installs and configures MariaDB

Primary LanguageShellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Build Status

Ansible Role: MariaDB

| This role installs and configures MariaDB

Motivation

Installing MariaDB together with "MySQL secure installation".

Installation

Install from Ansible Galaxy

ansible-galaxy install while_true_do.mariadb

Install from Github

git clone https://github.com/while-true-do/ansible-role-mariadb.git while_true_do.mariadb

Requirements

Used Modules

Module requirements

  • MySQLdb (package MySQL-python on CentOS 7)

Dependencies

This role depends on https://galaxy.ansible.com/while_true_do/repo_mariadb. You have to install the role:

ansible-galaxy install -r requirements.yml

Role Variables

You have to set a password for 'wtd_mariadb_root_password'.

# defaults/main.yml

# The variables below may be overwritten from /vars/*.yml, depending on your
# distribution and choice of repository.
#
# root_password: You should always set a password!
#
# repository:
#   - default -> will use the distribution specific repository
#   - repo_mariadb -> will use the official upstream repository
#     there is also a dependency to while_true_do.repo_mariadb
#
# Also some common best practices are applied like innodb tuning, activating query cache and setting default charset to utf8m4
#
wtd_mariadb_repository: 'default'
wtd_mariadb_packages:
    - 'mariadb-server'
    - 'mariadb'
    - 'MySQL-python'
# Config
wtd_mariadb_root_password: ''
wtd_mariadb_port: '3306'
wtd_mariadb_bind_address: '127.0.0.1'
wtd_mariadb_datadir: '/var/lib/mysql'
wtd_mariadb_socket: "/var/lib/mysql/mysql.sock"
wtd_mariadb_symbolic_links: '0'
wtd_mariadb_character_set: 'utf8mb4'
# Innodb
wtd_mariadb_innodb_large_prefix: 'on'
wtd_mariadb_innodb_file_format: 'barracuda'
wtd_mariadb_innodb_file_per_table: 'true'
wtd_mariadb_innodb_buffer_pool_size: '128M'
# Query Cache
wtd_mariadb_query_cache_type: '1'
wtd_mariadb_query_cache_limit: '256K'
wtd_mariadb_query_cache_min_res_unit: '2k'
wtd_mariadb_query_cache_size: '64M'

Below files will be included conditional

# vars/CentOS.yml
wtd_mariadb_packages:
  - 'mariadb-server'
  - 'mariadb'
  - 'MySQL-python'
# vars/RedHat.yml
wtd_mariadb_packages:
  - 'mariadb-server'
  - 'mariadb'
  - 'MySQL-python'
# vars/repo_mariadb.yml
wtd_mariadb_packages:
  - 'MariaDB-server'
  - 'MariaDB-client'
  - 'MySQL-python'

Example Playbook

Simple Example:

- hosts: servers
  roles:
    - { role: while_true_do.mariadb, wtd_mariadb_root_password: 'PASSWORD' }

Testing

All tests are located in test directory.

Basic testing:

bash ./tests/test-spelling.sh
bash ./tests/test-ansible.sh

Contribute / Bugs

Thank you so much for considering to contribute. Every contribution helps us. We are really happy, when somebody is joining the hard work. Please have a look at the links first.

License

This work is licensed under a BSD License.

Author Information

Site: while-true-do.org

Mail: hello@while-true-do.org