Skip to content

Commit da1d2ab

Browse files
author
Gavin Rogers
committed
Merge branch 'feature-nginx' of github.com:bastelfreak/puppetmodule into feature-nginx
Conflicts: manifests/unicorn.pp
2 parents 778dc06 + 0ea816c commit da1d2ab

File tree

4 files changed

+38
-18
lines changed

4 files changed

+38
-18
lines changed

manifests/master.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
# ['listen_address'] - IP for binding the webserver, defaults to *
3737
# ['disable_ssl'] - Disables SSL on the webserver. usefull if you use this master behind a loadbalancer. currently only supported by nginx, defaults to undef
3838
# ['backup_upstream'] - specify another puppet master as fallback. currently only supported by nginx
39+
# ['unicorn_package'] - package name of a unicorn rpm. if provided we install it, otherwise we built it via gem/gcc
40+
# ['unicorn_path'] - custom path to the unicorn binary
3941
#
4042
# Requires:
4143
#
@@ -91,6 +93,8 @@
9193
$listen_address = $::puppet::params::listen_address,
9294
$disable_ssl = $::puppet::params::disable_ssl,
9395
$backup_upstream = $::puppet::params::backup_upstream,
96+
$unicorn_path = $::puppet::params::unicorn_path,
97+
$unicorn_package = $::puppet::params::unicorn_package,
9498
) inherits puppet::params {
9599

96100
anchor { 'puppet::master::begin': }
@@ -134,6 +138,8 @@
134138
puppet_proxy_port => $puppet_proxy_port,
135139
disable_ssl => $disable_ssl,
136140
backup_upstream => $backup_upstream,
141+
unicorn_package => $unicorn_package,
142+
unicorn_path => $unicorn_path,
137143
} ->
138144
Anchor['puppet::master::end']
139145
}

manifests/params.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
$listen_address = '*'
3535
$default_webserver = 'httpd'
3636
$disable_ssl = undef
37-
$backup_upstream = undef
37+
$backup_upstream = []
38+
$unicorn_package = undef
39+
$unicorn_path = '/usr/local/bin/unicorn'
3840

3941
# Only used when environments == directory
4042
$environmentpath = '$confdir/environments'

manifests/unicorn.pp

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# ['puppet_proxy_port'] - The port for the virtual host
66
# ['disable_ssl'] - Disables SSL on the webserver. usefull if you use this master behind a loadbalancer. currently only supported by nginx, defaults to undef
77
# ['backup_upstream'] - specify another puppet master as fallback. currently only supported by nginx
8+
# ['unicorn_package'] - package name of a unicorn rpm. if provided we install it, otherwise we built it via gem/gcc
9+
# ['unicorn_path'] - custom path to the unicorn binary
810
#
911
# Actions:
1012
# - Configures nginx and unicorn for puppet master use. Tested only on CentOS 7
@@ -26,33 +28,44 @@
2628
$puppet_proxy_port,
2729
$disable_ssl,
2830
$backup_upstream,
31+
$unicorn_package,
32+
$unicorn_path,
2933
){
3034
include nginx
31-
# install unicorn
32-
unless defined(Package['ruby-devel']) {
33-
package {'ruby-devel':
35+
36+
# if this is provided we install the package from the repo, otherwise we build unicorn from scratch
37+
if $unicorn_package {
38+
package {$unicorn_package:
3439
ensure => 'latest',
3540
}
41+
} else {
42+
# install unicorn
43+
unless defined(Package['ruby-devel']) {
44+
package {'ruby-devel':
45+
ensure => 'latest',
46+
}
47+
}
48+
package {'gcc':
49+
ensure => 'latest',
50+
} ->
51+
package {['unicorn', 'rack']:
52+
ensure => 'latest',
53+
provider => 'gem',
54+
require => Package['ruby-devel'],
55+
}
3656
}
37-
package { [ 'policycoreutils-python', 'gcc' ]:
38-
ensure => 'latest',
39-
} ->
40-
package {['unicorn', 'rack']:
41-
ensure => 'latest',
42-
provider => 'gem',
43-
require => Package['ruby-devel'],
57+
file {'unicorn-conf':
58+
path => '/etc/puppet/unicorn.conf',
59+
source => 'puppet:///modules/puppet/unicorn.conf',
4460
} ->
4561
file {'copy-config':
4662
path => '/etc/puppet/config.ru',
4763
source => '/usr/share/puppet/ext/rack/config.ru',
4864
} ->
49-
file {'unicorn-conf':
50-
path => '/etc/puppet/unicorn.conf',
51-
source => 'puppet:///modules/puppet/unicorn.conf',
52-
} ->
65+
5366
file {'unicorn-service':
5467
path => '/usr/lib/systemd/system/unicorn-puppetmaster.service',
55-
source => 'puppet:///modules/puppet/unicorn-puppetmaster.service',
68+
content => template('puppet/unicorn-puppetmaster.service'),
5669
notify => Exec['systemd-reload'],
5770
} ->
5871
exec{'systemd-reload':
@@ -64,7 +77,6 @@
6477
service{'unicorn-puppetmaster':
6578
ensure => 'running',
6679
enable => true,
67-
require => Exec['systemd-reload'],
6880
}
6981
}
7082
# update SELinux

files/unicorn-puppetmaster.service renamed to templates/unicorn-puppetmaster.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Description=Puppet master served by Unicorn
33

44
[Service]
5-
ExecStart=/usr/local/bin/unicorn -c /etc/puppet/unicorn.conf
5+
ExecStart=<%= @unicorn_path %> -c /etc/puppet/unicorn.conf
66
ExecReload=/usr/bin/kill -s HUP $MAINPID
77
PrivateTmp=yes
88
# this would be cool, but then the puppetmaster can't reach the puppetdb

0 commit comments

Comments
 (0)