Added a lot of new feautures
This commit is contained in:
parent
d6aa8e0ffa
commit
3efddcf91d
|
@ -17,15 +17,6 @@
|
|||
- name: Configure logs
|
||||
file: state=file path={{ mongodb_conf_logpath }} owner={{mongodb_user}} group={{mongodb_user}} mode=0644
|
||||
|
||||
- name: Create keyFile
|
||||
copy:
|
||||
dest: "{{ mongodb_conf_keyFile }}"
|
||||
content: "{{ mongodb_keyfile_content }}"
|
||||
owner: "{{ mongodb_user }}"
|
||||
group: "root"
|
||||
mode: 0600
|
||||
when: mongodb_conf_replSet != ""
|
||||
|
||||
- name: Run mongoshell commands
|
||||
command: mongo {{ item.key }} --eval "{{ item.value|join('\n') }}"
|
||||
with_dict: mongodb_shell
|
||||
|
|
|
@ -12,5 +12,9 @@
|
|||
- include: authorization.yml
|
||||
when: mongodb_conf_auth == "yes"
|
||||
|
||||
- meta: flush handlers
|
||||
- include: replication.yml
|
||||
when: mongodb_conf_replSet != ""
|
||||
|
||||
- include: mms-agent.yml
|
||||
when: mongodb_mms_api_key != ""
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
|
||||
- name: Create keyFile
|
||||
copy:
|
||||
dest: "{{ mongodb_conf_keyFile }}"
|
||||
content: "{{ mongodb_keyfile_content }}"
|
||||
owner: "{{ mongodb_user }}"
|
||||
group: "root"
|
||||
mode: 0600
|
||||
|
||||
- name: Check replication status
|
||||
shell: "{{ item }}"
|
||||
register: replication_status
|
||||
when: mongodb_conf_auth == "yes"
|
||||
with_items:
|
||||
- /usr/bin/mongo --username {{ mongodb_root_admin_name }} --password {{ mongodb_root_admin_password }} admin --eval 'printjson(rs.status())' | tail -n +3
|
||||
- /usr/bin/mongo admin --eval 'printjson(rs.status())' | tail -n +3
|
||||
changed_when: false
|
||||
|
||||
- debug:
|
||||
msg: "{{ (replication_status.results[0].stdout|from_json).errmsg }}"
|
||||
|
||||
- name: Create the file to initialize the mongod replica set
|
||||
template: src=repset_init.js.j2 dest=/tmp/repset_init.js
|
||||
when: mongodb_conf_auth == "yes" and (replication_status.results[0].stdout|from_json).errmsg | search("EMPTYCONFIG")
|
||||
|
||||
- name: Initialize replica set
|
||||
shell: /usr/bin/mongo --username {{ mongodb_root_admin_name }} --password {{ mongodb_root_admin_password }} admin /tmp/repset_init.js
|
||||
when: mongodb_conf_auth == "yes" and (replication_status.results[0].stdout|from_json).errmsg | search("EMPTYCONFIG")
|
|
@ -0,0 +1,7 @@
|
|||
rs.initiate()
|
||||
sleep(5000)
|
||||
{% for host in groups['replication_servers'] %}
|
||||
rs.add("{{ host }}:{{ mongodb_conf_port }}")
|
||||
sleep(8000)
|
||||
{% endfor %}
|
||||
printjson(rs.status())
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
|
||||
mongodb_repository: deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
|
||||
mongodb_repository: deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
|
||||
mongodb_repository: deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen
|
||||
mongodb_repository: deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
|
||||
|
|
Loading…
Reference in New Issue