-
-
Notifications
You must be signed in to change notification settings - Fork 881
/
redhat.pp
84 lines (79 loc) · 2.36 KB
/
redhat.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
# Class: nginx::package::redhat
#
# This module manages NGINX package installation on RedHat based systems
#
# Parameters:
#
# There are no default parameters for this class.
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# This class file is not called directly
class nginx::package::redhat (
$manage_repo = true,
$package_ensure = 'present',
$package_name = 'nginx',
$package_source = 'nginx-stable',
) {
#Install the CentOS-specific packages on that OS, otherwise assume it's a RHEL
#clone and provide the Red Hat-specific package. This comes into play when not
#on RHEL or CentOS and $manage_repo is set manually to 'true'.
if $::operatingsystem == 'centos' {
$_os = 'centos'
} else {
$_os = 'rhel'
}
if $manage_repo {
case $package_source {
'nginx', 'nginx-stable': {
yumrepo { 'nginx-release':
baseurl => "http://nginx.org/packages/${_os}/${::operatingsystemmajrelease}/\$basearch/",
descr => 'nginx repo',
enabled => '1',
gpgcheck => '1',
priority => '1',
gpgkey => 'http://nginx.org/keys/nginx_signing.key',
before => Package['nginx'],
}
}
'nginx-mainline': {
yumrepo { 'nginx-release':
baseurl => "http://nginx.org/packages/mainline/${_os}/${::operatingsystemmajrelease}/\$basearch/",
descr => 'nginx repo',
enabled => '1',
gpgcheck => '1',
priority => '1',
gpgkey => 'http://nginx.org/keys/nginx_signing.key',
before => Package['nginx'],
}
}
'passenger': {
yumrepo { 'passenger':
baseurl => "https://oss-binaries.phusionpassenger.com/yum/passenger/el/${::operatingsystemmajrelease}/\$basearch",
descr => 'passenger repo',
enabled => '1',
gpgcheck => '0',
repo_gpgcheck => '1',
priority => '1',
gpgkey => 'https://packagecloud.io/gpg.key',
before => Package['nginx'],
}
package { 'passenger':
ensure => 'present',
require => Yumrepo['passenger'],
}
}
default: {
fail("\$package_source must be 'nginx-stable', 'nginx-mainline', or 'passenger'. It was set to '${package_source}'")
}
}
}
package { 'nginx':
ensure => $package_ensure,
name => $package_name,
}
}