From 63b4989c33e41d44e5fa78176505e1091a2c605d Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Wed, 13 Jul 2016 12:24:11 -0500 Subject: [PATCH] Update mongodb bootstrap tasks When deploying on hosts with PyMongo version > 3.0, as found on Xenial hosts, The bootstrap playbook will fail due to the following error: 'The localhost login exception only allows the first admin account to be created' To resolve this error a "root" user create and password setup has been added to the tasks and the required login credentials have been passed to the ceilometer and aodh tasks. Change-Id: Iaa29b4256dd4b3ac0774a05fc55f5b845ee57732 Signed-off-by: Kevin Carter --- tests/roles/bootstrap-host/defaults/main.yml | 3 +++ .../tasks/prepare_mongodb_users.yml | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/roles/bootstrap-host/defaults/main.yml b/tests/roles/bootstrap-host/defaults/main.yml index 85624a6777..ceef044398 100644 --- a/tests/roles/bootstrap-host/defaults/main.yml +++ b/tests/roles/bootstrap-host/defaults/main.yml @@ -90,6 +90,9 @@ bootstrap_host_mongodb_users: "{{ bootstrap_host_mongodb_service }}" # # Specify the IP address of a MongoDB Host. bootstrap_host_mongodb_address: 172.29.236.100 +# +# Specify the password to be used with the first mongo admin user +bootstrap_host_mongodb_password: SuperSecrete ### Optional Settings ### diff --git a/tests/roles/bootstrap-host/tasks/prepare_mongodb_users.yml b/tests/roles/bootstrap-host/tasks/prepare_mongodb_users.yml index e600f973ad..06a7172216 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_mongodb_users.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_mongodb_users.yml @@ -18,9 +18,22 @@ tags: - mongodb-secrets +- name: Add admin user + mongodb_user: + login_host: "{{ bootstrap_host_mongodb_address }}" + database: admin + name: root + password: "{{ bootstrap_host_mongodb_password }}" + roles: 'root' + state: present + tags: + - mongodb-create-user-admin + - name: Add ceilometer database user mongodb_user: login_host: "{{ bootstrap_host_mongodb_address }}" + login_user: "root" + login_password: "{{ bootstrap_host_mongodb_password }}" database: ceilometer name: ceilometer password: "{{ ceilometer_container_db_password }}" @@ -32,6 +45,8 @@ - name: Add aodh database user mongodb_user: login_host: "{{ bootstrap_host_mongodb_address }}" + login_user: "root" + login_password: "{{ bootstrap_host_mongodb_password }}" database: aodh name: aodh password: "{{ aodh_container_db_password }}"