Initial version of nginx module

This commit is contained in:
Ossi Salmi 2011-11-28 00:58:53 +02:00 committed by Timo Mkinen
parent cb8cfa7775
commit 0b4d310656
3 changed files with 127 additions and 0 deletions

View file

@ -0,0 +1,3 @@
passenger_root /usr/local/lib/phusion_passenger;
passenger_ruby /usr/local/bin/ruby18;
passenger_log_level 1;

106
nginx/manifests/init.pp Normal file
View file

@ -0,0 +1,106 @@
# Install and configure nginx.
#
class nginx {
case $operatingsystem {
"openbsd": {
$user = "_nginx"
$group = "_nginx"
}
default: {
$user = "nginx"
$group = "nginx"
}
}
package { "nginx":
ensure => installed,
}
service { "nginx":
enable => true,
ensure => running,
require => Package["nginx"],
}
file { "/etc/nginx/nginx.conf":
ensure => present,
mode => 0644,
owner => "root",
group => $operatingsystem ? {
"openbsd" => "wheel",
default => "root",
},
content => template("nginx/nginx.conf.erb"),
notify => Service["nginx"],
require => Package["nginx"],
}
file { "/etc/nginx/conf.d":
ensure => directory,
mode => 0644,
owner => "root",
group => $operatingsystem ? {
"openbsd" => "wheel",
default => "root",
},
purge => true,
force => true,
recurse => true,
source => "puppet:///modules/custom/empty",
require => Package["nginx"],
}
}
# Install and configure nginx with passenger.
#
class nginx::passenger inherits nginx {
case $operatingsystem {
"openbsd": {
Package["nginx"] {
flavor => "passenger",
}
nginx::configfile { "passenger.conf":
source => "puppet:///modules/nginx/passenger.conf",
}
}
default: {
fail("Not supported on ${operatingsystem}")
}
}
}
# Add nginx configuration file.
#
define nginx::configfile($source="", $content="") {
file { "/etc/nginx/conf.d/${name}":
ensure => present,
mode => 0644,
owner => "root",
group => $operatingsystem ? {
"openbsd" => "wheel",
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,
}
}
}

View file

@ -0,0 +1,18 @@
user <%= user %>;
worker_processes <%= processorcount %>;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nodelay on;
tcp_nopush on;
keepalive_timeout 65;
include conf.d/*.conf;
}