2019-02-21 21:19:56 +00:00
|
|
|
# Ansible role: MariaDB
|
2019-05-18 10:26:37 +00:00
|
|
|
|
2019-06-05 05:28:08 +00:00
|
|
|
[![Version](https://img.shields.io/badge/latest_version-2.0.0-green.svg)](https://git.yaegashi.fr/nishiki/ansible-role-mariadb/releases)
|
2019-03-16 08:41:05 +00:00
|
|
|
[![Build Status](https://travis-ci.org/nishiki/ansible-role-mariadb.svg?branch=master)](https://travis-ci.org/nishiki/ansible-role-mariadb)
|
2019-02-21 21:19:56 +00:00
|
|
|
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://git.yaegashi.fr/nishiki/ansible-role-mariadb/src/branch/master/LICENSE)
|
|
|
|
|
|
|
|
Install and configure MariaDB
|
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
2020-02-08 16:32:59 +00:00
|
|
|
* Ansible >= 2.8
|
|
|
|
* Debian Stretch and Buster
|
2019-02-21 21:19:56 +00:00
|
|
|
|
|
|
|
## Role variables
|
|
|
|
|
2020-03-28 10:07:34 +00:00
|
|
|
| Name | Type | Required |Default | Comment |
|
|
|
|
|---------------------------------|-------|----------|--------|----------------------------------------|
|
|
|
|
| mariadb_use_official_repository | bool | no | true | use the official repository |
|
|
|
|
| mariadb_branch | str | no | 10.3 | the branch version to install |
|
|
|
|
| mariadb_user | str | no | root | login to connect on mariadb |
|
2020-03-28 10:16:19 +00:00
|
|
|
| mariadb_password | str | yes | | password to connect on mariadb |
|
2020-03-28 10:07:34 +00:00
|
|
|
| mariadb_master | bool | no | false | the server is master |
|
|
|
|
| mariadb_autorestart | bool | no | false | restart mariadb when the config change |
|
|
|
|
| mariadb_users | array | no | | the users to manage |
|
|
|
|
| mariadb_databases | array | no | | the databases to manage |
|
|
|
|
| mariadb_config | hash | no | | extra options for configuration |
|
|
|
|
|
|
|
|
### mariadb_users
|
|
|
|
|
|
|
|
| Name | Type | Required |Default | Comment |
|
|
|
|
|------------|-------|----------|---------|-----------------------------------------------------------|
|
|
|
|
| name | str | yes | | the username |
|
|
|
|
| host | str | yes | | the mysql user host |
|
|
|
|
| password | str | yes | | the user password |
|
|
|
|
| privileges | array | no | | the privileges with this form `database.*:SELECT,UPDATE`) |
|
|
|
|
| state | str | no | present | if state is `absent` the user is deleted |
|
|
|
|
|
|
|
|
Example:
|
2019-02-21 21:19:56 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
- name: johndoe
|
2020-03-28 10:07:34 +00:00
|
|
|
host: '%'
|
2019-02-21 21:19:56 +00:00
|
|
|
password: supersecret
|
|
|
|
privileges:
|
|
|
|
- 'database.*:SELECT,UPDATE'
|
|
|
|
state: present
|
|
|
|
```
|
|
|
|
|
2020-03-28 10:07:34 +00:00
|
|
|
### mariadb_databases
|
|
|
|
|
|
|
|
| Name | Type | Required |Default | Comment |
|
|
|
|
|------------|-------|----------|---------|-----------------------------------------------------------|
|
|
|
|
| name | str | yes | | the dabase name |
|
|
|
|
| state | str | no | present | if state is `absent` the database is deleted |
|
|
|
|
|
|
|
|
Example:
|
2019-02-21 21:19:56 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
- name: superprogram
|
|
|
|
state: present
|
|
|
|
```
|
|
|
|
|
2020-03-28 10:07:34 +00:00
|
|
|
### mariadb_config
|
|
|
|
|
|
|
|
Example:
|
2019-02-21 21:19:56 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
mysqld:
|
|
|
|
server-id: 1
|
|
|
|
bind-address: 0.0.0.0
|
|
|
|
```
|
|
|
|
|
|
|
|
## How to use
|
|
|
|
|
|
|
|
```
|
|
|
|
- hosts: server
|
2020-03-28 10:07:34 +00:00
|
|
|
vars:
|
|
|
|
mariadb_password: supersecret
|
|
|
|
mariadb_users:
|
|
|
|
- name: johndoe
|
|
|
|
host: '%'
|
|
|
|
password: usersecret
|
|
|
|
privileges:
|
|
|
|
- 'myappli.*:ALL'
|
|
|
|
mariadb_databases:
|
|
|
|
- myappli
|
|
|
|
mariadb_config:
|
|
|
|
server-id: 1
|
|
|
|
bind-address: 0.0.0.0
|
2019-02-21 21:19:56 +00:00
|
|
|
roles:
|
|
|
|
- mariadb
|
|
|
|
```
|
|
|
|
|
|
|
|
## Development
|
2019-05-18 10:26:37 +00:00
|
|
|
|
2020-03-01 10:49:25 +00:00
|
|
|
### Test with molecule and docker
|
2019-02-21 21:19:56 +00:00
|
|
|
|
|
|
|
* install [docker](https://docs.docker.com/engine/installation/)
|
2020-03-01 10:49:25 +00:00
|
|
|
* install `python3` and `python3-pip`
|
|
|
|
* install molecule and dependencies `pip3 install molecule 'molecule[docker]' docker ansible-lint testinfra yamllint`
|
|
|
|
* run `molecule test`
|
2019-02-21 21:19:56 +00:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
```
|
|
|
|
Copyright (c) 2019 Adrien Waksberg
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
```
|