Commit 1dc19bef authored by Flávio Ramalho's avatar Flávio Ramalho
Browse files

Better approach for checking if database exists

parent 2206783b
......@@ -13,6 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Import mon database
mysql_db:
state: "import"
name: "mon"
target: "/opt/sqls/mon_mysql.sql"
- name: Restart zookeeper
service:
name: "zookeeper"
......
......@@ -35,18 +35,16 @@
- monasca-influxdb-schema
- monasca-install-schema
- name: Create mon database
- name: Ensure mon database exists
mysql_db:
name: "{{ item }}"
name: "mon"
state: "present"
with_items:
- "mon"
when: schemas.changed
notify: Import mon database
tags:
- monasca-mysql-dbcreate
- monasca-install-schema
- name: Create database users
- name: Ensure database users
mysql_user:
name: "{{ item[0] }}"
password: "password"
......@@ -55,18 +53,8 @@
with_nested:
- ['notification', 'monapi', 'thresh']
- ['%', 'localhost', '{{ ansible_hostname }}']
- name: Setup mysql schemas
mysql_db:
state: "import"
name: "{{ item.name }}"
target: "/opt/sqls/{{ item.sql }}"
with_items:
- name: "mon"
sql: "mon_mysql.sql"
when: schemas.changed
tags:
- monasca-mysql-schema
- monasca-mysql-users
- monasca-install-schema
- name: Create kafka topics logs dir
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment