forked from ISTI-ansible-roles/ansible-roles
library/roles/mongodb-org-3: Better templating. Pass additional parameters with /etc/default/mongod. Removed the old configuration templates.
This commit is contained in:
parent
3428052604
commit
2b451cdda2
|
@ -3,23 +3,34 @@ mongodb_install_from_external_repo: True
|
|||
mongodb_install_packages: True
|
||||
mongodb_install_conf: True
|
||||
# Set to 'latest' if you want to get the latest available package
|
||||
mongodb_pkg_state: installed
|
||||
mongodb_pkg_state: latest
|
||||
mongodb_start_server: 'no'
|
||||
mongodb_tcp_port: 27017
|
||||
mongodb_http_interface: False
|
||||
mongodb_http_interface: 'false'
|
||||
mongodb_http_port: 28017
|
||||
mongodb_user: mongodb
|
||||
mongodb_group: mongodb
|
||||
mongodb_logdir: /var/log/mongodb
|
||||
mongodb_log_file: mongodb.log
|
||||
mongodb_log_file: mongod.log
|
||||
mongodb_logpath: '{{ mongodb_logdir }}/{{ mongodb_log_file }}'
|
||||
mongodb_dbpath: /var/lib/mongodb
|
||||
mongodb_log_retain_days: 7
|
||||
mongodb_directoryperdb: False
|
||||
mongodb_directoryperdb: 'false'
|
||||
mongodb_conf_file: /etc/mongod.conf
|
||||
mongodb_daemon: /usr/bin/mongod
|
||||
mongod_additional_options: ""
|
||||
mongodb_allowed_hosts:
|
||||
- 127.0.0.1/8
|
||||
- '{{ ansible_default_ipv4.address }}/32'
|
||||
|
||||
mongodb_storage_engine: wiredTiger
|
||||
|
||||
mongodb_systemlog_destination: file
|
||||
mongodb_systemlog_logappend: 'true'
|
||||
mongodb_systemlog_logrotate: reopen
|
||||
|
||||
|
||||
|
||||
mongodb_cluster_enabled: False
|
||||
mongodb_replicaset: storagedev
|
||||
mongodb_replica_keyfile: '{{ mongodb_dbpath }}/replica_keyfile'
|
||||
|
@ -28,4 +39,3 @@ mongodb_ganglia_auth_enabled: False
|
|||
mongodb_ganglia_db: admin
|
||||
mongodb_ganglia_auth_mechanism: MONGODB-CR
|
||||
# User and password are stored in the variables mongo_monitoring_u and mongo_monitoring_pwd
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
---
|
||||
- name: Update apt cache
|
||||
apt: update_cache=yes
|
||||
ignore_errors: true
|
||||
|
||||
- name: Restart mongod
|
||||
- name: Restart mongodb
|
||||
service: name=mongod state=restarted
|
||||
when: "'{{ mongodb_start_server }}' == 'yes'"
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
tags: mongodb
|
||||
|
||||
- name: Install the mongodb repository
|
||||
copy: content="deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" dest=/etc/apt/sources.list.d/mongodb-org-3.0.list owner=root group=root mode=044
|
||||
copy: content="deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.0 multiverse" dest=/etc/apt/sources.list.d/mongodb-org-3.0.list owner=root group=root mode=044
|
||||
when: mongodb_install_from_external_repo
|
||||
register: external_repo
|
||||
tags: mongodb
|
||||
|
@ -42,6 +42,13 @@
|
|||
- name: Install the mongodb 3.0 configuration
|
||||
template: src=mongod-3.0.conf.j2 dest=/etc/mongod.conf owner=root group=root mode=0444
|
||||
when: mongodb_install_conf
|
||||
notify: Restart mongodb
|
||||
tags: mongodb
|
||||
|
||||
- name: Install the mongodb defaults file
|
||||
template: src=mongod-default.j2 dest=/etc/default/mongod owner=root group=root mode=0444
|
||||
when: mongodb_install_conf
|
||||
notify: Restart mongodb
|
||||
tags: mongodb
|
||||
|
||||
- name: Install the cron job that manages log files rotation
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
# mongod.conf
|
||||
|
||||
# Where to store the data.
|
||||
|
||||
# Note: if you run mongodb as a non-root user (recommended) you may
|
||||
# need to create and set permissions for this directory manually,
|
||||
# e.g., if the parent directory isn't mutable by the mongodb user.
|
||||
dbpath={{ mongodb_dbpath }}
|
||||
directoryperdb={{ mongodb_directoryperdb }}
|
||||
|
||||
#where to log
|
||||
logpath={{ mongodb_logpath }}
|
||||
|
||||
logappend=true
|
||||
|
||||
port = {{ mongodb_tcp_port }}
|
||||
|
||||
# Listen to local interface only. Comment out to listen on all interfaces.
|
||||
#bind_ip = 127.0.0.1
|
||||
|
||||
# Disables write-ahead journaling
|
||||
# nojournal = 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
|
||||
#diaglog = 0
|
||||
|
||||
# Ignore query hints
|
||||
#nohints = true
|
||||
|
||||
|
||||
{% if not mongodb_http_interface %}
|
||||
# Disable the HTTP interface (Defaults to localhost:28017).
|
||||
nohttpinterface = true
|
||||
{% endif %}
|
||||
|
||||
# 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>
|
||||
|
||||
{% if mongodb_cluster_enabled %}
|
||||
# Replication Options
|
||||
|
||||
# in replicated mongo databases, specify the replica set name here
|
||||
replSet = {{ mongodb_replicaset }}
|
||||
# maximum size in megabytes for replication operation log
|
||||
#oplogSize=1024
|
||||
# path to a key file storing authentication info for connections
|
||||
# between replica set members
|
||||
keyFile=/data/mongo_home/dev-d4science-keyfile
|
||||
{% endif %}
|
||||
|
|
@ -8,37 +8,37 @@ storage:
|
|||
dbPath: {{ mongodb_dbpath }}
|
||||
journal:
|
||||
enabled: true
|
||||
engine: wiredTiger
|
||||
directoryPerDB: {{ mongodb_directoryperdb }}
|
||||
engine: {{ mongodb_storage_engine }}
|
||||
# mmapv1:
|
||||
# wiredTiger:
|
||||
|
||||
# where to write logging data.
|
||||
systemLog:
|
||||
destination: file
|
||||
logAppend: true
|
||||
destination: {{ mongodb_systemlog_destination }}
|
||||
logAppend: {{ mongodb_systemlog_logappend }}
|
||||
path: {{ mongodb_logpath }}
|
||||
logRotate: {{ mongodb_systemlog_logrotate }}
|
||||
|
||||
# network interfaces
|
||||
net:
|
||||
port: {{ mongodb_tcp_port }}
|
||||
# bindIp: 127.0.0.1
|
||||
|
||||
# bindIp: 127.0.0.1
|
||||
http:
|
||||
enabled: {{ mongodb_http_interface }}
|
||||
JSONPEnabled: {{ mongodb_http_interface }}
|
||||
RESTInterfaceEnabled: {{ mongodb_http_interface }}
|
||||
|
||||
#processManagement:
|
||||
|
||||
{%if mongodb_cluster_enabled %}
|
||||
security:
|
||||
keyFile: /data/mongo_home/dev-d4science-keyfile
|
||||
|
||||
#operationProfiling:
|
||||
|
||||
replication:
|
||||
oplogSizeMB: 2000
|
||||
replSetName: {{ mongodb_replicaset }}
|
||||
{% endif %}
|
||||
|
||||
#sharding:
|
||||
|
||||
## Enterprise-Only Options:
|
||||
|
||||
#auditLog:
|
||||
|
||||
#snmp:
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
ENABLE_MONGOD="{{ mongodb_start_server }}"
|
||||
CONF={{ mongodb_conf_file }}
|
||||
DAEMON={{ mongodb_daemon }}
|
||||
DAEMONUSER={{ mongodb_user }}
|
||||
DAEMON_OPTS="{{ mongod_additional_options }} --config $CONF"
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
# Note: if you run mongodb as a non-root user (recommended) you may
|
||||
# need to create and set permissions for this directory manually,
|
||||
# e.g., if the parent directory isn't mutable by the mongodb user.
|
||||
dbpath={{ mongodb_dbpath }}
|
||||
directoryperdb={{ mongodb_directoryperdb }}
|
||||
|
||||
#where to log
|
||||
logpath={{ mongodb_logpath }}
|
||||
|
||||
logappend=true
|
||||
|
||||
port = {{ mongodb_tcp_port }}
|
||||
|
||||
# Disables write-ahead journaling
|
||||
# nojournal = 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
|
||||
#diaglog = 0
|
||||
# Ignore query hints
|
||||
#nohints = true
|
||||
|
||||
{% if not mongodb_http_interface %}
|
||||
# Disable the HTTP interface (Defaults to localhost:28017).
|
||||
nohttpinterface = true
|
||||
{% endif %}
|
||||
|
||||
# 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 master/slave 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
|
||||
|
||||
{% if mongodb_cluster_enabled %}
|
||||
# in replica set configuration, specify the name of the replica set
|
||||
replSet = {{ mongodb_replicaset }}
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue