summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/site.pp12
-rw-r--r--manifests/site/config.pp1
-rw-r--r--templates/site-ssl.erb6
-rw-r--r--templates/site.erb4
4 files changed, 12 insertions, 11 deletions
diff --git a/manifests/site.pp b/manifests/site.pp
index 4391485..f73ae30 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -21,12 +21,12 @@ define nginx::site(
}
nginx::site::config { "${name}-ssl":
- name => $name,
- ensure => $ssl,
- source => $source,
- template => "${template}-ssl",
- backend => $backend,
- require => $certbot ? {
+ use_fqdn => $name,
+ ensure => $ssl,
+ source => $source,
+ template => "${template}-ssl",
+ backend => $backend,
+ require => $certbot ? {
true => Certbot::Manage[$name],
default => undef,
}
diff --git a/manifests/site/config.pp b/manifests/site/config.pp
index ed641b1..8bb7304 100644
--- a/manifests/site/config.pp
+++ b/manifests/site/config.pp
@@ -1,4 +1,5 @@
define nginx::site::config(
+ $use_fqdn = $name,
$ensure = present,
$source = 'template',
$template = 'site',
diff --git a/templates/site-ssl.erb b/templates/site-ssl.erb
index 871aeb4..ee9c5c8 100644
--- a/templates/site-ssl.erb
+++ b/templates/site-ssl.erb
@@ -1,10 +1,10 @@
server {
listen 443 ssl http2;
- server_name *.<%= @name %> <%= @name %>;
+ server_name *.<%= @use_fqdn %> <%= @use_fqdn %>;
ssl on;
- ssl_certificate /etc/letsencrypt/live/<%= @name %>/fullchain.pem;
- ssl_certificate_key /etc/letsencrypt/live/<%= @name %>/privkey.pem;
+ ssl_certificate /etc/letsencrypt/live/<%= @use_fqdn %>/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/<%= @use_fqdn %>/privkey.pem;
ssl_session_timeout 5m;
diff --git a/templates/site.erb b/templates/site.erb
index 93b66b8..9c575cb 100644
--- a/templates/site.erb
+++ b/templates/site.erb
@@ -1,9 +1,9 @@
server {
listen 80;
- server_name *.<%= @name %> <%= @name %>;
+ server_name *.<%= @use_fqdn %> <%= @use_fqdn %>;
location /.well-known/acme-challenge {
- root /var/spool/certbot/<%= @name %>;
+ root /var/spool/certbot/<%= @use_fqdn %>;
}
location / {