summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml
diff options
context:
space:
mode:
authorshuai chen <chenshuai@huawei.com>2015-12-08 11:36:59 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2015-12-08 11:36:59 +0000
commit4947b112b86d7e4784af945509078f5ea1b757a0 (patch)
treecc09c1c2518711b27130640a3a79158a6259980d /deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml
parent850a41b56643e5fb475f4a0f51bc787798802ec9 (diff)
parent86782f3e375274cb65dc0b0b7d48450e73e85df3 (diff)
Merge "database script refactor"
Diffstat (limited to 'deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml')
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml24
1 files changed, 24 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml
new file mode 100644
index 00000000..16783ed4
--- /dev/null
+++ b/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml
@@ -0,0 +1,24 @@
+---
+- name: create all needed db
+ mysql_db: name={{ item.db }} state=present
+ with_items: "{{ credentials }}"
+
+- name: create service db user
+ mysql_user:
+ name={{ item[0].user }}
+ password={{ item[0].password }}
+ priv=*.*:ALL,GRANT
+ host={{ item[1] }}
+ state=present
+ with_nested:
+ - "{{ credentials }}"
+ - ['%', 'localhost', inventory_hostname]
+
+- name: create wsrep db user
+ mysql_user:
+ name={{ WSREP_SST_USER }}
+ password={{ WSREP_SST_PASS }}
+ priv=*.*:ALL,GRANT
+ host={{ item }}
+ state=present
+ with_items: ['%', 'localhost', inventory_hostname]