From 4558791e49640f61d9b5ac3b1a5bcf19c8307c8d Mon Sep 17 00:00:00 2001 From: James Fryman Date: Mon, 6 Jun 2011 10:04:24 -0500 Subject: [PATCH] Updated Package Layout --- README | 19 ++++++++++++------- manifests/init.pp | 1 - manifests/package.pp | 29 ++++++++--------------------- manifests/package/debian.pp | 5 +++++ manifests/package/redhat.pp | 17 +++++++++++++++++ manifests/vhost.pp | 3 ++- templates/vhost.erb | 12 ++++++------ 7 files changed, 50 insertions(+), 36 deletions(-) create mode 100644 manifests/package/debian.pp create mode 100644 manifests/package/redhat.pp diff --git a/README b/README index 7ddc087..68ec076 100644 --- a/README +++ b/README @@ -4,16 +4,21 @@ This is the nginx module. User Stories: * Must be able to be used on a major linux system - - Ubuntu (LTS/Current) - - Debian (stable) - - CentOS/RHEL/Fedora - - SLES + - Ubuntu (LTS/Current) [DONE] + - Debian (stable) [DONE] + - CentOS [DONE] + - RHEL [CANNOT TEST] + - Fedora [DONE] + - SLES - Solaris (optional goal) * Must be able to install NGINX - - must have an option to perform a base install + - must have an option to perform a base install [DONE] - must have an option to install a PHP/MySQL Stack - must have an option to install a Perl/MySQL stack * Must be able to create a new vhost - - vhost must be able to be ssl enabled + - vhost must be able to be ssl enabled [DONE] - vhost must be able to point to N proxies - - vhost must be able to create a rewrite rule \ No newline at end of file + - vhost must be able to create a rewrite rule + + * errors detected: + fails on ipv6 if ipv6 is not enabled on the host. Need some error check. \ No newline at end of file diff --git a/manifests/init.pp b/manifests/init.pp index 1459043..8a19b26 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -17,5 +17,4 @@ class nginx { include nginx::service Class['nginx::package'] -> Class['nginx::config'] ~> Class['nginx::service'] - } diff --git a/manifests/package.pp b/manifests/package.pp index 3e744d4..29d3ae7 100644 --- a/manifests/package.pp +++ b/manifests/package.pp @@ -1,23 +1,10 @@ class nginx::package { - - package { 'nginx': - ensure => present, - } - - case $operatingsystem { - rhel,centos,oel: { - package { 'GeoIP': - ensure => present, - } - package { 'gd': - ensure => present, - } - package { 'libXpm': - ensure => present, - } - package { 'libxslt': - ensure => present, - } - } - } + case $operatingsystem { + centos,fedora,rhel: { + include nginx::package::redhat + } + debian,ubuntu: { + include nginx::package::debian + } + } } \ No newline at end of file diff --git a/manifests/package/debian.pp b/manifests/package/debian.pp new file mode 100644 index 0000000..2678f76 --- /dev/null +++ b/manifests/package/debian.pp @@ -0,0 +1,5 @@ +class nginx::package::debian { + package { 'nginx': + ensure => present, + } +} \ No newline at end of file diff --git a/manifests/package/redhat.pp b/manifests/package/redhat.pp new file mode 100644 index 0000000..ed54bdc --- /dev/null +++ b/manifests/package/redhat.pp @@ -0,0 +1,17 @@ +class nginx::package::redhat { + package { 'nginx': + ensure => present, + } + package { 'GeoIP': + ensure => present, + } + package { 'gd': + ensure => present, + } + package { 'libXpm': + ensure => present, + } + package { 'libxslt': + ensure => present, + } +} \ No newline at end of file diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 46b0d67..7cf1b64 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -16,7 +16,8 @@ define nginx::vhost( if ($ssl == 'true') { if ($ssl_cert == undef) { fail('SSL Certificate (ssl_cert) must be defined and exist on the target system(s)') - } elsif ($ssl_key == undef) { + } + if ($ssl_key == undef) { fail('SSL Private Key (ssl_key) must be defined and exist on the target system(s)') } } diff --git a/templates/vhost.erb b/templates/vhost.erb index 3ecbdc8..7b519c4 100644 --- a/templates/vhost.erb +++ b/templates/vhost.erb @@ -1,7 +1,7 @@ server { - listen <%= listen_ip %>; - <% if ipv6_enable == 'true' %>listen [<%= ipv6_listen_ip %>]:<%= ipv6_listen_port %> default ipv6only=on;<% end %> - server_name <%= name %>; + listen <%= listen_ip %>; + <% if ipv6_enable == 'true' %>listen [<%= ipv6_listen_ip %>]:<%= ipv6_listen_port %> default ipv6only=on;<% end %> + server_name <%= name %>; access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/<%= name %>.access.log; @@ -13,11 +13,11 @@ server { <% if ssl == 'true' %> server { - listen 443; + listen 443; server_name <%= name %>; - ssl on; - ssl_certificate <%= ssl_cert %>; + ssl on; + ssl_certificate <%= ssl_cert %>; ssl_certificate_key <%= ssl_key %>; ssl_session_timeout 5m;