Commit f5be2b86 authored by bow's avatar bow
Browse files

Rename default post-install mongodb js script

parent 77005b85
......@@ -31,8 +31,8 @@ mongodb_daemon_name: "{{ 'mongod' if ('mongodb-org' in mongodb_package) else 'mo
# PyMongo version to install -- if evaluates to no, will install from apt instead
mongodb_pymongo_pip_version: "2.9"
# Custom JS script to run after installation
mongodb_js_script: "dbSetup.js"
# JS script that runs after installation for ensuring indices exist
mongodb_js_index_script: "dbIndexSetup.js"
# Location for misc files
mongodb_misc_dir: /opt/mongodb
......
---
- name: copy database config script if defined
copy: src={{ mongodb_js_script }} dest={{ mongodb_misc_dir }} owner={{ mongodb_user }} group={{ mongodb_user }} mode=0644
when: mongodb_js_script is defined
- name: copy index config script if defined
copy: src={{ mongodb_js_index_script }} dest={{ mongodb_misc_dir }} owner={{ mongodb_user }} group={{ mongodb_user }} mode=0644
when: mongodb_js_index_script is defined
- name: run database config script
shell: /usr/bin/mongo --quiet 127.0.0.1:27017/sentinel {{ mongodb_misc_dir }}/{{ mongodb_js_script }} -u {{ mongodb_root_name }} -p {{ mongodb_root_password }} --authenticationDatabase admin
when: mongodb_js_script is defined
register: js_script
changed_when: js_script.stdout != ""
shell: /usr/bin/mongo --quiet 127.0.0.1:27017/sentinel {{ mongodb_misc_dir }}/{{ mongodb_js_index_script }} -u {{ mongodb_root_name }} -p {{ mongodb_root_password }} --authenticationDatabase admin
when: mongodb_js_index_script is defined
register: js_index_script
changed_when: js_index_script.stdout != ""
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment