default.rb 3.32 KB
#
# Author:: Earth U (<sysadmin @ chromedia.com>)
# Cookbook Name:: cfe-mongodb
# Attribute:: default
#
# Copyright (C) 2016, Chromedia Far East, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

default['cfe-mongodb']['local_ipv4'] = '127.0.0.1'

default['cfe-mongodb']['s3_region'] = 'us-east-1'
default['cfe-mongodb']['s3_bucket'] = 'test-bucket'

default['cfe-mongodb']['db']['map'] = {
  # The db_map format is:
  # 'example_db_name' => {
  #   :db_user => '<name_of_custom_user>',
  #   :db_pass => '<name_of_custom_pass>',
  #
  # Optional:
  #   :db_auth       => '<name_of_authentication_db>' # default is db_name
  #   :backup        => # default: true
  #   :bak_encrypted => # default: false
  #   :bak_filename  => # default is db_name
  #   :bak_maxcopies => # default: 30
  # }
}
default['cfe-mongodb']['db']['pass_root']   = 'secret'
default['cfe-mongodb']['db']['pass_backup'] = 'secret'

# Create custom key contents with:
#   $ openssl rand -base64 756
default['cfe-mongodb']['rs']['key']   = 'supersecretkeyxxx'
default['cfe-mongodb']['rs']['delay'] = 2
# Note: the following attributes for primary/secondary/arbiter
# should all include the port number (e.g. '1.2.3.4:27017')
default['cfe-mongodb']['rs']['nodes']['primary']   = ''
default['cfe-mongodb']['rs']['nodes']['secondary'] = []
default['cfe-mongodb']['rs']['nodes']['arbiter']   = []

default['cfe-mongodb']['install']['priv_dir']    = '/opt/mongodb/priv'
default['cfe-mongodb']['install']['bak_log_dir'] = '/var/log/mongodb_backup2s3'
default['cfe-mongodb']['install']['bak_sched']   = '0 7 * * *'

default['cfe-mongodb']['encrypt']['priv_key'] = nil
default['cfe-mongodb']['encrypt']['pub_key']  = nil

## Constant logrotate options if automated backups are used

default['cfe-mongodb']['logrotate']['conf_dir'] = '/etc/logrotate.d'
default['cfe-mongodb']['logrotate']['options'] = %w{
  weekly
  rotate\ 12
  missingok
  compress
  notifempty
}

## Constant location of binaries (at least for Ubuntu 14.04)

default['cfe-mongodb']['bin']['aws']       = '/usr/local/bin/aws'
default['cfe-mongodb']['bin']['mongo']     = '/usr/bin/mongo'
default['cfe-mongodb']['bin']['mongodump'] = '/usr/bin/mongodump'
default['cfe-mongodb']['bin']['openssl']   = '/usr/bin/openssl'

## mongodb3 attributes

default['mongodb3']['version'] = '3.2.8'

default['mongodb3']['mongod']['disable-transparent-hugepages'] = true

default['mongodb3']['config']['mongod']['net']['port']   = 27017
default['mongodb3']['config']['mongod']['net']['bindIp'] = '127.0.0.1'

default['mongodb3']['config']['mongod']['security']['authorization'] = 'enabled'
default['mongodb3']['config']['mongod']['security']['keyFile'] =
  "#{node['cfe-mongodb']['install']['priv_dir']}/mongod.rs.key"

default['mongodb3']['config']['mongod']['replication']['replSetName'] = 'test'
default['mongodb3']['config']['mongod']['replication']['oplogSizeMB'] = '1024'