tests: Provide mongodb configuration template
Newer mongodb packages (>=3) have switched to YAML syntax for the configuration file. In order to simplify the test environment, and support both 2.x and 3.x versions, we provide our own configuration template file based on the CentOS7 one. Change-Id: If126f2cf813055cfb84cdcafaadcea4f204a76ee
This commit is contained in:
parent
6b87f13772
commit
1d25146bee
246
tests/templates/mongodb.conf.j2
Normal file
246
tests/templates/mongodb.conf.j2
Normal file
@ -0,0 +1,246 @@
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
##
|
||||
### Basic Defaults
|
||||
##
|
||||
|
||||
# Comma separated list of ip addresses to listen on (all local ips by default)
|
||||
bind_ip = {{ ansible_host }}
|
||||
|
||||
# Specify port number (27017 by default)
|
||||
#port = 27017
|
||||
|
||||
# Fork server process (false by default)
|
||||
{% if ansible_pkg_mgr == 'apt' %}
|
||||
fork = false
|
||||
{% else %}
|
||||
# CentOS and openSUSE use Type=forking in the systemd
|
||||
# service file
|
||||
fork = true
|
||||
{% endif %}
|
||||
|
||||
{% if ansible_service_mgr != 'systemd' %}
|
||||
# Full path to pidfile (if not set, no pidfile is created)
|
||||
pidfilepath = /var/run/mongodb/mongod.pid
|
||||
# Alternative directory for UNIX domain sockets (defaults to /tmp)
|
||||
unixSocketPrefix = /var/run/mongodb
|
||||
{% endif %}
|
||||
|
||||
# Log file to send write to instead of stdout - has to be a file, not directory
|
||||
logpath = /var/log/mongodb/{{ (ansible_pkg_mgr == 'yum') | ternary ('mongod.conf', 'mongodb.conf') }}
|
||||
|
||||
# Directory for datafiles (defaults to /data/db/)
|
||||
dbpath = /var/lib/mongodb
|
||||
|
||||
# Enable/Disable journaling (journaling is on by default for 64 bit)
|
||||
#journal = true
|
||||
#nojournal = true
|
||||
|
||||
|
||||
|
||||
##
|
||||
### General options
|
||||
##
|
||||
|
||||
# Be more verbose (include multiple times for more verbosity e.g. -vvvvv) (v by default)
|
||||
#verbose = v
|
||||
|
||||
# Max number of simultaneous connections (1000000 by default)
|
||||
#maxConns = 1000000
|
||||
|
||||
# Log to system's syslog facility instead of file or stdout (false by default)
|
||||
#syslog = true
|
||||
|
||||
# Syslog facility used for monogdb syslog message (user by defautl)
|
||||
#syslogFacility = user
|
||||
|
||||
# Append to logpath instead of over-writing (false by default)
|
||||
#logappend = true
|
||||
|
||||
# Desired format for timestamps in log messages (One of ctime, iso8601-utc or iso8601-local) (iso8601-local by default)
|
||||
#timeStampFormat = arg
|
||||
|
||||
# Private key for cluster authentication
|
||||
#keyFile = arg
|
||||
|
||||
# Set a configurable parameter
|
||||
#setParameter = arg
|
||||
|
||||
# Enable http interface (false by default)
|
||||
#httpinterface = true
|
||||
|
||||
# Authentication mode used for cluster authentication. Alternatives are (keyFile|sendKeyFile|sendX509|x509) (keyFile by default)
|
||||
#clusterAuthMode = arg
|
||||
|
||||
# Disable listening on unix sockets (false by default)
|
||||
#nounixsocket = true
|
||||
|
||||
# Run with/without security (without by default)
|
||||
#auth = true
|
||||
#noauth = true
|
||||
|
||||
# Enable IPv6 support (disabled by default)
|
||||
#ipv6 = true
|
||||
|
||||
# Allow JSONP access via http (has security implications) (false by default)
|
||||
#jsonp = true
|
||||
|
||||
# Turn on simple rest api (false by default)
|
||||
#rest = true
|
||||
|
||||
# Value of slow for profile and console log (100 by default)
|
||||
#slowms = 100
|
||||
|
||||
# 0=off 1=slow, 2=all (0 by default)
|
||||
#profile = 0
|
||||
|
||||
# Periodically show cpu and iowait utilization (false by default)
|
||||
#cpu = true
|
||||
|
||||
# Print some diagnostic system information (false by default)
|
||||
#sysinfo = true
|
||||
|
||||
# Each database will be stored in a separate directory (false by default)
|
||||
#directoryperdb = true
|
||||
|
||||
# Don't retry any index builds that were interrupted by shutdown (false by default)
|
||||
#noIndexBuildRetry = true
|
||||
|
||||
# Disable data file preallocation - will often hurt performance (false by default)
|
||||
#noprealloc = true
|
||||
|
||||
# .ns file size (in MB) for new databases (16 MB by default)
|
||||
#nssize = 16
|
||||
|
||||
# Limits each database to a certain number of files (8 default)
|
||||
#quota
|
||||
|
||||
# Number of files allowed per db, implies --quota (8 by default)
|
||||
#quotaFiles = 8
|
||||
|
||||
# Use a smaller default file size (false by default)
|
||||
smallfiles = true
|
||||
|
||||
# Seconds between disk syncs (0=never, but not recommended) (60 by default)
|
||||
#syncdelay = 60
|
||||
|
||||
# Upgrade db if needed (false by default)
|
||||
#upgrade = true
|
||||
|
||||
# Run repair on all dbs (false by default)
|
||||
#repair = true
|
||||
|
||||
# Root directory for repair files (defaults to dbpath)
|
||||
#repairpath = arg
|
||||
|
||||
# Disable scripting engine (false by default)
|
||||
#noscripting = true
|
||||
|
||||
# Do not allow table scans (false by default)
|
||||
#notablescan = true
|
||||
|
||||
# Journal diagnostic options (0 by default)
|
||||
#journalOptions = 0
|
||||
|
||||
# How often to group/batch commit (ms) (100 or 30 by default)
|
||||
#journalCommitInterval = 100
|
||||
|
||||
|
||||
|
||||
##
|
||||
### Replication options
|
||||
##
|
||||
|
||||
# Size to use (in MB) for replication op log (default 5% of disk space - i.e. large is good)
|
||||
#oplogSize = arg
|
||||
|
||||
|
||||
|
||||
##
|
||||
### Master/slave options (old; use replica sets instead)
|
||||
##
|
||||
|
||||
# Master mode
|
||||
#master = true
|
||||
|
||||
# Slave mode
|
||||
#slave = true
|
||||
|
||||
# When slave: specify master as <server:port>
|
||||
#source = arg
|
||||
|
||||
# When slave: specify a single database to replicate
|
||||
#only = arg
|
||||
|
||||
# Specify delay (in seconds) to be used when applying master ops to slave
|
||||
#slavedelay = arg
|
||||
|
||||
# Automatically resync if slave data is stale
|
||||
#autoresync = true
|
||||
|
||||
|
||||
|
||||
##
|
||||
### Replica set options
|
||||
##
|
||||
|
||||
# Arg is <setname>[/<optionalseedhostlist>]
|
||||
#replSet = arg
|
||||
|
||||
# Specify index prefetching behavior (if secondary) [none|_id_only|all] (all by default)
|
||||
#replIndexPrefetch = all
|
||||
|
||||
|
||||
|
||||
##
|
||||
### Sharding options
|
||||
##
|
||||
|
||||
# Declare this is a config db of a cluster (default port 27019; default dir /data/configdb) (false by default)
|
||||
#configsvr = true
|
||||
|
||||
# Declare this is a shard db of a cluster (default port 27018) (false by default)
|
||||
#shardsvr = true
|
||||
|
||||
|
||||
|
||||
##
|
||||
### SSL options
|
||||
##
|
||||
|
||||
# Use ssl on configured ports
|
||||
#sslOnNormalPorts = true
|
||||
|
||||
# Set the SSL operation mode (disabled|allowSSL|preferSSL|requireSSL)
|
||||
# sslMode = arg
|
||||
|
||||
# PEM file for ssl
|
||||
#sslPEMKeyFile = arg
|
||||
|
||||
# PEM file password
|
||||
#sslPEMKeyPassword = arg
|
||||
|
||||
# Key file for internal SSL authentication
|
||||
#sslClusterFile = arg
|
||||
|
||||
# Internal authentication key file password
|
||||
#sslClusterPassword = arg
|
||||
|
||||
# Certificate Authority file for SSL
|
||||
#sslCAFile = arg
|
||||
|
||||
# Certificate Revocation List file for SSL
|
||||
#sslCRLFile = arg
|
||||
|
||||
# Allow client to connect without presenting a certificate
|
||||
#sslWeakCertificateValidation = true
|
||||
|
||||
# Allow server certificates to provide non-matching hostnames
|
||||
#sslAllowInvalidHostnames = true
|
||||
|
||||
# Allow connections to servers with invalid certificates
|
||||
#sslAllowInvalidCertificates = true
|
||||
|
||||
# Activate FIPS 140-2 mode at startup
|
||||
#sslFIPSMode = true
|
||||
|
@ -50,19 +50,11 @@
|
||||
name: pymongo
|
||||
when: ansible_pkg_mgr == 'yum'
|
||||
|
||||
- name: Configure the MongoDB bind address
|
||||
lineinfile:
|
||||
- name: Configure the MongoDB
|
||||
template:
|
||||
src: "mongodb.conf.j2"
|
||||
dest: "{{ mongodb_config_file }}"
|
||||
regexp: "^(#)?bind_ip"
|
||||
line: "bind_ip = {{ ansible_host }}"
|
||||
register: mongodb_bind
|
||||
|
||||
- name: Enable the MongoDB smallfiles option
|
||||
lineinfile:
|
||||
dest: "{{ mongodb_config_file }}"
|
||||
regexp: "^(#)?smallfiles"
|
||||
line: "smallfiles = true"
|
||||
register: mongodb_smallfiles
|
||||
register: mongodb_configured
|
||||
|
||||
- name: Restart mongodb
|
||||
service:
|
||||
@ -70,7 +62,7 @@
|
||||
state: restarted
|
||||
enabled: yes
|
||||
when:
|
||||
- mongodb_bind | changed or mongodb_smallfiles | changed
|
||||
- mongodb_configured | changed
|
||||
register: mongodb_restart
|
||||
|
||||
- name: Wait for mongodb to come back online after the restart
|
||||
|
Loading…
Reference in New Issue
Block a user