diff --git a/manifests/config.pp b/manifests/config.pp index 46f16df..2d15ba4 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -2,7 +2,19 @@ assert_private("Use of private class ${name} by ${caller_module_name}") - file { "${nginx::install_location}/sites-enabled": + file { "${nginx::install_location}/nginx.conf": + ensure => file, + content => epp("${module_name}/nginx.conf.epp", + { + 'install_location' => $nginx::install_location, + } + ), + } + -> file { "${nginx::install_location}/sites-available": + ensure => directory, + recurse => true, + } + -> file { "${nginx::install_location}/sites-enabled": ensure => directory, purge => $nginx::enabled_sites_manage, recurse => true, diff --git a/manifests/repo.pp b/manifests/repo.pp index c8c07bc..6f78e9c 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -15,6 +15,13 @@ require apt case $nginx::repo_branch { 'mainline': { + if $::facts[os][name] == 'Ubuntu' { + $ppa = 'ppa:nginx/development' + apt::ppa { $ppa: + ensure => absent, + } + } + apt::source { "nginx-${nginx::repo_branch}": ensure => $nginx::repo_ensure, location => $nginx::repo_sources[mainline], @@ -32,6 +39,13 @@ } } default: { + if $::facts[os][name] == 'Ubuntu' { + $ppa = 'ppa:nginx/stable' + apt::ppa { $ppa: + ensure => absent, + } + } + apt::source { "nginx-${nginx::repo_branch}": ensure => $nginx::repo_ensure, location => $nginx::repo_sources[mainline], diff --git a/templates/nginx.conf.epp b/templates/nginx.conf.epp new file mode 100644 index 0000000..82cbbd5 --- /dev/null +++ b/templates/nginx.conf.epp @@ -0,0 +1,37 @@ +<%- | String $install_location +| -%> +# HEADER: This file is managed by Puppet; changes may be overwritten. + +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include <%= $install_location %>/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + + include <%= $install_location %>/conf.d/*.conf; + include <%= $install_location %>/sites-enabled/*; +} diff --git a/templates/nginx.conf.render.sh b/templates/nginx.conf.render.sh new file mode 100755 index 0000000..be8868b --- /dev/null +++ b/templates/nginx.conf.render.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +puppet epp render nginx.conf.epp --values '{ install_location => "/etc/nginx" }'