Commit cd2aa2aa authored by intrigeri's avatar intrigeri
Browse files

Merge remote-tracking branch 'immerda/master'

parents df77f54a dc25efe6
......@@ -80,10 +80,12 @@ class nginx::base {
}
file{ '/etc/nginx/conf.d/virtual.conf':
ensure => present,
ensure => present,
owner => root,
group => 0,
mode => '0644'
mode => '0644',
require => Package['nginx'],
notify => Service['nginx'],
}
file_line{'load_nginx_vhosts':
......
......@@ -13,9 +13,9 @@ define nginx::confd(
if $ensure == 'present' {
File["/etc/nginx/conf.d/${name}.conf"]{
owner => root,
group => 0,
mode => '0644'
owner => root,
group => 0,
mode => '0644'
}
if $content {
File["/etc/nginx/conf.d/${name}.conf"]{
......
class nginx::gentoo inherits nginx::base {
Package[nginx]{
category => 'www-servers',
}
}
......@@ -7,15 +7,15 @@ define nginx::included(
$content = false,
){
file{"/etc/nginx/include.d/${name}.conf":
ensure => $ensure,
notify => Service['nginx'],
ensure => $ensure,
notify => Service['nginx'],
}
if $ensure == 'present' {
File["/etc/nginx/include.d/${name}.conf"]{
owner => root,
group => 0,
mode => '0644'
owner => root,
group => 0,
mode => '0644'
}
if $content {
File["/etc/nginx/include.d/${name}.conf"]{
......
......@@ -16,6 +16,8 @@ class nginx (
$manage_shorewall_http = false,
$manage_shorewall_https = false,
$use_munin = false,
$vhosts = {},
$confs = {},
) {
# Validate some parameters.
......@@ -35,26 +37,25 @@ class nginx (
}
}
case $::operatingsystem {
gentoo: { include nginx::gentoo }
default: { include nginx::base }
}
include ::nginx::base
if $manage_shorewall_http {
include shorewall::rules::http
include ::shorewall::rules::http
}
if $manage_shorewall_https {
include shorewall::rules::https
include ::shorewall::rules::https
}
if $use_munin {
include nginx::munin
include ::nginx::munin
} else {
include nginx::munin::disable
include ::nginx::munin::disable
}
if str2bool($::selinux) {
include nginx::selinux
include ::nginx::selinux
}
create_resources('nginx::vhostsd',$vhosts)
create_resources('nginx::confd',$confs)
}
......@@ -9,13 +9,11 @@ location /nginx_status {
allow 127.0.0.1; # restrict access to local only
deny all;
}';
}
exec{'add_munin_status':
command => 'sed -i \'/^ server_name _;$/a\\n include /etc/nginx/include.d/munin.conf;\' /etc/nginx/nginx.conf',
unless => 'grep -q "/etc/nginx/include.d/munin.conf" /etc/nginx/nginx.conf',
} -> file_line{'munin_status':
line => ' include /etc/nginx/include.d/munin.conf;',
path => '/etc/nginx/nginx.conf',
after => '^\s+server_name _',
require => File['/etc/nginx/include.d/munin.conf'],
notify => Service['nginx'],
}
munin::plugin{ [ 'nginx_request', 'nginx_status' ]: }
} -> munin::plugin{ [ 'nginx_request', 'nginx_status' ]: }
}
# remove munin status
class nginx::munin::disable {
file_line{'remove_munin_line':
file_line{'munin_status':
ensure => 'absent',
line => ' include /etc/nginx/include.d/munin.conf;',
path => '/etc/nginx/nginx.conf',
......
......@@ -6,15 +6,15 @@ define nginx::vhostsd(
$content = false,
){
file{"/etc/nginx/vhosts.d/${name}.conf":
ensure => $ensure,
notify => Service['nginx'],
ensure => $ensure,
notify => Service['nginx'],
}
if $ensure == 'present' {
File["/etc/nginx/vhosts.d/${name}.conf"]{
owner => root,
group => 0,
mode => '0644'
owner => root,
group => 0,
mode => '0644'
}
if $content {
File["/etc/nginx/vhosts.d/${name}.conf"]{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment