Skip to content

Commit 79c1215

Browse files
author
Tim Meusel
committed
only define package ressource if we havn't already
rewrite of gcc/ruby-devel installation add listen_address var for nginx vhost template implement ip binding for nginx remove useless variable assignment
1 parent 709ae0f commit 79c1215

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

manifests/master.pp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
# ['puppetdb_startup_timeout'] - The timeout for puppetdb
3333
# ['dns_alt_names'] - Comma separated list of alternative DNS names
3434
# ['digest_algorithm'] - The algorithm to use for file digests.
35-
# ['webserver'] - install 'nginx' (with unicorn) or 'httpd' (with passenger)
35+
# ['webserver'] - install 'nginx' (with unicorn) or 'httpd' (with passenger) - httpd is default
36+
# ['listen_address'] - IP for binding the webserver, defaults to *
3637
#
3738
# Requires:
3839
#
@@ -84,7 +85,8 @@
8485
$puppetdb_strict_validation = $::puppet::params::puppetdb_strict_validation,
8586
$dns_alt_names = ['puppet'],
8687
$digest_algorithm = $::puppet::params::digest_algorithm,
87-
$webserver = 'httpd',
88+
$webserver = $::puppet::params::default_webserver,
89+
$listen_address = $::puppet::params::listen_address,
8890
) inherits puppet::params {
8991

9092
anchor { 'puppet::master::begin': }
@@ -123,7 +125,9 @@
123125
case $webserver {
124126
nginx: {
125127
Anchor['puppet::master::begin'] ->
126-
class {'puppet::unicorn':} ->
128+
class {'puppet::unicorn':
129+
listen_address => $listen_address,
130+
} ->
127131
Anchor['puppet::master::end']
128132
}
129133
default: {

manifests/params.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
$puppetdb_strict_validation = true
3232
$environments = 'config'
3333
$digest_algorithm = 'md5'
34+
$listen_address = '*'
35+
$default_webserver = 'httpd'
3436

3537
# Only used when environments == directory
3638
$environmentpath = '$confdir/environments'

manifests/unicorn.pp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Class: puppet::unicorn
22
#
33
# Parameters:
4-
# none
4+
# - listen_address - IP for binding the nginx
55
#
66
# Actions:
77
# - Configures nginx and unicorn for puppet master use. Tested only on CentOS 7
@@ -10,20 +10,30 @@
1010
# - nginx
1111
#
1212
# Sample Usage:
13-
# class {'puppet::unicorn':}
13+
# class {'puppet::unicorn':
14+
# listen_address => '10.250.250.1',
15+
# }
1416
#
1517
# written by Tim 'bastelfreak' Meusel
1618
# with big help from Rob 'rnelson0' Nelson
1719

18-
class puppet::unicorn () {
20+
class puppet::unicorn (
21+
$listen_address,
22+
){
1923
include nginx
2024
# install unicorn
21-
package {['ruby-devel', 'gcc']:
25+
unless defined(Package['ruby-devel']) {
26+
package {'ruby-devel':
27+
ensure => 'latest',
28+
}
29+
}
30+
package {'gcc':
2231
ensure => 'latest',
2332
} ->
2433
package {['unicorn', 'rack']:
2534
ensure => 'latest',
2635
provider => 'gem',
36+
require => Package['ruby-devel'],
2737
} ->
2838
file {'copy-config':
2939
path => '/etc/puppet/config.ru',

templates/puppetmaster

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ server {
2020
proxy_set_header X-Client-DN $ssl_client_s_dn;
2121
proxy_set_header X-SSL-Subject $ssl_client_s_dn;
2222
proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
23-
listen *:8140 ssl;
23+
listen <%= @listen_address %>:8140 ssl;
2424
root /var/empty;
2525
location / {
2626
proxy_pass http://puppetmaster_unicorn;

0 commit comments

Comments
 (0)