2011-06-07 01:05:27 +02:00
|
|
|
# define: nginx::resource::upstream
|
|
|
|
#
|
|
|
|
# This definition creates a new upstream proxy entry for NGINX
|
|
|
|
#
|
|
|
|
# Parameters:
|
|
|
|
# [*ensure*] - Enables or disables the specified location (present|absent)
|
|
|
|
# [*members*] - Array of member URIs for NGINX to connect to. Must follow valid NGINX syntax.
|
|
|
|
#
|
|
|
|
# Actions:
|
|
|
|
#
|
|
|
|
# Requires:
|
|
|
|
#
|
|
|
|
# Sample Usage:
|
|
|
|
# nginx::resource::upstream { 'proxypass':
|
|
|
|
# ensure => present,
|
|
|
|
# members => [
|
2011-06-15 21:40:42 +02:00
|
|
|
# 'localhost:3000',
|
|
|
|
# 'localhost:3001',
|
|
|
|
# 'localhost:3002',
|
2011-06-07 01:05:27 +02:00
|
|
|
# ],
|
|
|
|
# }
|
2013-04-13 13:52:21 +02:00
|
|
|
define nginx::resource::upstream ($ensure = 'present', $members) {
|
2011-06-15 21:40:42 +02:00
|
|
|
File {
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
|
|
|
}
|
|
|
|
|
|
|
|
file { "/etc/nginx/conf.d/${name}-upstream.conf":
|
2013-04-13 13:52:21 +02:00
|
|
|
ensure => $ensure ? {
|
2011-06-15 21:40:42 +02:00
|
|
|
'absent' => absent,
|
|
|
|
default => 'file',
|
|
|
|
},
|
2013-04-13 13:52:21 +02:00
|
|
|
content => template('nginx/conf.d/upstream.erb'),
|
|
|
|
notify => Class['nginx::service'],
|
2011-06-15 21:40:42 +02:00
|
|
|
}
|
|
|
|
}
|