Skip to content

Commit 9011e9c

Browse files
author
Tim Meusel
committed
add nginx/unicorn support for puppet master on centos
this is a huge commit which adds support to install nginx on a centos7 node with unicorn backend. You can run an all-in-one node with puppet master/ca on it, or use it to configure a central ssl offloading proxy with puppet ca on it and several master backends and backups.
1 parent 9f61425 commit 9011e9c

16 files changed

+538
-76
lines changed

README.markdown

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ as this module requires the passenger apache module.
1313

1414
Requires the following modules from puppetforge: [stdlib](https://forge.puppetlabs.com/puppetlabs/stdlib), [apache](https://forge.puppetlabs.com/puppetlabs/apache), [concat](https://forge.puppetlabs.com/puppetlabs/concat), [inifile](https://forge.puppetlabs.com/puppetlabs/inifile)
1515

16+
1617
## Usage Note ##
1718

1819
If you are using this module to install a puppetmaster and serving the manifest of
@@ -52,6 +53,13 @@ Puppet 3.5 introduced a new way of handling Puppet environments known as _Direct
5253

5354
Optionally, an `environmentpath` parameter can be supplied to configure the base root of Puppet environments, this defaults to `$confdir/environments`
5455

56+
### Support for httpd and nginx ###
57+
58+
class { 'puppet::master':
59+
webserver => 'nginx'
60+
}
61+
62+
The default installed webserver is httpd with passenger, but via the webserver param you can switch to nginx with unicorn (nginx is currently only tested on centos7, testers are welcome). Note that if you have selinux enabled, you must have [this](https://github.com/gavinrogers/puppet-selinux) selinux module installed.
5563

5664
## Agent ##
5765
class { 'puppet::agent':

files/nginx.selmodule

941 Bytes
Binary file not shown.

manifests/agent.pp

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# ['templatedir'] - Template dir, if unset it will remove the setting.
2828
# ['configtimeout'] - How long the client should wait for the configuration to be retrieved before considering it a failure
2929
# ['stringify_facts'] - Wether puppet transforms structured facts in strings or no. Defaults to true in puppet < 4, deprecated in puppet >=4 (and will default to false)
30+
# ['serialization_format'] - defaults to undef, otherwise it sets the preferred_serialization_format param (currently only msgpack is supported)
31+
# ['serialization_package'] - defaults to undef, if provided, we install this package, otherwise we fall back to the gem from 'serialization_format'
3032
# ['cron_hour'] - What hour to run if puppet_run_style is cron
3133
# ['cron_minute'] - What minute to run if puppet_run_style is cron
3234
#
@@ -51,6 +53,8 @@
5153
$puppet_run_command = '/usr/bin/puppet agent --no-daemonize --onetime --logdest syslog > /dev/null 2>&1',
5254
$user_id = undef,
5355
$group_id = undef,
56+
$serialization_format = undef,
57+
$serialization_package = undef,
5458

5559
#[main]
5660
$templatedir = undef,
@@ -206,6 +210,7 @@
206210
path => $::puppet::params::puppet_conf,
207211
require => File[$::puppet::params::puppet_conf],
208212
section => 'agent',
213+
ensure => present,
209214
}
210215

211216
if (($use_srv_records == true) and ($srv_domain == undef))
@@ -215,7 +220,6 @@
215220
elsif (($use_srv_records == true) and ($srv_domain != undef))
216221
{
217222
ini_setting {'puppetagentsrv_domain':
218-
ensure => present,
219223
setting => 'srv_domain',
220224
value => $srv_domain,
221225
}
@@ -252,69 +256,57 @@
252256
}
253257

254258
ini_setting {'puppetagentenvironment':
255-
ensure => present,
256259
setting => 'environment',
257260
value => $environment,
258261
}
259262

260263
ini_setting {'puppetagentmaster':
261-
ensure => present,
262264
setting => 'server',
263265
value => $puppet_server,
264266
}
265267

266268
ini_setting {'puppetagentuse_srv_records':
267-
ensure => present,
268269
setting => 'use_srv_records',
269270
value => $use_srv_records,
270271
}
271272

272273
ini_setting {'puppetagentruninterval':
273-
ensure => present,
274274
setting => 'runinterval',
275275
value => $runinterval,
276276
}
277277

278278
ini_setting {'puppetagentsplay':
279-
ensure => present,
280279
setting => 'splay',
281280
value => $splay,
282281
}
283282

284283
ini_setting {'puppetmasterport':
285-
ensure => present,
286284
setting => 'masterport',
287285
value => $puppet_server_port,
288286
}
289287
ini_setting {'puppetagentreport':
290-
ensure => present,
291288
setting => 'report',
292289
value => $report,
293290
}
294291
ini_setting {'puppetagentpluginsync':
295-
ensure => present,
296292
setting => 'pluginsync',
297293
value => $pluginsync,
298294
}
299295
ini_setting {'puppetagentlisten':
300-
ensure => present,
301296
setting => 'listen',
302297
value => $listen,
303298
}
304299
ini_setting {'puppetagentreportserver':
305-
ensure => present,
306300
setting => 'reportserver',
307301
value => $reportserver,
308302
}
309303
ini_setting {'puppetagentdigestalgorithm':
310-
ensure => present,
311304
setting => 'digest_algorithm',
312305
value => $digest_algorithm,
313306
}
314307
if ($templatedir != undef) and ($templatedir != 'undef')
315308
{
316309
ini_setting {'puppetagenttemplatedir':
317-
ensure => present,
318310
setting => 'templatedir',
319311
section => 'main',
320312
value => $templatedir,
@@ -329,17 +321,46 @@
329321
}
330322
}
331323
ini_setting {'puppetagentconfigtimeout':
332-
ensure => present,
333324
setting => 'configtimeout',
334325
value => $configtimeout,
335326
}
336327
if $stringify_facts != undef {
337328
ini_setting {'puppetagentstringifyfacts':
338-
ensure => present,
339329
setting => 'stringify_facts',
340330
value => $stringify_facts,
341331
}
342332
}
333+
if $serialization_format != undef {
334+
if $serialization_package != undef {
335+
package { $serialization_package:
336+
ensure => latest,
337+
}
338+
} else {
339+
if $serialization_format == 'msgpack' {
340+
unless defined(Package[$::puppet::params::ruby_dev]) {
341+
package {$::puppet::params::ruby_dev:
342+
ensure => 'latest',
343+
}
344+
}
345+
unless defined(Package['gcc']) {
346+
package {'gcc':
347+
ensure => 'latest',
348+
}
349+
}
350+
unless defined(Package['msgpack']) {
351+
package {'msgpack':
352+
ensure => 'latest',
353+
provider => 'gem',
354+
require => Package[$::puppet::params::ruby_dev, 'gcc'],
355+
}
356+
}
357+
}
358+
}
359+
ini_setting {'puppetagentserializationformatagent':
360+
setting => 'preferred_serialization_format',
361+
value => $serialization_format,
362+
}
363+
}
343364
if $verbose != undef {
344365
ini_setting {'puppetagentverbose':
345366
ensure => present,
@@ -399,3 +420,4 @@
399420
}
400421
}
401422
}
423+

0 commit comments

Comments
 (0)