2011-06-07 01:05:27 +02:00
|
|
|
# Class: nginx::package::debian
|
|
|
|
#
|
|
|
|
# This module manages NGINX package installation on debian based systems
|
|
|
|
#
|
|
|
|
# Parameters:
|
2011-06-15 21:40:42 +02:00
|
|
|
#
|
|
|
|
# There are no default parameters for this class.
|
2011-06-07 01:05:27 +02:00
|
|
|
#
|
|
|
|
# Actions:
|
|
|
|
#
|
|
|
|
# Requires:
|
|
|
|
#
|
|
|
|
# Sample Usage:
|
|
|
|
#
|
|
|
|
# This class file is not called directly
|
2013-10-07 16:27:17 +02:00
|
|
|
class nginx::package::debian(
|
2013-10-07 21:46:42 +02:00
|
|
|
$manage_repo = true,
|
2013-10-07 16:27:17 +02:00
|
|
|
$package_name = 'nginx',
|
|
|
|
$package_source = 'nginx',
|
|
|
|
$package_ensure = 'present'
|
|
|
|
) {
|
2014-03-27 22:53:41 +01:00
|
|
|
|
2013-09-04 23:57:41 +02:00
|
|
|
$distro = downcase($::operatingsystem)
|
2013-05-16 00:08:58 +02:00
|
|
|
|
2014-12-08 03:01:24 +01:00
|
|
|
package { 'nginx':
|
2014-12-08 05:09:55 +01:00
|
|
|
ensure => $package_ensure,
|
|
|
|
name => $package_name,
|
2013-05-16 00:08:58 +02:00
|
|
|
}
|
|
|
|
|
2013-10-07 21:46:42 +02:00
|
|
|
if $manage_repo {
|
2014-04-19 20:41:14 +02:00
|
|
|
include '::apt'
|
2014-12-08 05:09:55 +01:00
|
|
|
Exec['apt_update'] -> Package['nginx']
|
2014-04-19 20:41:14 +02:00
|
|
|
|
2013-10-07 21:46:42 +02:00
|
|
|
case $package_source {
|
2014-12-10 02:05:31 +01:00
|
|
|
'nginx', 'nginx-stable': {
|
2013-10-07 21:46:42 +02:00
|
|
|
apt::source { 'nginx':
|
2015-05-08 04:36:39 +02:00
|
|
|
location => "http://nginx.org/packages/${distro}",
|
|
|
|
repos => 'nginx',
|
|
|
|
key => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62',
|
2013-10-07 21:46:42 +02:00
|
|
|
}
|
2013-09-27 14:48:51 +02:00
|
|
|
}
|
2014-12-10 02:05:31 +01:00
|
|
|
'nginx-mainline': {
|
|
|
|
apt::source { 'nginx':
|
2015-05-08 04:36:39 +02:00
|
|
|
location => "http://nginx.org/packages/mainline/${distro}",
|
|
|
|
repos => 'nginx',
|
|
|
|
key => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62',
|
2014-12-10 02:05:31 +01:00
|
|
|
}
|
|
|
|
}
|
2013-10-07 21:46:42 +02:00
|
|
|
'passenger': {
|
|
|
|
apt::source { 'nginx':
|
2015-05-08 04:36:39 +02:00
|
|
|
location => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
|
|
|
|
repos => 'main',
|
|
|
|
key => '16378A33A6EF16762922526E561F9B9CAC40B2F7',
|
2015-04-21 23:32:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
package { ['apt-transport-https', 'ca-certificates']:
|
|
|
|
ensure => 'present',
|
|
|
|
before => Apt::Source['nginx'],
|
2013-10-07 21:46:42 +02:00
|
|
|
}
|
2013-09-27 14:48:51 +02:00
|
|
|
|
2013-10-07 21:46:42 +02:00
|
|
|
package { 'passenger':
|
|
|
|
ensure => 'present',
|
2014-12-08 05:09:55 +01:00
|
|
|
require => Exec['apt_update'],
|
2013-10-07 21:46:42 +02:00
|
|
|
}
|
2015-03-19 15:34:42 +01:00
|
|
|
|
2014-12-08 18:44:56 +01:00
|
|
|
if $package_name != 'nginx-extras' {
|
|
|
|
warning('You must set $package_name to "nginx-extras" to enable Passenger')
|
|
|
|
}
|
2013-09-27 14:48:51 +02:00
|
|
|
}
|
2014-12-10 02:05:31 +01:00
|
|
|
default: {
|
|
|
|
fail("\$package_source must be 'nginx-stable', 'nginx-mainline' or 'passenger'. It was set to '${package_source}'")
|
|
|
|
}
|
2013-09-27 14:48:51 +02:00
|
|
|
}
|
2011-06-15 21:40:42 +02:00
|
|
|
}
|
|
|
|
}
|