diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 3eb00278b..b6eb90ba8 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -65,19 +65,24 @@ $location_cfg_append = undef, $try_files = undef) { File { - owner => 'root', - group => 'root', - mode => '0644', + ensure => $ensure ? { + 'absent' => absent, + default => 'file', + }, + notify => Class['nginx::service'], + owner => 'root', + group => 'root', + mode => '0644', } # Add IPv6 Logic Check - Nginx service will not start if ipv6 is enabled # and support does not exist for it in the kernel. - if ($ipv6_enable == 'true') and ($ipaddress6) { + if ($ipv6_enable == true) and ($ipaddress6) { warning('nginx: IPv6 support is not enabled or configured properly') } # Check to see if SSL Certificates are properly defined. - if ($ssl == 'true') { + if ($ssl == true) { if ($ssl_cert == undef) or ($ssl_key == undef) { fail('nginx: SSL certificate/key (ssl_cert/ssl_cert) and/or SSL Private must be defined and exist on the target system(s)') } @@ -86,18 +91,11 @@ # Use the File Fragment Pattern to construct the configuration files. # Create the base configuration file reference. if ($listen_port != $ssl_port) { - file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-001": - ensure => $ensure ? { - 'absent' => absent, - default => 'file', - }, - content => template('nginx/vhost/vhost_header.erb'), - notify => Class['nginx::service'], - } + file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-001": content => template('nginx/vhost/vhost_header.erb'), } } - if ($ssl == 'true') and ($ssl_port == $listen_port) { - $ssl_only = 'true' + if ($ssl == true) and ($ssl_port == $listen_port) { + $ssl_only = true } # Create the default location reference for the vHost @@ -127,34 +125,13 @@ # Create a proper file close stub. if ($listen_port != $ssl_port) { - file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-699": - ensure => $ensure ? { - 'absent' => absent, - default => 'file', - }, - content => template('nginx/vhost/vhost_footer.erb'), - notify => Class['nginx::service'], - } + file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-699": content => template('nginx/vhost/vhost_footer.erb'), } } # Create SSL File Stubs if SSL is enabled if ($ssl) { - file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-700-ssl": - ensure => $ensure ? { - 'absent' => absent, - default => 'file', - }, - content => template('nginx/vhost/vhost_ssl_header.erb'), - notify => Class['nginx::service'], - } + file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-700-ssl": content => template('nginx/vhost/vhost_ssl_header.erb'), } - file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-999-ssl": - ensure => $ensure ? { - 'absent' => absent, - default => 'file', - }, - content => template('nginx/vhost/vhost_footer.erb'), - notify => Class['nginx::service'], - } + file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-999-ssl": content => template('nginx/vhost/vhost_footer.erb'), } } }