Puppet Class: mongodb::mongos::service

Defined in:
manifests/mongos/service.pp

Summary

Manages the mongos service

Overview

Parameters:

  • package_ensure (Any) (defaults to: $mongodb::mongos::package_ensure)

    This setting can be used to specify if puppet should install the package or not.

  • service_manage (Any) (defaults to: $mongodb::mongos::service_manage)

    Whether or not the MongoDB sharding service resource should be part of the catalog.

  • service_name (Any) (defaults to: $mongodb::mongos::service_name)

    This setting can be used to override the default Mongos service name. If not specified, the module will use whatever service name is the default for your OS distro.

  • service_enable (Any) (defaults to: $mongodb::mongos::service_enable)

    This setting can be used to specify if the service should be enable at boot.

  • service_ensure (Any) (defaults to: $mongodb::mongos::service_ensure)

    This setting can be used to specify if the service should be running.

  • service_status (Any) (defaults to: $mongodb::mongos::service_status)

    This setting can be used to override the default status check command for your Mongos service. If not specified, the module will use whatever service name is the default for your OS distro.

  • service_provider (Any) (defaults to: $mongodb::mongos::service_provider)

    This setting can be used to override the default Mongos service provider. If not specified, the module will use whatever service provider is the default for your OS distro.

  • bind_ip (Any) (defaults to: $mongodb::mongos::bind_ip)

    Set this option to configure the mongod or mongos process to bind to and listen for connections from applicati ons on this address. If not specified, the module will use the default for your OS distro.

  • port (Any) (defaults to: $mongodb::mongos::port)

    Specifies a TCP port for the server instance to listen for client connections.

  • service_template (Any) (defaults to: $mongodb::mongos::service_template)

    Path to the service template if the default doesn’t match one needs.

  • service_user (Any) (defaults to: $mongodb::mongos::service_user)
  • service_group (Any) (defaults to: $mongodb::mongos::service_group)


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'manifests/mongos/service.pp', line 39

class mongodb::mongos::service (
  $package_ensure   = $mongodb::mongos::package_ensure,
  $service_manage   = $mongodb::mongos::service_manage,
  $service_name     = $mongodb::mongos::service_name,
  $service_user     = $mongodb::mongos::service_user,
  $service_group    = $mongodb::mongos::service_group,
  $service_enable   = $mongodb::mongos::service_enable,
  $service_ensure   = $mongodb::mongos::service_ensure,
  $service_status   = $mongodb::mongos::service_status,
  $service_provider = $mongodb::mongos::service_provider,
  $bind_ip          = $mongodb::mongos::bind_ip,
  $port             = $mongodb::mongos::port,
  $service_template = $mongodb::mongos::service_template,
) {
  if $package_ensure in ['absent', 'purged'] {
    $real_service_ensure = 'stopped'
    $real_service_enable = false
  } else {
    $real_service_ensure = $service_ensure
    $real_service_enable = $service_enable
  }

  if $bind_ip == '0.0.0.0' {
    $connect_ip = '127.0.0.1'
  } else {
    $connect_ip = $bind_ip
  }

  if $service_manage {
    systemd::unit_file { 'mongos.service':
      content => epp($service_template, { service_user => $service_user, service_group => $service_user }),
      enable  => $real_service_enable,
    } ~> Service['mongos']

    service { 'mongos':
      ensure   => $real_service_ensure,
      name     => $service_name,
      enable   => $real_service_enable,
      provider => $service_provider,
      status   => $service_status,
    }

    if $real_service_ensure == 'running' {
      mongodb_conn_validator { 'mongos':
        server  => $connect_ip,
        port    => pick($port, 27017),
        timeout => '240',
        require => Service['mongos'],
      }
    }
  }
}