diff options
-rw-r--r-- | manifests/init.pp | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 6d4711d..582f795 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -68,37 +68,41 @@ class nginx::base { } class nginx inherits nginx::base { - if $ssl == true { - file { [ "/etc/ssl", "/etc/ssl/certs", "/etc/ssl/private" ]: - ensure => directory, - owner => "root", - group => "root", - } - - file { "/etc/ssl/certs/cert.crt": - ensure => present, - owner => "root", - group => "root", - mode => 644, - source => "puppet://$server/files/keys/ssl/cert.crt", - require => File["/etc/ssl/certs"], - } - - file { "/etc/ssl/private/cert.pem": - ensure => present, - owner => "root", - group => "root", - mode => 600, - source => "puppet://$server/files/keys/ssl/cert.pem", - require => File["/etc/ssl/private"], - } - - Service { "nginx": - enable => true, - ensure => running, - hasrestart => true, - require => [ File["/etc/nginx/sites-enabled/$domain"], Package["nginx"], - File["/etc/ssl/private/cert.pem"], File["/etc/ssl/certs/cert.crt"] ], + case $ssl { + true: { + file { [ "/etc/ssl", "/etc/ssl/certs", "/etc/ssl/private" ]: + ensure => directory, + owner => "root", + group => "root", + } + + file { "/etc/ssl/certs/cert.crt": + ensure => present, + owner => "root", + group => "root", + mode => 644, + source => "puppet://$server/files/keys/ssl/cert.crt", + require => File["/etc/ssl/certs"], + } + + file { "/etc/ssl/private/cert.pem": + ensure => present, + owner => "root", + group => "root", + mode => 600, + source => "puppet://$server/files/keys/ssl/cert.pem", + require => File["/etc/ssl/private"], + } + + service { "nginx": + enable => true, + ensure => running, + hasrestart => true, + require => [ File["/etc/nginx/sites-enabled/$domain"], + Package["nginx"], + File["/etc/ssl/private/cert.pem"], + File["/etc/ssl/certs/cert.crt"] ], + } } } @@ -111,7 +115,7 @@ class nginx::puppetmaster inherits nginx::base { define proxy($name, $worker_processes = 4, $worker_connections = 1024, $ssl_port = 8140, $non_ssl_port = 8141, - $puppetmaster_servers = [ "127.0.0.1:18140", ]) { + $puppetmaster_servers = [ "127.0.0.1:18140" ]) { file { "/etc/nginx/sites-available/$name": content => "puppetmaster.erb", |