Initial commit
This commit is contained in:
commit
ea4c2097d4
3 changed files with 36 additions and 0 deletions
11
defaults/main.yml
Normal file
11
defaults/main.yml
Normal 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
3
handlers/main.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- name: restart mariadb
|
||||
service: name=mariadb state=restarted
|
||||
22
tasks/main.yml
Normal file
22
tasks/main.yml
Normal 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 }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue