blob: 573b30a92aa98a6a0402578bbc9c733b229e5193 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
---
- name: copy replica js
template:
src: replica.js
dest: /opt/replica.js
- name: init replica servers
shell: mongo compass /opt/replica.js
- 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
retries: 20
delay: 3
- debug: msg='{{ servers.stdout |int }}'
- name: create mongodb user and db
mongodb_user:
login_host: "{{ internal_vip.ip }}"
database: ceilometer
name: ceilometer
password: "{{ CEILOMETER_DBPASS }}"
roles: 'readWrite,dbAdmin'
state: present
- name: grant user privilege
mongodb_user:
login_host: "{{ internal_vip.ip }}"
database: ceilometer
name: ceilometer
password: "{{ CEILOMETER_DBPASS }}"
roles: 'readWrite,dbAdmin'
state: present
|