Initial commit

This commit is contained in:
nd 2018-09-20 13:19:38 +02:00
commit ea4c2097d4
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
3 changed files with 36 additions and 0 deletions

11
defaults/main.yml Normal file
View file

@ -0,0 +1,11 @@
mariadb:
users: {}
# mysql:
# host: localhost
# password: foobar
# priv: *.*:USAGE
dbs: {}
# database:
# collation: utf8_general_ci
# encoding: utf8

3
handlers/main.yml Normal file
View file

@ -0,0 +1,3 @@
---
- name: restart mariadb
service: name=mariadb state=restarted

22
tasks/main.yml Normal file
View file

@ -0,0 +1,22 @@
---
- name: install mariadb
apt:
pkg: "{{ item }}"
with_items:
- mariadb-server
- python-mysqldb
- name: create mariadb dbs
mysql_db:
name: "{{ item.key }}"
collation: "{{ item.value.collation | default('utf8_general_ci') }}"
encoding: "{{ item.value.encoding | default('utf8') }}"
with_dict: "{{ mariadb.dbs }}"
- name: create mariadb users
mysql_user:
name: "{{ item.key }}"
host: "{{ item.value.host | default('localhost') }}"
password: "{{ item.value.password }}"
priv: "{{ item.value.priv | default('*.*:USAGE') }}"
with_dict: "{{ mariadb.users }}"