Sha256: 7250d2a5d250ea7a96ff97dc421014439272a7aaab0f483d6674412444b47595

Contents?: true

Size: 1.47 KB

Versions: 20

Compression:

Stored size: 1.47 KB

Contents

# define: nginx::resource::upstream
#
# This definition creates a new upstream proxy entry for NGINX
#
# Parameters:
#   [*members*]               - Array of member URIs for NGINX to connect to. Must follow valid NGINX syntax.
#   [*ensure*]                - Enables or disables the specified location (present|absent)
#   [*upstream_cfg_prepend*] - It expects a hash with custom directives to put before anything else inside upstream
#
# Actions:
#
# Requires:
#
# Sample Usage:
#  nginx::resource::upstream { 'proxypass':
#    ensure  => present,
#    members => [
#      'localhost:3000',
#      'localhost:3001',
#      'localhost:3002',
#    ],
#  }
#
#  Custom config example to use ip_hash, and 20 keepalive connections
#  create a hash with any extra custom config you want.
#  $my_config = {
#    'ip_hash'   => '',
#    'keepalive' => '20',
#  }
#  nginx::resource::upstream { 'proxypass':
#    ensure              => present,
#    members => [
#      'localhost:3000',
#      'localhost:3001',
#      'localhost:3002',
#    ],
#    upstream_cfg_prepend => $my_config,
#  }
define nginx::resource::upstream (
  $members,
  $ensure = 'present',
  $upstream_cfg_prepend = undef,
) {
  File {
    owner => 'root',
    group => 'root',
    mode  => '0644',
  }

  file { "/etc/nginx/conf.d/${name}-upstream.conf":
    ensure  => $ensure ? {
      'absent' => absent,
      default  => 'file',
    },
    content => template('nginx/conf.d/upstream.erb'),
    notify  => Class['nginx::service'],
  }
}

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
freighthop-0.6.1 modules/nginx/manifests/resource/upstream.pp
freighthop-0.6.0 modules/nginx/manifests/resource/upstream.pp
freighthop-0.5.2 modules/nginx/manifests/resource/upstream.pp
freighthop-0.5.1 modules/nginx/manifests/resource/upstream.pp
freighthop-0.5.0 modules/nginx/manifests/resource/upstream.pp
freighthop-0.4.1 modules/nginx/manifests/resource/upstream.pp
freighthop-0.4.0 modules/nginx/manifests/resource/upstream.pp
freighthop-0.3.3 modules/nginx/manifests/resource/upstream.pp
freighthop-0.3.2 modules/nginx/manifests/resource/upstream.pp
freighthop-0.3.1 modules/nginx/manifests/resource/upstream.pp
freighthop-0.3.0 modules/nginx/manifests/resource/upstream.pp
freighthop-0.2.1 modules/nginx/manifests/resource/upstream.pp
freighthop-0.2.0 modules/nginx/manifests/resource/upstream.pp
freighthop-0.1.0 modules/nginx/manifests/resource/upstream.pp
freighthop-0.0.6 modules/nginx/manifests/resource/upstream.pp
freighthop-0.0.5 modules/nginx/manifests/resource/upstream.pp
freighthop-0.0.4 modules/nginx/manifests/resource/upstream.pp
freighthop-0.0.3 modules/nginx/manifests/resource/upstream.pp
freighthop-0.0.2 modules/nginx/manifests/resource/upstream.pp
freighthop-0.0.1 modules/nginx/manifests/resource/upstream.pp