Skip to content

vhost - additional parameter for expansion in user vhost template #76

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
}

# The whole nginx configuration directory can be recursively overriden
if $nginx::source_dir {
if $nginx::source_dir != '' {
file { 'nginx.dir':
ensure => directory,
path => $nginx::config_dir,
Expand Down
3 changes: 3 additions & 0 deletions manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# - The $port to configure the host on
# - The $docroot provides the Documentation Root variable
# - The $template option specifies whether to use the default template or override
# - The $options can be an array or hash variable that the custom
# template may use for expanding custom variables
# - The $priority of the site
# - The $serveraliases of the site
#
Expand All @@ -26,6 +28,7 @@
$docroot,
$port = '80',
$template = 'nginx/vhost/vhost.conf.erb',
$options = undef,
$priority = '50',
$serveraliases = '',
$create_docroot = true,
Expand Down
10 changes: 10 additions & 0 deletions templates/vhost/vhost_redirect.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Virtual host <%= @name %>
# This file has been provided by puppet for <%= @fqdn %>.
# DON'T EDIT it manually, any changes will be lost
#

server {
listen <%= @port %>;
server_name <%= @serveraliases.join(" ") %>;
return <% if @options['status_code'] then -%><%= @options['status_code'] -%><% else %>301<%- end -%> <%= @options['redirect_url'] %>$request_uri;
}