30
31
32
33
34
35
36
37
38
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'manifests/repo.pp', line 30
class mongodb::repo (
Enum['present', 'absent'] $ensure = 'present',
Optional[String] $version = undef,
Boolean $use_enterprise_repo = false,
Optional[String[1]] $repo_location = undef,
Optional[String[1]] $keyring_location = undef,
Optional[String[1]] $proxy = undef,
Optional[String[1]] $proxy_username = undef,
Optional[String[1]] $proxy_password = undef,
) {
if $version == undef and $repo_location == undef {
fail('`version` or `repo_location` is required')
}
if $version != undef and $repo_location != undef {
fail('`version` is not supported with `repo_location`')
}
if $version != undef and versioncmp($version, '4.4') < 0 {
fail('Package repositories for versions older than 4.4 are unsupported')
}
case $facts['os']['family'] {
'RedHat', 'Linux': {
if $repo_location != undef {
$_repo_location = $repo_location
$description = 'MongoDB Custom Repository'
} else {
if $use_enterprise_repo {
$_repo_location = "https://repo.mongodb.com/yum/redhat/\$releasever/mongodb-enterprise/${version}/\$basearch/"
$description = 'MongoDB Enterprise Repository'
} else {
$_repo_location = "https://repo.mongodb.org/yum/redhat/\$releasever/mongodb-org/${version}/\$basearch/"
$description = 'MongoDB Repository'
}
}
class { 'mongodb::repo::yum':
ensure => $ensure,
repo_location => $_repo_location,
description => $description,
proxy => $proxy,
proxy_username => $proxy_username,
proxy_password => $proxy_password,
}
}
'Suse': {
if $repo_location {
$_repo_location = $repo_location
$description = 'MongoDB Custom Repository'
} else {
if $use_enterprise_repo {
$_repo_location = "https://repo.mongodb.com/zypper/suse/\$releasever_major/mongodb-enterprise/${version}/\$basearch/"
$description = 'MongoDB Enterprise Repository'
} else {
$_repo_location = "https://repo.mongodb.org/zypper/suse/\$releasever_major/mongodb-org/${version}/\$basearch/"
$description = 'MongoDB Repository'
}
}
class { 'mongodb::repo::zypper':
ensure => $ensure,
repo_location => $_repo_location,
description => $description,
}
}
'Debian': {
if $repo_location != undef {
$_repo_location = $repo_location
$_keyring_location = $keyring_location
} else {
if $use_enterprise_repo == true {
$repo_domain = 'repo.mongodb.com'
$repo_path = 'mongodb-enterprise'
} else {
$repo_domain = 'repo.mongodb.org'
$repo_path = 'mongodb-org'
}
$_repo_location = $facts['os']['name'] ? {
'Debian' => "https://${repo_domain}/apt/debian",
'Ubuntu' => "https://${repo_domain}/apt/ubuntu",
default => undef
}
$_keyring_location = "https://www.mongodb.org/static/pgp/server-${version}.asc"
$release = "${facts['os']['distro']['codename']}/${repo_path}/${version}"
$repos = $facts['os']['name'] ? {
'Debian' => 'main',
'Ubuntu' => 'multiverse',
default => undef
}
$comment = 'MongoDB Repository'
}
class { 'mongodb::repo::apt':
ensure => $ensure,
repo_location => $_repo_location,
keyring_location => $_keyring_location,
release => $release,
repos => $repos,
comment => $comment,
}
}
default: {
if($ensure == 'present') {
fail("Unsupported managed repository for osfamily: ${facts['os']['family']}, operatingsystem: ${facts['os']['name']}")
}
}
}
}
|