Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I think this is what you meant in issue 62 #79

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions manifests/add_repo.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#
# Creates a file for the repo in question so that we can keep
# the yum directory managed by puppet.
define nginx::add_repo(
$baseurl = undef,
$cost = undef,
$descr = undef,
$enabled = undef,
$enablegroups = undef,
$exclude = undef,
$failovermethod = undef,
$gpgcheck = undef,
$gpgkey = undef,
$http_caching = undef,
$include = undef,
$includepkgs = undef,
$keepalive = undef,
$metadata_expire = undef,
$mirrorlist = undef,
$priority = undef,
$protect = undef,
$proxy = undef,
$proxy_password = undef,
$proxy_username = undef,
$timeout = undef,
) {
file { "yumrepo_${title}":
ensure => 'file',
group => 'root',
mode => '0444',
owner => 'root',
path => "/etc/yum.repos.d/${title}.repo",
}
yumrepo {$title:
baseurl => $baseurl,
cost => $cost,
descr => $descr,
enabled => $enabled,
enablegroups => $enablegroups,
exclude => $exclude,
failovermethod => $failovermethod,
gpgcheck => $gpgcheck,
gpgkey => $gpgkey,
http_caching => $http_caching,
include => $include,
includepkgs => $includepkgs,
keepalive => $keepalive,
metadata_expire => $metadata_expire,
mirrorlist => $mirrorlist,
priority => $priority,
protect => $protect,
proxy => $proxy,
proxy_password => $proxy_password,
proxy_username => $proxy_username,
timeout => $timeout,
}
}
56 changes: 28 additions & 28 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,87 +14,87 @@
#
# This class file is not called directly
class nginx::config(
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$confd_purge = $nginx::params::nx_confd_purge,
$server_tokens = $nginx::params::nx_server_tokens,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$proxy_cache_path = $nginx::params::nx_proxy_cache_path,
$proxy_cache_levels = $nginx::params::nx_proxy_cache_levels,
$proxy_cache_keys_zone = $nginx::params::nx_proxy_cache_keys_zone,
$proxy_cache_max_size = $nginx::params::nx_proxy_cache_max_size,
$proxy_cache_inactive = $nginx::params::nx_proxy_cache_inactive,
$proxy_http_version = $nginx::params::nx_proxy_http_version,
$types_hash_max_size = $nginx::params::nx_types_hash_max_size,
$types_hash_bucket_size = $nginx::params::nx_types_hash_bucket_size
) inherits nginx::params {
$confd_purge = $nginx::confd_purge,
$proxy_cache_inactive = $nginx::proxy_cache_inactive,
$proxy_cache_keys_zone = $nginx::proxy_cache_keys_zone,
$proxy_cache_levels = $nginx::proxy_cache_levels,
$proxy_cache_max_size = $nginx::proxy_cache_max_size,
$proxy_cache_path = $nginx::proxy_cache_path,
$proxy_http_version = $nginx::proxy_http_version,
$proxy_set_header = $nginx::proxy_set_header,
$server_tokens = $nginx::server_tokens,
$types_hash_bucket_size = $nginx::types_hash_bucket_size,
$types_hash_max_size = $nginx::types_hash_max_size,
$worker_connections = $nginx::worker_connections,
$worker_processes = $nginx::worker_processes,
) inherits nginx {
File {
owner => 'root',
group => 'root',
mode => '0644',
}

file { $nginx::params::nx_conf_dir:
file { $nginx::conf_dir:
ensure => directory,
}

file { "${nginx::params::nx_conf_dir}/conf.d":
file { "${nginx::conf_dir}/conf.d":
ensure => directory,
}
if $confd_purge == true {
File["${nginx::params::nx_conf_dir}/conf.d"] {
File["${nginx::conf_dir}/conf.d"] {
ignore => 'vhost_autogen.conf',
purge => true,
recurse => true,
}
}

file { "${nginx::params::nx_conf_dir}/conf.mail.d":
file { "${nginx::conf_dir}/conf.mail.d":
ensure => directory,
}
if $confd_purge == true {
File["${nginx::params::nx_conf_dir}/conf.mail.d"] {
File["${nginx::conf_dir}/conf.mail.d"] {
ignore => 'vhost_autogen.conf',
purge => true,
recurse => true,
}
}

file {$nginx::config::nx_run_dir:
file {$nginx::run_dir:
ensure => directory,
}

file {$nginx::config::nx_client_body_temp_path:
file {$nginx::client_body_temp_path:
ensure => directory,
owner => $nginx::params::nx_daemon_user,
owner => $nginx::daemon_user,
}

file {$nginx::config::nx_proxy_temp_path:
file {$nginx::proxy_temp_path:
ensure => directory,
owner => $nginx::params::nx_daemon_user,
owner => $nginx::daemon_user,
}

file { '/etc/nginx/sites-enabled/default':
ensure => absent,
}

file { "${nginx::params::nx_conf_dir}/nginx.conf":
file { "${nginx::conf_dir}/nginx.conf":
ensure => file,
content => template('nginx/conf.d/nginx.conf.erb'),
}

file { "${nginx::params::nx_conf_dir}/conf.d/proxy.conf":
file { "${nginx::conf_dir}/conf.d/proxy.conf":
ensure => file,
content => template('nginx/conf.d/proxy.conf.erb'),
}

file { "${nginx::config::nx_temp_dir}/nginx.d":
file { "${nginx::temp_dir}/nginx.d":
ensure => directory,
purge => true,
recurse => true,
}

file { "${nginx::config::nx_temp_dir}/nginx.mail.d":
file { "${nginx::temp_dir}/nginx.mail.d":
ensure => directory,
purge => true,
recurse => true,
Expand Down
71 changes: 48 additions & 23 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,45 @@
# include nginx
# }
class nginx (
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$proxy_http_version = $nginx::params::nx_proxy_http_version,
$confd_purge = $nginx::params::nx_confd_purge,
$proxy_cache_path = $nginx::params::nx_proxy_cache_path,
$proxy_cache_levels = $nginx::params::nx_proxy_cache_levels,
$proxy_cache_keys_zone = $nginx::params::nx_proxy_cache_keys_zone,
$proxy_cache_max_size = $nginx::params::nx_proxy_cache_max_size,
$proxy_cache_inactive = $nginx::params::nx_proxy_cache_inactive,
$configtest_enable = $nginx::params::nx_configtest_enable,
$service_restart = $nginx::params::nx_service_restart,
$mail = $nginx::params::nx_mail,
$server_tokens = $nginx::params::nx_server_tokens
$client_body_buffer_size = $nginx::params::nx_client_body_buffer_size,
$client_body_temp_path = $nginx::params::nx_client_body_temp_path,
$client_max_body_size = $nginx::params::nx_client_max_body_size,
$conf_dir = $nginx::params::nx_conf_dir,
$confd_purge = $nginx::params::nx_confd_purge,
$configtest_enable = $nginx::params::nx_configtest_enable,
$daemon_user = $nginx::params::nx_daemon_user,
$events_use = $nginx::params::nx_events_use,
$gzip = $nginx::params::nx_gzip,
$keepalive_timeout = $nginx::params::nx_keepalive_timeout,
$logdir = $nginx::params::nx_logdir,
$mail = $nginx::params::nx_mail,
$multi_accept = $nginx::params::multi_accept,
$names_hash_bucket_size = $nginx::params::names_hash_bucket_size,
$pid = $nginx::params::nx_pid,
$proxy_buffers = $nginx::params::nx_proxy_buffers,
$proxy_cache_inactive = $nginx::params::nx_proxy_cache_inactive,
$proxy_cache_keys_zone = $nginx::params::nx_proxy_cache_keys_zone,
$proxy_cache_levels = $nginx::params::nx_proxy_cache_levels,
$proxy_cache_max_size = $nginx::params::nx_proxy_cache_max_size,
$proxy_cache_path = $nginx::params::nx_proxy_cache_path,
$proxy_connect_timeout = $nginx::params::nx_proxy_connect_timeout,
$proxy_http_version = $nginx::params::nx_proxy_http_version,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$proxy_redirect = $nginx::params::nx_proxy_redirect,
$proxy_send_timeout = $nginx::params::nx_proxy_send_timeout,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$proxy_temp_path = $nginx::params::nx_proxy_temp_path,
$run_dir = $nginx::params::nx_run_dir,
$sendfile = $nginx::params::nx_sendfile,
$server_tokens = $nginx::params::nx_server_tokens,
$service_restart = $nginx::params::nx_service_restart,
$tcp_nodelay = $nginx::params::nx_tcp_nodelay,
$tcp_nopush = $nginx::params::nx_tcp_nopush,
$temp_dir = $nginx::params::temp_dir,
$types_hash_bucket_size = $nginx::params::nx_types_hash_bucket_size,
$types_hash_max_size = $nginx::params::nx_types_hash_max_size,
$worker_connections = $nginx::params::nx_worker_connections,
$worker_processes = $nginx::params::nx_worker_processes,
) inherits nginx::params {

include stdlib
Expand All @@ -52,18 +77,18 @@
}

class { 'nginx::config':
worker_processes => $worker_processes,
worker_connections => $worker_connections,
proxy_set_header => $proxy_set_header,
proxy_http_version => $proxy_http_version,
proxy_cache_path => $proxy_cache_path,
proxy_cache_levels => $proxy_cache_levels,
confd_purge => $confd_purge,
notify => Class['nginx::service'],
proxy_cache_inactive => $proxy_cache_inactive,
proxy_cache_keys_zone => $proxy_cache_keys_zone,
proxy_cache_levels => $proxy_cache_levels,
proxy_cache_max_size => $proxy_cache_max_size,
proxy_cache_inactive => $proxy_cache_inactive,
confd_purge => $confd_purge,
proxy_cache_path => $proxy_cache_path,
proxy_http_version => $proxy_http_version,
proxy_set_header => $proxy_set_header,
require => Class['nginx::package'],
notify => Class['nginx::service'],
worker_connections => $worker_connections,
worker_processes => $worker_processes,
}

class { 'nginx::service':
Expand Down
2 changes: 1 addition & 1 deletion manifests/package/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
$os_rel = $::lsbmajdistrelease
}

yumrepo { 'nginx-release':
nginx::add_repo { 'nginx-release':
baseurl => "http://nginx.org/packages/${os_type}/${os_rel}/\$basearch/",
descr => 'nginx repo',
enabled => '1',
Expand Down
69 changes: 33 additions & 36 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,45 @@
#
# This class file is not called directly
class nginx::params {
$nx_temp_dir = '/tmp'
$nx_run_dir = '/var/nginx'

$nx_client_body_buffer_size = '128k'
$nx_client_max_body_size = '10m'
$nx_conf_dir = '/etc/nginx'
$nx_confd_purge = false
$nx_worker_processes = 1
$nx_worker_connections = 1024
$nx_types_hash_max_size = 1024
$nx_types_hash_bucket_size = 512
$nx_names_hash_bucket_size = 64
$nx_multi_accept = off
$nx_events_use = false # One of [kqueue|rtsig|epoll|/dev/poll|select|poll|eventport] or false to use OS default
$nx_sendfile = on
$nx_keepalive_timeout = 65
$nx_tcp_nodelay = on
$nx_gzip = on
$nx_server_tokens = on
$nx_spdy = off
$nx_ssl_stapling = off


$nx_proxy_redirect = off
$nx_events_use = false # One of [kqueue|rtsig|epoll|/dev/poll|select|poll|eventport] or false to use OS default
$nx_gzip = 'on'
$nx_keepalive_timeout = '65'
$nx_mail = false
$nx_multi_accept = 'off'
$nx_names_hash_bucket_size = '64'
$nx_proxy_buffers = '32 4k'
$nx_proxy_cache_inactive = '20m'
$nx_proxy_cache_keys_zone = 'd2:100m'
$nx_proxy_cache_levels = '1'
$nx_proxy_cache_max_size = '500m'
$nx_proxy_cache_path = false
$nx_proxy_connect_timeout = '90'
$nx_proxy_http_version = '1.0'
$nx_proxy_read_timeout = '90'
$nx_proxy_redirect = 'off'
$nx_proxy_send_timeout = '90'
$nx_proxy_set_header = [
'Host $host',
'X-Real-IP $remote_addr',
'X-Forwarded-For $proxy_add_x_forwarded_for',
]
$nx_proxy_cache_path = false
$nx_proxy_cache_levels = 1
$nx_proxy_cache_keys_zone = 'd2:100m'
$nx_proxy_cache_max_size = '500m'
$nx_proxy_cache_inactive = '20m'

$nx_client_body_temp_path = "${nx_run_dir}/client_body_temp"
$nx_client_body_buffer_size = '128k'
$nx_client_max_body_size = '10m'
$nx_proxy_temp_path = "${nx_run_dir}/proxy_temp"
$nx_proxy_connect_timeout = '90'
$nx_proxy_send_timeout = '90'
$nx_proxy_read_timeout = '90'
$nx_proxy_buffers = '32 4k'
$nx_proxy_http_version = '1.0'
$nx_run_dir = '/var/nginx'
$nx_client_body_temp_path = "${nx_run_dir}/client_body_temp"
$nx_proxy_temp_path = "${nx_run_dir}/proxy_temp"
$nx_sendfile = 'on'
$nx_server_tokens = 'on'
$nx_spdy = 'off'
$nx_ssl_stapling = 'off'
$nx_tcp_nodelay = 'on'
$nx_temp_dir = '/tmp'
$nx_types_hash_bucket_size = '512'
$nx_types_hash_max_size = '1024'
$nx_worker_connections = '1024'
$nx_worker_processes = '1'

$nx_logdir = $::kernel ? {
/(?i-mx:linux)/ => '/var/log/nginx',
Expand All @@ -76,6 +73,6 @@
$nx_configtest_enable = false
$nx_service_restart = '/etc/init.d/nginx configtest && /etc/init.d/nginx restart'

$nx_mail = false


}
8 changes: 4 additions & 4 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
'index.htm',
'index.php'],
$proxy = undef,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$proxy_read_timeout = $nginx::proxy_read_timeout,
$fastcgi = undef,
$fastcgi_params = '/etc/nginx/fastcgi_params',
$fastcgi_script = undef,
Expand Down Expand Up @@ -125,23 +125,23 @@

## Create stubs for vHost File Fragment Pattern
if ($ssl_only != true) {
file {"${nginx::config::nx_temp_dir}/nginx.d/${vhost}-500-${name}":
file {"${nginx::temp_dir}/nginx.d/${vhost}-500-${name}":
ensure => $ensure_real,
content => $content_real,
}
}

## Only create SSL Specific locations if $ssl is true.
if ($ssl == true) {
file {"${nginx::config::nx_temp_dir}/nginx.d/${vhost}-800-${name}-ssl":
file {"${nginx::temp_dir}/nginx.d/${vhost}-800-${name}-ssl":
ensure => $ensure_real,
content => $content_real,
}
}

if ($auth_basic_user_file != undef) {
#Generate htpasswd with provided file-locations
file { "${nginx::params::nx_conf_dir}/${name}_htpasswd":
file { "${nginx::conf_dir}/${name}_htpasswd":
ensure => $ensure,
mode => '0644',
source => $auth_basic_user_file,
Expand Down
Loading