Skip to content

Commit ebdc0ef

Browse files
author
Tim Meusel
committed
add selinux support, fix typo
1 parent 96fd2f7 commit ebdc0ef

File tree

2 files changed

+35
-9
lines changed

2 files changed

+35
-9
lines changed

files/nginx.pp

941 Bytes
Binary file not shown.

manifests/unicorn.pp

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
# this class installs nginx with unicorn in front of puppetmaster
2-
# tested only on centos 7
1+
# Class: puppet::unicorn
2+
#
3+
# Parameters:
4+
# none
5+
#
6+
# Actions:
7+
# - Configures nginx and unicorn for puppet master use. Tested only on CentOS 7
8+
#
9+
# Requires:
10+
# - nginx
11+
#
12+
# Sample Usage:
13+
# class {'puppet::unicorn':}
14+
#
15+
# written by Tim 'bastelfreak' Meusel
16+
# with big help from Rob 'rnelson0' Nelson
317

418
class puppet::unicorn () {
519
include nginx
620
# install unicorn
7-
package {'gcc':
8-
ensure => 'latest',
9-
} ->
10-
package {'ruby-devel':
21+
package {['ruby-devel', 'gcc']:
1122
ensure => 'latest',
1223
} ->
1324
package {['unicorn', 'rack']:
@@ -21,7 +32,6 @@
2132
file {'unicorn-conf':
2233
path => '/etc/puppet/unicorn.conf',
2334
source => 'puppet:///modules/puppet/unicorn.conf',
24-
2535
} ->
2636
file {'unicorn-service':
2737
path => '/usr/lib/systemd/system/unicorn-puppetmaster.service',
@@ -32,11 +42,26 @@
3242
command => '/usr/bin/systemctl daemon-reload',
3343
refreshonly => true,
3444
notify => Service['unicorn-puppetmaster'],
35-
} ->
45+
}
3646
unless defined(Service['unicorn-puppetmaster']) {
3747
service{'unicorn-puppetmaster':
3848
ensure => 'running',
3949
enable => true,
50+
require => Exec['systemd-reload'],
51+
}
52+
}
53+
# update SELinux
54+
if $selinux_config_mode == 'enforcing' {
55+
file{'get-SEL-policy':
56+
path => '/usr/share/selinux/targeted/nginx.pp',
57+
source => 'puppet:///modules/puppet/nginx.pp',
58+
} ->
59+
package {'policycoreutils':
60+
ensure => 'latest',
61+
} ->
62+
selmodule{'nginx':
63+
ensure => 'present',
64+
syncversion => true,
4065
}
4166
}
4267
# hacky vhost
@@ -49,11 +74,12 @@
4974
path => '/etc/nginx/sites-enabled/puppetmaster',
5075
target => '/etc/nginx/sites-available/puppetmaster',
5176
notify => Service['nginx'],
52-
} ->
77+
}
5378
unless defined(Service['nginx']) {
5479
service{'nginx':
5580
ensure => 'running',
5681
enable => true,
82+
require => File['enable-puppetmaster-vhost'],
5783
}
5884
}
5985
}

0 commit comments

Comments
 (0)