This is an automated email from the ASF dual-hosted git repository.

dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 15ee068  Create _users database only if it does not already exist. 
(#4262)
15ee068 is described below

commit 15ee06874f437508d3ad05d739623a81e4c0b905
Author: rodric rabbah <[email protected]>
AuthorDate: Mon Feb 11 16:28:35 2019 -0500

    Create _users database only if it does not already exist. (#4262)
---
 ansible/roles/couchdb/tasks/deploy.yml | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/ansible/roles/couchdb/tasks/deploy.yml 
b/ansible/roles/couchdb/tasks/deploy.yml
index 8cad011..229c8ef 100644
--- a/ansible/roles/couchdb/tasks/deploy.yml
+++ b/ansible/roles/couchdb/tasks/deploy.yml
@@ -52,7 +52,17 @@
   retries: 12
   delay: 5
 
-- name: create '_users' database for singleton mode
+- name: check if '_users' database exists
+  uri:
+    url: "{{ db.protocol }}://{{ ansible_host }}:{{ db.port }}/_users"
+    method: HEAD
+    status_code: 200,404
+    user: "{{ db.credentials.admin.user }}"
+    password: "{{ db.credentials.admin.pass }}"
+    force_basic_auth: yes
+  register: create_users_db
+
+- name: create '_users' database for singleton mode if necessary
   uri:
     url: "{{ db.protocol }}://{{ ansible_host }}:{{ db.port }}/_users"
     method: PUT
@@ -60,7 +70,7 @@
     user: "{{ db.credentials.admin.user }}"
     password: "{{ db.credentials.admin.pass }}"
     force_basic_auth: yes
-  when: (inventory_hostname == coordinator) and (couchdb.version is 
version_compare('2.0','>='))
+  when: (create_users_db.status == 404) and (inventory_hostname == 
coordinator) and (couchdb.version is version_compare('2.0','>='))
 
 - name: enable the cluster setup mode
   uri:

Reply via email to