aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/database/tasks/mariadb.yml
diff options
context:
space:
mode:
authorcarey.xu <carey.xuhan@huawei.com>2015-09-30 11:26:46 +0800
committercarey.xu <carey.xuhan@huawei.com>2015-10-09 15:03:51 +0800
commit00aaaac786bcec0d2de7c14c4f3c5a89ba2553f5 (patch)
tree05b45bee93c88f363cb78d79f9dac26cdf12afe6 /deploy/adapters/ansible/roles/database/tasks/mariadb.yml
parent9a95593b0c8cdefb6ad4a3c836b699f42b1f7323 (diff)
compass4nfv support ceilometer
JIRA: COMPASS-53 Change-Id: Ie8fc0f3f03f1de3c9fcf37778e025175ed391bc5 Signed-off-by: carey.xu <carey.xuhan@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/database/tasks/mariadb.yml')
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/mariadb.yml60
1 files changed, 44 insertions, 16 deletions
diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb.yml
index 3626777b..37c9a2c9 100644
--- a/deploy/adapters/ansible/roles/database/tasks/mariadb.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/mariadb.yml
@@ -24,32 +24,60 @@
- name: update wsrep_sst_rsync gid
lineinfile: dest=/usr/bin/wsrep_sst_rsync state=absent regexp="\s*gid = \$MYGID$" backup=yes
+- stat: path=/opt/mysql_init_complete
+ register: mysql_init_complete
+
- name: restart first mysql server
shell: service mysql restart --wsrep-cluster-address="gcomm://"
- when: inventory_hostname == haproxy_hosts.keys()[0]
- register: result
- until: result|success
- retries: 5
- delay: 5
+ args:
+ creates: /opt/mysql_init_complete
+ when: inventory_hostname == haproxy_hosts.keys()[0] and mysql_init_complete.stat.exists == False
tags:
- mysql_restart
+ #register: result
+ #until: result|success
+ #retries: 5
+ #delay: 5
- name: restart other mysql server
- service: name=mysql state=restarted enabled=yes
- when: inventory_hostname != haproxy_hosts.keys()[0]
- register: result
- until: result|success
- retries: 5
- delay: 5
+ shell: service mysql restart
+ args:
+ creates: /opt/mysql_init_complete
tags:
- mysql_restart
+ when: inventory_hostname != haproxy_hosts.keys()[0] and mysql_init_complete.stat.exists == False
+ #register: result
+ #until: result|success
+ #retries: 5
+ #delay: 5
- name: generate mysql service list
shell: echo {{ item }} >> /opt/service
with_items: services_noarch
-- name: create database/user
- shell: /opt/data.sh
- run_once: True
- tags:
- - mysql_user
+- name: create all needed db
+ run_once: yes
+ mysql_db: name={{ item.db }} state=present
+ with_items: "{{ credentials }}"
+
+- name: create service db user
+ run_once: yes
+ 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
+ run_once: yes
+ mysql_user:
+ name={{ WSREP_SST_USER }}
+ password={{ WSREP_SST_PASS }}
+ priv=*.*:ALL,GRANT
+ host={{ item }}
+ state=present
+ with_items: ['%', 'localhost', inventory_hostname]