diff options
Diffstat (limited to 'deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml')
-rwxr-xr-x | deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml b/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml index 321c38d5..e3a68c55 100755 --- a/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml +++ b/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml @@ -1,8 +1,11 @@ --- -- name: copy replica js +- name: copy mongo js template: - src: replica.js - dest: /opt/replica.js + src: '{{ item.src }}' + dest: '{{ item.dest }}' + with_items: + - src: replica.js + dest: /opt/replica.js - name: init replica servers shell: mongo compass /opt/replica.js @@ -10,7 +13,16 @@ - name: wait replica servers are ready shell: mongo compass --eval 'printjson(rs.status())'|grep -E 'PRIMARY|SECONDARY'|wc -l register: servers - until: servers.stdout|int == 3 + until: servers.stdout|int == {{ haproxy_hosts|length }} + retries: 60 + delay: 10 + +- debug: msg='{{ servers.stdout |int }}' + +- name: wait replica servers are ready + shell: mongo compass --eval 'printjson(rs.status())'|grep -E 'PRIMARY'|wc -l + register: servers + until: servers.stdout|int == 1 retries: 60 delay: 10 @@ -18,7 +30,7 @@ - name: create mongodb user and db mongodb_user: - login_host: "{{ internal_vip.ip }}" + login_host: "{{ internal_ip }}" database: ceilometer name: ceilometer password: "{{ CEILOMETER_DBPASS }}" @@ -27,7 +39,7 @@ - name: grant user privilege mongodb_user: - login_host: "{{ internal_vip.ip }}" + login_host: "{{ internal_ip }}" database: ceilometer name: ceilometer password: "{{ CEILOMETER_DBPASS }}" |