Merge branch 'master' of https://github.com/jfryman/puppet-nginx into dev
Conflicts: manifests/config.pp manifests/resource/location.pp
This commit is contained in:
commit
20a37a220f
9 changed files with 73 additions and 20 deletions
31
Gemfile.lock
31
Gemfile.lock
|
@ -1,6 +1,7 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
builder (3.2.2)
|
||||
diff-lcs (1.2.4)
|
||||
facter (1.7.1)
|
||||
hiera (1.2.1)
|
||||
|
@ -8,6 +9,7 @@ GEM
|
|||
highline (1.6.19)
|
||||
json (1.8.0)
|
||||
json_pure (1.8.0)
|
||||
kwalify (0.7.2)
|
||||
librarian (0.1.0)
|
||||
highline
|
||||
thor (~> 0.15)
|
||||
|
@ -19,6 +21,9 @@ GEM
|
|||
mime-types (1.23)
|
||||
mocha (0.14.0)
|
||||
metaclass (~> 0.0.1)
|
||||
net-scp (1.1.2)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (2.6.8)
|
||||
nokogiri (1.5.9)
|
||||
puppet (3.2.1)
|
||||
facter (~> 1.6)
|
||||
|
@ -37,6 +42,10 @@ GEM
|
|||
rspec (>= 2.9.0)
|
||||
rspec-puppet (>= 0.1.1)
|
||||
rake (10.0.4)
|
||||
rbvmomi (1.6.0)
|
||||
builder
|
||||
nokogiri (>= 1.4.1)
|
||||
trollop
|
||||
rest-client (1.6.7)
|
||||
mime-types (>= 1.16)
|
||||
rgen (0.6.2)
|
||||
|
@ -50,7 +59,26 @@ GEM
|
|||
rspec-mocks (2.13.1)
|
||||
rspec-puppet (0.1.6)
|
||||
rspec
|
||||
rspec-system (2.2.0)
|
||||
kwalify (~> 0.7.2)
|
||||
net-scp (~> 1.1)
|
||||
net-ssh (~> 2.6)
|
||||
nokogiri (~> 1.5.9)
|
||||
rbvmomi (~> 1.6)
|
||||
rspec (~> 2.13)
|
||||
systemu (~> 2.5)
|
||||
rspec-system-puppet (2.2.0)
|
||||
rspec-system (~> 2.0)
|
||||
rspec-system-serverspec (1.0.0)
|
||||
rspec-system (~> 2.0)
|
||||
serverspec (~> 0.6.0)
|
||||
serverspec (0.6.3)
|
||||
highline
|
||||
net-ssh
|
||||
rspec (~> 2.0)
|
||||
systemu (2.5.2)
|
||||
thor (0.18.1)
|
||||
trollop (2.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -63,3 +91,6 @@ DEPENDENCIES
|
|||
puppetlabs_spec_helper
|
||||
rake (>= 0.9.2.2)
|
||||
rspec-puppet (>= 0.1.3)
|
||||
rspec-system-puppet
|
||||
rspec-system-serverspec
|
||||
serverspec
|
||||
|
|
|
@ -8,3 +8,4 @@ description 'This module can be used for basic NGINX Management'
|
|||
project_page 'http://github.com/jfryman/puppet-nginx'
|
||||
|
||||
dependency 'puppetlabs/stdlib', '>= 0.1.6'
|
||||
dependency 'puppetlabs/apt', '>= 1.0.0'
|
||||
|
|
|
@ -27,9 +27,12 @@ class nginx::config(
|
|||
$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,
|
||||
$client_max_body_size = $nginx::params::nx_client_max_body_size,
|
||||
$proxy_buffers = $nginx::params::nx_proxy_buffers,
|
||||
$http_cfg_append = $nginx::params::nx_http_cfg_append,
|
||||
$nginx_error_log = $nginx::params::nx_nginx_error_log,
|
||||
$http_access_log = $nginx::params::nx_http_access_log,
|
||||
$proxy_buffer_size = $nginx::params::nx_proxy_buffer_size,
|
||||
) inherits nginx::params {
|
||||
File {
|
||||
owner => 'root',
|
||||
|
|
|
@ -44,6 +44,9 @@ class nginx (
|
|||
$service_restart = $nginx::params::nx_service_restart,
|
||||
$mail = $nginx::params::nx_mail,
|
||||
$server_tokens = $nginx::params::nx_server_tokens,
|
||||
$client_max_body_size = $nginx::params::nx_client_max_body_size,
|
||||
$proxy_buffers = $nginx::params::nx_proxy_buffers,
|
||||
$proxy_buffer_size = $nginx::params::nx_proxy_buffer_size,
|
||||
$http_cfg_append = $nginx::params::nx_http_cfg_append,
|
||||
$nginx_error_log = $nginx::params::nx_nginx_error_log,
|
||||
$http_access_log = $nginx::params::nx_http_access_log,
|
||||
|
@ -70,6 +73,9 @@ class nginx (
|
|||
proxy_cache_inactive => $proxy_cache_inactive,
|
||||
confd_purge => $confd_purge,
|
||||
server_tokens => $server_tokens,
|
||||
client_max_body_size => $client_max_body_size,
|
||||
proxy_buffers => $proxy_buffers,
|
||||
proxy_buffer_size => $proxy_buffer_size,
|
||||
http_cfg_append => $http_cfg_append,
|
||||
nginx_error_log => $nginx_error_log,
|
||||
http_access_log => $http_access_log,
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#
|
||||
# This class file is not called directly
|
||||
class nginx::package::debian {
|
||||
$operatingsystem_lowercase = inline_template('<%= @operatingsystem.downcase %>')
|
||||
$distro = downcase($::operatingsystem)
|
||||
|
||||
package { 'nginx':
|
||||
ensure => $nginx::package_ensure,
|
||||
|
@ -23,20 +23,13 @@ class nginx::package::debian {
|
|||
|
||||
anchor { 'nginx::apt_repo' : }
|
||||
|
||||
file { '/etc/apt/sources.list.d/nginx.list':
|
||||
ensure => present,
|
||||
content => "deb http://nginx.org/packages/${operatingsystem_lowercase}/ ${::lsbdistcodename} nginx
|
||||
deb-src http://nginx.org/packages/${operatingsystem_lowercase}/ ${::lsbdistcodename} nginx
|
||||
",
|
||||
mode => '0444',
|
||||
require => Exec['add_nginx_apt_key'],
|
||||
before => Anchor['nginx::apt_repo'],
|
||||
}
|
||||
include '::apt'
|
||||
|
||||
exec { 'add_nginx_apt_key':
|
||||
command => '/usr/bin/wget http://nginx.org/keys/nginx_signing.key -O - | /usr/bin/apt-key add -',
|
||||
unless => '/usr/bin/apt-key list | /bin/grep -q nginx',
|
||||
before => Anchor['nginx::apt_repo'],
|
||||
apt::source { 'nginx':
|
||||
location => "http://nginx.org/packages/${distro}",
|
||||
repos => 'nginx',
|
||||
key => '7BD9BF62',
|
||||
key_source => 'http://nginx.org/keys/nginx_signing.key',
|
||||
}
|
||||
|
||||
exec { 'apt_get_update_for_nginx':
|
||||
|
@ -44,7 +37,7 @@ class nginx::package::debian {
|
|||
timeout => 240,
|
||||
returns => [ 0, 100 ],
|
||||
refreshonly => true,
|
||||
subscribe => File['/etc/apt/sources.list.d/nginx.list'],
|
||||
subscribe => Apt::Source['nginx'],
|
||||
before => Anchor['nginx::apt_repo'],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ class nginx::params {
|
|||
$nx_proxy_read_timeout = '90'
|
||||
$nx_proxy_buffers = '32 4k'
|
||||
$nx_proxy_http_version = '1.0'
|
||||
$nx_proxy_buffer_size = '8k'
|
||||
|
||||
$nx_logdir = $::kernel ? {
|
||||
/(?i-mx:linux)/ => '/var/log/nginx',
|
||||
|
|
|
@ -262,7 +262,7 @@ define nginx::resource::vhost (
|
|||
'absent' => absent,
|
||||
default => 'file',
|
||||
},
|
||||
content => template('nginx/vhost/vhost_footer.erb'),
|
||||
content => template('nginx/vhost/vhost_ssl_footer.erb'),
|
||||
notify => Class['nginx::service'],
|
||||
}
|
||||
|
||||
|
@ -273,11 +273,13 @@ define nginx::resource::vhost (
|
|||
# Check if the file has been defined before creating the file to
|
||||
# avoid the error when using wildcard cert on the multiple vhosts
|
||||
ensure_resource('file', "${nginx::params::nx_conf_dir}/${cert}.crt", {
|
||||
mode => '0644',
|
||||
owner => $nginx::params::nx_daemon_user,
|
||||
mode => '0444',
|
||||
source => $ssl_cert,
|
||||
})
|
||||
ensure_resource('file', "${nginx::params::nx_conf_dir}/${cert}.key", {
|
||||
mode => '0644',
|
||||
owner => $nginx::params::nx_daemon_user,
|
||||
mode => '0440',
|
||||
source => $ssl_key,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
proxy_redirect <%= scope.lookupvar('nginx::params::nx_proxy_redirect') %>;
|
||||
client_max_body_size <%= scope.lookupvar('nginx::params::nx_client_max_body_size') %>;
|
||||
client_max_body_size <%= @client_max_body_size %>;
|
||||
client_body_buffer_size <%= scope.lookupvar('nginx::params::nx_client_body_buffer_size') %>;
|
||||
proxy_connect_timeout <%= scope.lookupvar('nginx::params::nx_proxy_connect_timeout') %>;
|
||||
proxy_send_timeout <%= scope.lookupvar('nginx::params::nx_proxy_send_timeout') %>;
|
||||
proxy_read_timeout <%= scope.lookupvar('nginx::params::nx_proxy_read_timeout') %>;
|
||||
proxy_buffers <%= scope.lookupvar('nginx::params::nx_proxy_buffers') %>;
|
||||
proxy_buffers <%= @proxy_buffers %>;
|
||||
proxy_buffer_size <%= @proxy_buffer_size %>;
|
||||
proxy_http_version <%= @proxy_http_version %>;
|
||||
<% @proxy_set_header.each do |header| %>
|
||||
proxy_set_header <%= header %>;<% end %>
|
||||
|
|
15
templates/vhost/vhost_ssl_footer.erb
Normal file
15
templates/vhost/vhost_ssl_footer.erb
Normal file
|
@ -0,0 +1,15 @@
|
|||
<% if @include_files %><% @include_files.each do |file| -%>
|
||||
include <%= file %>;
|
||||
<% end -%><% end -%>
|
||||
<% if @vhost_cfg_append -%><% vhost_cfg_append.each do |key,value| -%>
|
||||
<%= key %> <%= value %>;
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
}
|
||||
<% if @rewrite_www_to_non_www -%>
|
||||
server {
|
||||
listen <%= @listen_ip %>:<%= @ssl_port %> ssl;
|
||||
server_name www.<%= @name.gsub(/^www\./, '') %>;
|
||||
rewrite ^ https://<%= @name.gsub(/^www\./, '') %>$uri permanent;
|
||||
}
|
||||
<% end %>
|
Loading…
Reference in a new issue