c894b322e8761e6f776e4f124156dd0a6228607f
[genesis.git] / compass / deploy / ansible / roles / database / templates / data.j2
1 #!/bin/sh
2 mysql -uroot -Dmysql <<EOF
3 drop database if exists keystone;
4 drop database if exists glance;
5 drop database if exists neutron;
6 drop database if exists nova;
7 drop database if exists cinder;
8
9 CREATE DATABASE keystone;
10 {% for host in ['%', 'localhost', inventory_hostname] %}
11 GRANT ALL ON keystone.* TO 'keystone'@'{{ host }}' IDENTIFIED BY '{{ KEYSTONE_DBPASS }}';
12 {% endfor %}
13
14 CREATE DATABASE glance;
15 {% for host in ['%', 'localhost', inventory_hostname] %}
16 GRANT ALL ON glance.* TO 'glance'@'{{ host }}' IDENTIFIED BY '{{ GLANCE_DBPASS }}';
17 {% endfor %}
18
19 CREATE DATABASE neutron;
20 {% for host in ['%', 'localhost', inventory_hostname] %}
21 GRANT ALL ON neutron.* TO 'neutron'@'{{ host }}' IDENTIFIED BY '{{ NEUTRON_DBPASS }}';
22 {% endfor %}
23
24 CREATE DATABASE nova;
25 {% for host in ['%', 'localhost', inventory_hostname] %}
26 GRANT ALL ON nova.* TO 'nova'@'{{ host }}' IDENTIFIED BY '{{ NOVA_DBPASS }}';
27 {% endfor %}
28
29 CREATE DATABASE cinder;
30 {% for host in ['%', 'localhost', inventory_hostname] %}
31 GRANT ALL ON cinder.* TO 'cinder'@'{{ host }}' IDENTIFIED BY '{{ CINDER_DBPASS }}';
32 {% endfor %}
33
34 {% if WSREP_SST_USER is defined %}
35 {% for host in ['%', 'localhost', inventory_hostname] %}
36 GRANT ALL ON *.* TO '{{ WSREP_SST_USER }}'@'{{ host }}' IDENTIFIED BY '{{ WSREP_SST_PASS }}';
37 {% endfor %}
38 {% endif %}
39 EOF