-
-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new classes for installing Ops Manager on a target machine. Updat…
…e the README with how to use it. Write 2 tests to make sure things are installed correctly. Modify files in line with the recommendations made in the PR. mongodb-mms for the package name or there are problems the second time the package is installed remove trailing whitespace Have to put the template in opsmanager.pp for it to have access to the variables? Fix the template's new line problems? Remove opsmanager_version and replace it with the option to use a different download_url. Fix line 45 Update params so that the ops_manager hostname defaults to http. This should be done with a protocol param maybe. Add a protocol parameter so that the opsmanager_url can be built correctly. Linting fix Make it so the full URL can be provided instead of protocol, hostname and port Change how the user and group are decided because by default opsmanager creates the user and group mongodb-mms, not mongodb. set package provider type for opsmanager package install from source URL Add new classes for installing Ops Manager on a target machine. Update the README with how to use it. Write 2 tests to make sure things are installed correctly. Modify files in line with the recommendations made in the PR. mongodb-mms for the package name or there are problems the second time the package is installed remove trailing whitespace Have to put the template in opsmanager.pp for it to have access to the variables? Fix the template's new line problems? Remove opsmanager_version and replace it with the option to use a different download_url. Fix line 45 Update params so that the ops_manager hostname defaults to http. This should be done with a protocol param maybe. Add a protocol parameter so that the opsmanager_url can be built correctly. Linting fix Make it so the full URL can be provided instead of protocol, hostname and port Change how the user and group are decided because by default opsmanager creates the user and group mongodb-mms, not mongodb. Rebase onto master to resolve conflicts. Re-add a variable that was blown away parameter ensure should only accept values present, absent and installed. booleans aren't used any more mail transport can either be smtp or smtps Update with feedback from 10/20/18 Use notifies, change ensure, update enums for certain variables, update tests to reflect notifies, add config class. Rebase onto master Remove reassignment of . Add an else in case versioncmp(fact('puppetversion'),'5.4.0') > 1 Corrections for feedback from 10/29 Remove all Opsmanager specific globals from globals.pp opsmanager::params doesn't need to inherit globals anymore. Missing service provider Spec update
- Loading branch information
Showing
10 changed files
with
379 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This installs Ops Manager. See README.md for more info. | ||
|
||
class mongodb::opsmanager ( | ||
String[1] $user = $mongodb::opsmanager::params::user, | ||
String[1] $group = $mongodb::opsmanager::params::group, | ||
Enum['running', 'stopped'] $ensure = $mongodb::opsmanager::params::ensure, | ||
String[1] $package_name = $mongodb::opsmanager::params::package_name, | ||
String[1] $package_ensure = $mongodb::opsmanager::params::package_ensure, | ||
Boolean $service_enable = $mongodb::opsmanager::params::service_enable, | ||
Boolean $service_manage = $mongodb::opsmanager::params::service_manage, | ||
String[1] $service_name = $mongodb::opsmanager::params::service_name, | ||
Stdlib::Httpurl $download_url = $mongodb::opsmanager::params::download_url, | ||
String[1] $mongo_uri = $mongodb::opsmanager::params::mongo_uri, | ||
Stdlib::Httpurl $opsmanager_url = $mongodb::opsmanager::params::opsmanager_url, | ||
String[1] $client_certificate_mode = 'None', | ||
String[1] $from_email_addr = 'from@yourdomain.com', | ||
String[1] $reply_to_email_addr = 'replyto@yourdomain.com', | ||
String[1] $admin_email_addr = 'admin@yourdomain.com', | ||
String[1] $email_dao_class = 'com.xgen.svc.core.dao.email.JavaEmailDao', #AWS SES: com.xgen.svc.core.dao.email.AwsEmailDao or SMTP: com.xgen.svc.core.dao.email.JavaEmailDao | ||
Enum['smtp','smtps'] $mail_transport = 'smtp', #smtp or smtps | ||
String[1] $smtp_server_hostname = 'your-email-relay.email.com', # if email_dao_class is SMTP: Email hostname your email provider specifies. | ||
String[1] $smtp_server_port = '25', #if email_dao_class is SMTP: Email hostname your email provider specifies. | ||
Boolean $ssl = false, | ||
Boolean $ignore_ui_setup = true, | ||
#optional settings | ||
Optional[String[1]] $ca_file = $mongodb::opsmanager::params::ca_file, | ||
Optional[String[1]] $pem_key_file = $mongodb::opsmanager::params::pem_key_file, | ||
Optional[String[1]] $pem_key_password = $mongodb::opsmanager::params::pem_key_password, | ||
Optional[String[1]] $user_svc_class = undef, # Default: com.xgen.svc.mms.svc.user.UserSvcDb External Source: com.xgen.svc.mms.svc.user.UserSvcCrowd or Internal Database: com.xgen.svc.mms.svc.user.UserSvcDb | ||
Optional[Integer] $snapshot_interval = undef, # Default: 24 | ||
Optional[Integer] $snapshot_interval_retention = undef, # Default: 2 | ||
Optional[Integer] $snapshot_daily_retention = undef, # Default: 0 | ||
Optional[Integer] $snapshot_weekly_retention = undef, # Default: 2 | ||
Optional[Integer] $snapshot_monthly_retention = undef, # Default: 1 | ||
Optional[Integer] $versions_directory = undef, # Linux default: /opt/mongodb/mms/mongodb-releases/ | ||
|
||
) inherits mongodb::opsmanager::params { | ||
|
||
contain mongodb::opsmanager::install | ||
contain mongodb::opsmanager::config | ||
contain mongodb::opsmanager::service | ||
|
||
if ($mongo_uri == 'mongodb://127.0.0.1:27017') { | ||
include mongodb::server | ||
} | ||
|
||
if ($ensure == 'running') { | ||
Class['mongodb::opsmanager::install'] | ||
~> Class['mongodb::opsmanager::config'] | ||
~> Class['mongodb::opsmanager::service'] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
# PRIVATE CLASS: do not call directly | ||
class mongodb::opsmanager::config { | ||
$user = $mongodb::opsmanager::user | ||
$group = $mongodb::opsmanager::group | ||
|
||
file { '/opt/mongodb/mms/conf/conf-mms.properties': | ||
ensure => file, | ||
owner => $user, | ||
group => $group, | ||
mode => '0644', | ||
content => epp('mongodb/opsmanager/conf-mms.properties.epp'), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# PRIVATE CLASS: do not call directly | ||
class mongodb::opsmanager::install { | ||
#assert_private("You are calling a private class mongodb::opsmanager::install.") | ||
$package_ensure = $mongodb::opsmanager::package_ensure | ||
$package_name = $mongodb::opsmanager::package_name | ||
$download_url = $mongodb::opsmanager::download_url | ||
|
||
case $package_ensure { | ||
'absent': { | ||
$my_package_ensure = 'absent' | ||
$file_ensure = 'absent' | ||
} | ||
default: { | ||
$my_package_ensure = $package_ensure | ||
$file_ensure = 'present' | ||
} | ||
} | ||
|
||
if versioncmp(fact('puppetversion'),'5.4.0') < 0 { | ||
case $facts['os']['family'] { | ||
'RedHat': { | ||
$my_provider = 'rpm' | ||
} | ||
'Debian': { | ||
$my_provider = 'dpkg' | ||
} | ||
default: { | ||
warning("The ${module_name} module might not work on ${facts['os']['family']}. Sensible defaults will be attempted.") | ||
$my_provider = undef | ||
} | ||
} | ||
} else { | ||
$my_provider = undef | ||
} | ||
|
||
package { $package_name: | ||
ensure => $my_package_ensure, | ||
source => $download_url, | ||
provider => $my_provider, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# PRIVATE CLASS: do not use directly | ||
class mongodb::opsmanager::params { | ||
$ensure = 'running' | ||
$user = 'mongodb-mms' | ||
$group = 'mongodb-mms' | ||
$package_name = 'mongodb-mms' | ||
$service_name = 'mongodb-mms' | ||
$service_manage = true | ||
$service_enable = true | ||
$service_ensure = 'running' | ||
$service_status = undef | ||
$opsmanager_url = undef | ||
$service_provider = undef | ||
$download_url = 'https://downloads.mongodb.com/on-prem-mms/rpm/mongodb-mms-4.0.1.50101.20180801T1117Z-1.x86_64.rpm' | ||
$mongo_uri = 'mongodb://127.0.0.1:27017' | ||
$package_ensure = 'present' | ||
$ca_file = undef | ||
$pem_key_file = undef | ||
$pem_key_password = undef | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# PRIVATE CLASS: do not call directly | ||
class mongodb::opsmanager::service { | ||
#assert_private("You are calling a private class mongodb::opsmanager::service.") | ||
$service_ensure = $mongodb::opsmanager::ensure | ||
$service_manage = $mongodb::opsmanager::service_manage | ||
$service_enable = $mongodb::opsmanager::service_enable | ||
$service_name = $mongodb::opsmanager::service_name | ||
$service_provider = $mongodb::opsmanager::service_provider | ||
$service_status = $mongodb::opsmanager::service_status | ||
|
||
if $service_manage { | ||
service { $service_name: | ||
ensure => $service_ensure, | ||
enable => $service_enable, | ||
provider => $service_provider, | ||
status => $service_status, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'spec_helper' | ||
|
||
describe 'mongodb::opsmanager::install' do | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) { facts } | ||
|
||
describe 'it should create package' do | ||
let(:pre_condition) { ["class mongodb::opsmanager { $download_url = 'https://downloads.mongodb.com/on-prem-mms/rpm/mongodb-mms-4.0.1.50101.20180801T1117Z-1.x86_64.rpm' $package_ensure = 'present' $user = 'mongodb' $group = 'mongodb' $package_name = 'mongodb-mms' }", 'include mongodb::opsmanager'] } | ||
|
||
it { | ||
is_expected.to contain_package('mongodb-mms').with(ensure: 'present', | ||
name: 'mongodb-mms') | ||
} | ||
|
||
it { is_expected.to compile.with_all_deps } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require 'spec_helper' | ||
|
||
describe 'mongodb::opsmanager' do | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) { facts } | ||
|
||
let(:params) do | ||
{ | ||
opsmanager_url: 'http://localhost:8080' | ||
} | ||
end | ||
|
||
describe 'with defaults' do | ||
it { is_expected.to compile.with_all_deps } | ||
|
||
it { | ||
is_expected.to contain_class('mongodb::opsmanager::install'). | ||
that_notifies('Class[mongodb::opsmanager::config]') | ||
} | ||
|
||
it { | ||
is_expected.to contain_class('mongodb::opsmanager::config'). | ||
that_notifies('Class[mongodb::opsmanager::service]') | ||
} | ||
|
||
it { is_expected.to contain_class('mongodb::opsmanager::service') } | ||
|
||
it { is_expected.to contain_service('mongodb') } | ||
|
||
it { is_expected.to contain_service('mongodb-mms') } | ||
|
||
it { is_expected.to create_package('mongodb-mms').with_ensure('present') } | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.