From c6dd71411aaf2f110e34a524824b67962d7ea068 Mon Sep 17 00:00:00 2001 From: liyingjun Date: Fri, 22 Jul 2016 15:42:05 +0800 Subject: [PATCH] Add precheck for ceilometer backend Currently when set enable_ceilometer: true and enable_mongodb: no, the deploy will fail with ceilometer database creating error. Add a precheck to avoid this situation in both prechecks and bootstrap. Change-Id: I2d46ef9adeb8e028f3c18e6bc2d3752cc39bcb29 Closes-bug: #1605522 --- ansible/roles/ceilometer/tasks/bootstrap.yml | 5 +++++ ansible/roles/prechecks/tasks/service_checks.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ansible/roles/ceilometer/tasks/bootstrap.yml b/ansible/roles/ceilometer/tasks/bootstrap.yml index d519d9e8d3..13fd87f9b3 100644 --- a/ansible/roles/ceilometer/tasks/bootstrap.yml +++ b/ansible/roles/ceilometer/tasks/bootstrap.yml @@ -1,4 +1,9 @@ --- +- name: Checking backend for ceilometer + local_action: fail msg="No backend enabled for ceilometer. Mongodb is the only supported one for now" + changed_when: false + when: enable_ceilometer | bool and not enable_mongodb | bool + - name: Creating Ceilometer database command: docker exec -t mongodb mongo --host {{ ceilometer_database_address }} --eval 'db = db.getSiblingDB("{{ ceilometer_database_name }}"); db.addUser({user':' "{{ ceilometer_database_user }}", pwd':' "{{ ceilometer_database_password}}", roles':' [ "readWrite", "dbAdmin" ]})' register: database diff --git a/ansible/roles/prechecks/tasks/service_checks.yml b/ansible/roles/prechecks/tasks/service_checks.yml index 1faa83185f..700f3a2760 100644 --- a/ansible/roles/prechecks/tasks/service_checks.yml +++ b/ansible/roles/prechecks/tasks/service_checks.yml @@ -56,3 +56,8 @@ - enable_neutron_agent_ha | bool - groups['neutron-dhcp-agent'] | length < 2 or groups['neutron-l3-agent'] | length < 2 + +- name: Checking backend for ceilometer + local_action: fail msg="No backend enabled for ceilometer. Mongodb is the only supported one for now" + changed_when: false + when: enable_ceilometer | bool and not enable_mongodb | bool