thedumbtechguy.mariadb
Ansible Role: MariaDB
Installs MariaDB on Debian/Ubuntu linux servers.
Requirements
None.
Role Variables
Available variables are listed below, along with default values (see defaults/main.yml):
Create database users
Passwords are required!
mariadb_group_users:
- name: 'user1'
password: '*******'
priv: '*.*:USAGE'
hosts:
- localhost
- 127.0.0.1
- name: 'normaltravis'
password: '*******'
priv: '*.*:ALL,GRANT'
hosts:
- localhost
- 127.0.0.1
- name: 'old'
state: absent
hosts:
- localhost
- 127.0.0.1
Create databases
All databases need to be defined in mariadb_databases:
mariadb_host_databases:
- name: 'testdb'
collation: utf8_general_ci
encoding: utf8
Settings user priviledges on databases and tables
To define user priviledges use the following format:
db.table:priv1,priv2
Idempotent solution for multiple priviledges (@see http://stackoverflow.com/a/22959760)
mysql_privileges:
- db1.*:ALL,GRANT
- db2.*:USAGE
mariadb_host_users:
- name: 'user1'
password: 'travis'
priv={{ mysql_privileges|join('/') }}
hosts:
- localhost
- 127.0.0.1
Available variables for default, hosts and groups
mariadb_default_users: []
mariadb_host_users: []
mariadb_group_users: []
mariadb_default_databases: []
mariadb_host_databases: []
mariadb_group_databases: []
Security
This role sets an administrative user and removes root entirely. Please define the following settings:
mariadb_admin_home: '/root'
mariadb_admin_user: 'admin'
mariadb_admin_password: 'Set strong password here!'
When a custom admin username is used, a password must be set!
Dependencies
None.
Example Playbook
- hosts: server
roles:
- { role: tschifftner.mariadb }
Supported OS
| Ansible | Debian Jessie | Ubuntu 14.04 | Ubuntu 12.04 |
|---|---|---|---|
| 2.1 | Yes | Yes | Yes |
Root password lost
If you cannot login anymore you can reset your credentials.
Remove User
To remove a user define state: absent
mariadb_host_users:
- name: 'test'
host: localhost
password: 'test'
priv: '*.*:ALL'
state: 'absent'
Replication
Master/Master Replication
Server #1 (db1.example.org):
mariadb_server_id: 1 #Must Be 1
mariadb_replication_role: 'master'
mariadb_replication_master: 'db2.example.org'
mariadb_replication_username: 'replicationuser'
mariadb_replication_password: 'strong-password'
Server #2 (db2.example.org):
mariadb_server_id: 2
mariadb_replication_role: 'master'
mariadb_replication_master: 'db1.example.org'
mariadb_replication_username: 'replicationuser'
mariadb_replication_password: 'strong-password'
Master/Slave Replication
Not possible
License
Author Information
Install
ansible-galaxy install thedumbtechguy.mariadbLicense
mit
Downloads
78
Owner
