Commit 66328c79 by John Jarvis

Merge pull request #270 from carsongee/mongo_improvements

Updated mongo role to be more flexible for different deployment scenarios
parents c6ddbc5d 141f0470
cs_comments_mongo_user: cs_comments_service
cs_comments_mongo_password: password
cs_comments_database: cs_comments_service
mongo_dbpath: /var/lib/mongodb
mongo_logpath: /var/log/mongodb/mongodb.log
mongo_logappend: true
mongo_bind_ip: 127.0.0.1
mongo_extra_conf: ''
---
- name: restart mongo
service: name=mongodb state=restarted
......@@ -2,28 +2,41 @@
---
- name: mongo | install python-pymongo (req for ansible)
pip: name=pymongo
tags: mongo
- name: mongo | install mongo server and recommends
apt: pkg=mongodb-server state=present install_recommends=yes
tags: mongo
- name: mongo | stop mongo service
service: name=mongodb state=stopped
tags: mongo
- name: mongo | move mongodb to /mnt
command: mv /var/lib/mongodb /mnt/. creates=/mnt/mongodb
tags: mongo
- name: mongo | create mongodb symlink
file: src=/mnt/mongodb dest=/var/lib/mongodb state=link
tags: mongo
- name: mongo | copy configuration template
template: src=mongodb.conf.j2 dest=/etc/mongodb.conf backup=yes
notify: restart mongo
tags: mongo
- name: mongo | start mongo service
service: name=mongodb state=started
tags: mongo
- name: mongo | wait for mongo server to start
wait_for: port=27017 delay=2
tags: mongo
- name: mongo | create a mongodb user
mongodb_user: >
database=cs_comments_service
name=cs_comments_service
password=password
state=present
\ No newline at end of file
database={{ cs_comments_database }}
name={{ cs_comments_mongo_user }}
password={{ cs_comments_mongo_password }}
state=present
tags: mongo
# Do not edit this file directly, it was generated by ansible
# mongodb.conf
# Where to store the data.
dbpath={{ mongo_dbpath }}
#where to log
logpath={{ mongo_logpath }}
logappend={{ mongo_logappend }}
bind_ip = {{ mongo_bind_ip }}
#port = 27017
# Enable journaling, http://www.mongodb.org/display/DOCS/Journaling
journal=true
# Enables periodic logging of CPU utilization and I/O wait
#cpu = true
# Turn on/off security. Off is currently the default
#noauth = true
#auth = true
# Verbose logging output.
#verbose = true
# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true
# Enable db quota management
#quota = true
# Set oplogging level where n is
# 0=off (default)
# 1=W
# 2=R
# 3=both
# 7=W+some reads
#oplog = 0
# Diagnostic/debugging option
#nocursors = true
# Ignore query hints
#nohints = true
# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true
# Turns off server-side scripting. This will result in greatly limited
# functionality
#noscripting = true
# Turns off table scans. Any query that would do a table scan fails.
#notablescan = true
# Disable data file preallocation.
#noprealloc = true
# Specify .ns file size for new databases.
# nssize = <size>
# Accout token for Mongo monitoring server.
#mms-token = <token>
# Server name for Mongo monitoring server.
#mms-name = <server-name>
# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>
# Replication Options
# in replicated mongo databases, specify here whether this is a slave or master
#slave = true
#source = master.example.com
# Slave only: specify a single database to replicate
#only = master.example.com
# or
#master = true
#source = slave.example.com
# Address of a server to pair with.
#pairwith = <server:port>
# Address of arbiter server.
#arbiter = <server:port>
# Automatically resync if slave data is stale
#autoresync
# Custom size for replication operation log.
#oplogSize = <MB>
# Size limit for in-memory storage of op ids.
#opIdMem = <bytes>
{{ mongo_extra_conf }}
\ No newline at end of file
Markdown is supported
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