Skip to content

Commit

Permalink
Move params to classes and hiera; Align defaults with supported versions
Browse files Browse the repository at this point in the history
  • Loading branch information
h-haaks committed Mar 21, 2024
1 parent b4f0d17 commit 625aa83
Show file tree
Hide file tree
Showing 15 changed files with 224 additions and 576 deletions.
361 changes: 109 additions & 252 deletions REFERENCE.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions data/Debian-family.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
mongodb::server::user: 'mongodb'
mongodb::server::group: 'mongodb'
mongodb::mongos::service_user: 'mongodb'
mongodb::mongos::service_group: 'mongodb'
7 changes: 7 additions & 0 deletions data/Linux-family.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# Amazon uses os family Linux
mongodb::server::user: 'mongod'
mongodb::server::group: 'mongod'
mongodb::server::journal: true
mongodb::mongos::service_user: 'mongod'
mongodb::mongos::service_group: 'mongod'
3 changes: 3 additions & 0 deletions data/RedHat-family.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
mongodb::server::user: 'mongod'
mongodb::server::group: 'mongod'
mongodb::server::journal: true
mongodb::mongos::service_user: 'mongod'
mongodb::mongos::service_group: 'mongod'
6 changes: 6 additions & 0 deletions data/Suse-family.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
mongodb::server::user: 'mongod'
mongodb::server::group: 'mongod'
mongodb::server::journal: true
mongodb::mongos::service_user: 'mongod'
mongodb::mongos::service_group: 'mongod'
6 changes: 3 additions & 3 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# If not specified, the module will use whatever service name is the default for your OS distro.
#
class mongodb::client (
String[1] $ensure = $mongodb::client::params::package_ensure,
String[1] $package_name = $mongodb::client::params::package_name,
) inherits mongodb::client::params {
String[1] $ensure = pick($mongodb::globals::version, 'present'),
String[1] $package_name = "mongodb-${mongodb::globals::edition}-shell",
) inherits mongodb::globals {
package { 'mongodb_client':
ensure => $ensure,
name => $package_name,
Expand Down
18 changes: 0 additions & 18 deletions manifests/client/params.pp

This file was deleted.

122 changes: 25 additions & 97 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,64 +28,23 @@
# -> class {'mongodb::server': }
# -> class {'mongodb::client': }
#
# @param server_package_name
# This setting can be used to override the default MongoDB server package name.
# If not specified, the module will use whatever package name is the default for your OS distro.
#
# @param client_package_name
# This setting can be used to specify the name of the client package that should be installed.
# If not specified, the module will use whatever service name is the default for your OS distro.
#
# @param mongod_service_manage
# This setting can be used to override the default management of the mongod service.
# By default the module will manage the mongod process.
# @param service_enable
# This setting can be used to specify if the service should be enable at boot
#
# @param service_ensure
# This setting can be used to specify if the service should be running
#
# @param service_name
# This setting can be used to override the default MongoDB service name.
# If not specified, the module will use whatever service name is the default for your OS distro.
#
# @param service_provider
# This setting can be used to override the default MongoDB service provider.
# If not specified, the module will use whatever service provider is the default for your OS distro.
#
# @param service_status
# This setting can be used to override the default status check command for your MongoDB service.
# If not specified, the module will use whatever service name is the default for your OS distro.
#
# @param user
# This setting can be used to override the default MongoDB user and owner of the service and related files in the file system.
# If not specified, the module will use the default for your OS distro.
#
# @param group
# This setting can be used to override the default MongoDB user group to be used for related files in the file system.
# If not specified, the module will use the default for your OS distro.
#
# @param ipv6
# This setting is used to configure MongoDB to turn on ipv6 support.
# If not specified and ipv6 address is passed to MongoDB bind_ip it will just fail.
#
# @param bind_ip
# This setting can be used to configure MonogDB process to bind to and listen for connections from applications on this address.
# If not specified, the module will use the default for your OS distro.
# Note: This value should be passed as an array.
#
# @param version
# The version of MonogDB to install/manage. This is needed when managing repositories.
# If not specified, the module will use the default for your OS distro.
# The version of MonogDB to install/manage.
# If not specified, the module will ensure packages with `present`.
#
# @param manage_package_repo
# Whether to manage MongoDB software repository.
#
# @param repo_version
# The version of the package repo.
#
# @param manage_package_repo
# Whether to use the MongoDB software repository or the OS packages (True) or a Custom repo (False)
# @param use_enterprise_repo
# When manage_package_repo is set to true, this setting indicates if it will use the Community Edition
# (false, the default) or the Enterprise one (true).
#
# @param manage_package
# wgether this module willm manage the mongoDB server package
# @param repo_location
# This setting can be used to override the default MongoDB repository location.
# If not specified, the module will use the default repository for your OS distro.
#
# @param repo_proxy
# This will allow you to set a proxy for your repository in case you are behind a corporate firewall.
Expand All @@ -97,53 +56,19 @@
# @param proxy_password
# This sets the password for the proxyserver, should authentication be required
#
# @param repo_location
# This setting can be used to override the default MongoDB repository location.
# If not specified, the module will use the default repository for your OS distro.
#
# @param use_enterprise_repo
# When manage_package_repo is set to true, this setting indicates if it will use the Community Edition
# (false, the default) or the Enterprise one (true).
#
# @param pidfilepath
# Specify a file location to hold the PID or process ID of the mongod process.
# If not specified, the module will use the default for your OS distro.
#
# @param pidfilemode
# The file mode of the pid file
#
# @param manage_pidfile
# If true, the pidfile will be managed by puppet
# @param aptkey_options
# Options for debian aptkey
#
class mongodb::globals (
$server_package_name = undef,
$client_package_name = undef,

$mongod_service_manage = undef,
$service_enable = undef,
$service_ensure = undef,
$service_name = undef,
$service_provider = undef,
$service_status = undef,

$user = undef,
$group = undef,
$ipv6 = undef,
$bind_ip = undef,
Optional[String[1]] $version = undef,
String[1] $repo_version = '5.0',
Boolean $manage_package_repo = true,
$manage_package = undef,
$repo_proxy = undef,
$proxy_username = undef,
$proxy_password = undef,

$repo_location = undef,
$use_enterprise_repo = undef,

$pidfilepath = undef,
$pidfilemode = undef,
$manage_pidfile = undef,
Optional[String[1]] $version = undef,
Boolean $manage_package_repo = true,
String[1] $repo_version = '5.0',
Boolean $use_enterprise_repo = false,
Optional[String] $repo_location = undef,
Optional[String] $repo_proxy = undef,
Optional[String] $proxy_username = undef,
Optional[String] $proxy_password = undef,
Optional[String[1]] $aptkey_options = undef,
) {
if $use_enterprise_repo {
$edition = 'enterprise'
Expand All @@ -159,6 +84,9 @@
use_enterprise_repo => $use_enterprise_repo,
repo_location => $repo_location,
proxy => $repo_proxy,
proxy_username => $proxy_username,
proxy_password => $proxy_password,
aptkey_options => $aptkey_options,
}
}
}
48 changes: 24 additions & 24 deletions manifests/mongos.pp
Original file line number Diff line number Diff line change
Expand Up @@ -85,30 +85,30 @@
# Specifies whether the service should be restarted on config changes.
#
class mongodb::mongos (
Stdlib::Absolutepath $config = $mongodb::mongos::params::config,
Optional[String[1]] $config_content = $mongodb::mongos::params::config_content,
Optional[String[1]] $config_template = $mongodb::mongos::params::config_template,
Variant[String[1], Array[String[1]]] $configdb = $mongodb::mongos::params::configdb,
Optional[Hash] $config_data = $mongodb::mongos::params::config_data,
Boolean $service_manage = $mongodb::mongos::params::service_manage,
Optional[String] $service_provider = $mongodb::mongos::params::service_provider,
Optional[String] $service_name = $mongodb::mongos::params::service_name,
String $service_user = 'mongodb',
String $service_group = 'mongodb',
Optional[String[1]] $service_template = $mongodb::mongos::params::service_template,
Boolean $service_enable = $mongodb::mongos::params::service_enable,
Stdlib::Ensure::Service $service_ensure = $mongodb::mongos::params::service_ensure,
Optional[String] $service_status = $mongodb::mongos::params::service_status,
Variant[Boolean, String] $package_ensure = $mongodb::mongos::params::package_ensure,
String $package_name = $mongodb::mongos::params::package_name,
Optional[Stdlib::Absolutepath] $unixsocketprefix = $mongodb::mongos::params::unixsocketprefix,
Optional[Stdlib::Absolutepath] $pidfilepath = $mongodb::mongos::params::pidfilepath,
Optional[Variant[Boolean, Stdlib::Absolutepath]] $logpath = $mongodb::mongos::params::logpath,
Optional[Boolean] $fork = $mongodb::mongos::params::fork,
Optional[Array[Stdlib::IP::Address]] $bind_ip = $mongodb::mongos::params::bind_ip,
Optional[Stdlib::Port] $port = $mongodb::mongos::params::port,
Boolean $restart = $mongodb::mongos::params::restart,
) inherits mongodb::mongos::params {
Stdlib::Absolutepath $config = '/etc/mongos.conf',
Optional[String[1]] $config_content = undef,
Optional[String[1]] $config_template = undef,
Variant[String[1], Array[String[1]]] $configdb = '127.0.0.1:27019',
Optional[Hash] $config_data = undef,
Boolean $service_manage = true,
Optional[String] $service_provider = undef,
String[1] $service_name = 'mongos',
String[1] $service_user = 'mongodb',
String[1] $service_group = 'mongodb',
String[1] $service_template = 'mongodb/mongos/mongos.service-dropin.epp',
Boolean $service_enable = true,
Stdlib::Ensure::Service $service_ensure = 'running',
Optional[String] $service_status = undef,
String[1] $package_ensure = pick($mongodb::globals::version, 'present'),
String $package_name = "mongodb-${mongodb::globals::edition}-mongos",
Stdlib::Absolutepath $unixsocketprefix = '/var/run/mongodb',
Stdlib::Absolutepath $pidfilepath = '/var/run/mongodb/mongos.pid',
Variant[Boolean, Stdlib::Absolutepath] $logpath = '/var/log/mongodb/mongos.log',
Boolean $fork = true,
Optional[Array[Stdlib::IP::Address]] $bind_ip = undef,
Optional[Stdlib::Port] $port = undef,
Boolean $restart = true,
) inherits mongodb::globals {
contain mongodb::mongos::install
contain mongodb::mongos::config
contain mongodb::mongos::service
Expand Down
40 changes: 0 additions & 40 deletions manifests/mongos/params.pp

This file was deleted.

81 changes: 0 additions & 81 deletions manifests/params.pp

This file was deleted.

Loading

0 comments on commit 625aa83

Please sign in to comment.