From 2ade45e1c74cebbedf322fcf652f5d92c81d2d63 Mon Sep 17 00:00:00 2001 From: Duong Ha-Quang Date: Fri, 24 Feb 2017 14:25:40 +0700 Subject: [PATCH] Fix Creating Ceilometer MongoDB database failed The check whether 'already' presents in mongodb output should belong to changed_when. Change-Id: Ib982a59820d53ccf5439f59df50c1b1938650967 Closes-Bug: #1641113 --- ansible/roles/ceilometer/tasks/bootstrap.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ansible/roles/ceilometer/tasks/bootstrap.yml b/ansible/roles/ceilometer/tasks/bootstrap.yml index 27be73a440..bc00ac3050 100644 --- a/ansible/roles/ceilometer/tasks/bootstrap.yml +++ b/ansible/roles/ceilometer/tasks/bootstrap.yml @@ -3,9 +3,8 @@ command: docker exec -t mongodb mongo --host {{ ceilometer_database_mongodb_address }} --eval 'db = db.getSiblingDB("{{ ceilometer_database_name }}"); db.createUser({user':' "{{ ceilometer_database_user }}", pwd':' "{{ ceilometer_database_password }}", roles':' [ "readWrite", "dbAdmin" ]})' register: mongodb_ceilometer_database run_once: true - failed_when: - - "'already' not in mongodb_ceilometer_database.stdout" - - mongodb_ceilometer_database.stdout.split()[4] != 'connecting' + changed_when: "{{ 'already' not in mongodb_ceilometer_database.stdout }}" + failed_when: "{{ mongodb_ceilometer_database.stdout.split()[4] != 'connecting' }}" delegate_to: "{{ groups['mongodb'][0] }}" when: - ceilometer_database_type == "mongodb"