Skip to content

Commit 48822cf

Browse files
author
Tim Meusel
committed
add LB support
now it is possible to create an nginx setup with ssl. this is usefull if you run this node behind a loadbalancer that breaks up ssl. also you can specify multiple backup upstream server in nginx.
1 parent 0817447 commit 48822cf

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

manifests/master.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
# ['digest_algorithm'] - The algorithm to use for file digests.
3535
# ['webserver'] - install 'nginx' (with unicorn) or 'httpd' (with passenger) - httpd is default
3636
# ['listen_address'] - IP for binding the webserver, defaults to *
37+
# ['disable_ssl'] - Disables SSL on the webserver. usefull if you use this master behind a loadbalancer. currently only supported by nginx, defaults to undef
38+
# ['backup_upstream'] - specify another puppet master as fallback. currently only supported by nginx
3739
#
3840
# Requires:
3941
#
@@ -87,6 +89,8 @@
8789
$digest_algorithm = $::puppet::params::digest_algorithm,
8890
$webserver = $::puppet::params::default_webserver,
8991
$listen_address = $::puppet::params::listen_address,
92+
$disable_ssl = $::puppet::params::disable_ssl,
93+
$backup_upstream = $::puppet::params::backup_upstream,
9094
) inherits puppet::params {
9195

9296
anchor { 'puppet::master::begin': }
@@ -128,6 +132,8 @@
128132
class {'puppet::unicorn':
129133
listen_address => $listen_address,
130134
puppet_proxy_port => $puppet_proxy_port,
135+
disable_ssl => $disable_ssl,
136+
backup_upstream => $backup_upstream,
131137
} ->
132138
Anchor['puppet::master::end']
133139
}

manifests/params.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
$digest_algorithm = 'md5'
3434
$listen_address = '*'
3535
$default_webserver = 'httpd'
36+
$disable_ssl = undef
37+
$backup_upstream = undef
3638

3739
# Only used when environments == directory
3840
$environmentpath = '$confdir/environments'

manifests/unicorn.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
class puppet::unicorn (
2323
$listen_address,
2424
$puppet_proxy_port,
25+
$disable_ssl,
26+
$backup_upstream,
2527
){
2628
include nginx
2729
# install unicorn

templates/puppetmaster

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# define the new unicorn backend
22
upstream puppetmaster_unicorn {
3-
server unix:/var/run/puppet/puppetmaster_unicorn.sock fail_timeout=0;
3+
server unix:/var/run/puppet/puppetmaster_unicorn.sock fail_timeout=5;
4+
<% backup_upstream.each do |server| -%>
5+
server <%= server %> backup;
6+
<% end %->
47
}
58

69
# define our proxy for breaking up SSL
710
server {
11+
<% unless @disable_ssl %>
812
ssl on;
913
ssl_certificate /var/lib/puppet/ssl/certs/<%= @fqdn %>.pem;
1014
ssl_certificate_key /var/lib/puppet/ssl/private_keys/<%= @fqdn %>.pem;
@@ -20,6 +24,7 @@ server {
2024
proxy_set_header X-Client-DN $ssl_client_s_dn;
2125
proxy_set_header X-SSL-Subject $ssl_client_s_dn;
2226
proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
27+
<% end %>
2328
listen <%= @listen_address %>:<%= @puppet_proxy_port %> ssl;
2429
root /var/empty;
2530
location / {

0 commit comments

Comments
 (0)