nginx: Manually merge nginx from parameterize
This commit is contained in:
parent
4b498aa860
commit
efa029b0ba
3 changed files with 73 additions and 95 deletions
|
@ -1,3 +0,0 @@
|
||||||
passenger_root /usr/local/lib/phusion_passenger;
|
|
||||||
passenger_ruby /usr/local/bin/ruby18;
|
|
||||||
passenger_log_level 1;
|
|
|
@ -1,75 +1,66 @@
|
||||||
# Install and configure nginx.
|
# Install and configure nginx.
|
||||||
#
|
#
|
||||||
class nginx {
|
class nginx(
|
||||||
|
$workers=$::processorcount,
|
||||||
|
) {
|
||||||
|
|
||||||
case $::operatingsystem {
|
case $::operatingsystem {
|
||||||
"openbsd": {
|
'openbsd': {
|
||||||
$user = "_nginx"
|
if $::kernelversion == '5.6' {
|
||||||
$group = "_nginx"
|
$user = 'www'
|
||||||
|
$group = 'www'
|
||||||
|
} else {
|
||||||
|
$user = '_nginx'
|
||||||
|
$group = '_nginx'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
$user = "nginx"
|
$user = 'nginx'
|
||||||
$group = "nginx"
|
$group = 'nginx'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
package { "nginx":
|
if ! ($::operatingsystem == 'OpenBSD' and $::kernelversion == '5.6') {
|
||||||
|
package { 'nginx':
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
|
before => File['/etc/nginx/nginx.conf', '/etc/nginx/conf.d'],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
service { "nginx":
|
file { '/etc/nginx/nginx.conf':
|
||||||
ensure => running,
|
|
||||||
enable => true,
|
|
||||||
require => Package["nginx"],
|
|
||||||
}
|
|
||||||
|
|
||||||
file { "/etc/nginx/nginx.conf":
|
|
||||||
ensure => present,
|
ensure => present,
|
||||||
mode => "0644",
|
mode => '0644',
|
||||||
owner => "root",
|
owner => 'root',
|
||||||
group => $::operatingsystem ? {
|
group => $::operatingsystem ? {
|
||||||
"openbsd" => "wheel",
|
'openbsd' => 'wheel',
|
||||||
default => "root",
|
default => 'root',
|
||||||
},
|
},
|
||||||
content => template("nginx/nginx.conf.erb"),
|
content => template('nginx/nginx.conf.erb'),
|
||||||
notify => Service["nginx"],
|
notify => Service['nginx'],
|
||||||
require => Package["nginx"],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/etc/nginx/conf.d":
|
file { '/etc/nginx/conf.d':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
mode => "0644",
|
mode => '0644',
|
||||||
owner => "root",
|
owner => 'root',
|
||||||
group => $::operatingsystem ? {
|
group => $::operatingsystem ? {
|
||||||
"openbsd" => "wheel",
|
'openbsd' => 'wheel',
|
||||||
default => "root",
|
default => 'root',
|
||||||
},
|
},
|
||||||
purge => true,
|
purge => true,
|
||||||
force => true,
|
force => true,
|
||||||
recurse => true,
|
recurse => true,
|
||||||
source => "puppet:///modules/custom/empty",
|
source => 'puppet:///modules/custom/empty',
|
||||||
require => Package["nginx"],
|
notify => Service['nginx'],
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
service { 'nginx':
|
||||||
|
ensure => running,
|
||||||
|
enable => true,
|
||||||
# Install and configure nginx with passenger.
|
start => $::operatingsystem ? {
|
||||||
#
|
'openbsd' => '/usr/sbin/nginx -u',
|
||||||
class nginx::passenger inherits nginx {
|
default => undef,
|
||||||
|
},
|
||||||
case $::operatingsystem {
|
|
||||||
"openbsd": {
|
|
||||||
Package["nginx"] {
|
|
||||||
flavor => "passenger",
|
|
||||||
}
|
|
||||||
nginx::configfile { "passenger.conf":
|
|
||||||
source => "puppet:///modules/nginx/passenger.conf",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
fail("Not supported on ${::operatingsystem}")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,30 +68,22 @@ class nginx::passenger inherits nginx {
|
||||||
|
|
||||||
# Add nginx configuration file.
|
# Add nginx configuration file.
|
||||||
#
|
#
|
||||||
define nginx::configfile($source="", $content="") {
|
define nginx::config(
|
||||||
|
$source=undef,
|
||||||
|
$content=undef,
|
||||||
|
) {
|
||||||
|
|
||||||
file { "/etc/nginx/conf.d/${name}":
|
file { "/etc/nginx/conf.d/${name}":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
mode => "0644",
|
mode => '0644',
|
||||||
owner => "root",
|
owner => 'root',
|
||||||
group => $::operatingsystem ? {
|
group => $::operatingsystem ? {
|
||||||
"openbsd" => "wheel",
|
'openbsd' => 'wheel',
|
||||||
default => "root",
|
default => 'root',
|
||||||
},
|
},
|
||||||
notify => Service["nginx"],
|
|
||||||
require => File["/etc/nginx/conf.d"],
|
|
||||||
}
|
|
||||||
|
|
||||||
if $source {
|
|
||||||
File["/etc/nginx/conf.d/${name}"] {
|
|
||||||
source => $source,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if $content {
|
|
||||||
File["/etc/nginx/conf.d/${name}"] {
|
|
||||||
content => $content,
|
content => $content,
|
||||||
}
|
source => $source,
|
||||||
|
notify => Service['nginx'],
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
user <%= @user %>;
|
user <%= @user %>;
|
||||||
worker_processes <%= @processorcount %>;
|
worker_processes <%= @workers %>;
|
||||||
|
worker_rlimit_nofile 1024;
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 1024;
|
worker_connections 1024;
|
||||||
|
@ -9,10 +10,7 @@ http {
|
||||||
include mime.types;
|
include mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
sendfile on;
|
server_tokens off;
|
||||||
tcp_nodelay on;
|
|
||||||
tcp_nopush on;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
|
|
||||||
include conf.d/*.conf;
|
include conf.d/*.conf;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue