Skip to content

Commit

Permalink
Split out letsencrypt for web
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Sep 17, 2024
1 parent 0a2b93c commit 3ffae01
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
3 changes: 2 additions & 1 deletion puppet/modules/profiles/manifests/repo/rpm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
Boolean $https = true,
) {
class { 'web':
https => $https,
https => $https,
all_in_one => false,
}
contain web

Expand Down
20 changes: 20 additions & 0 deletions puppet/modules/web/manifests/certs.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# @summary Define letsencrypt certificate
#
# domain / webroot_paths must match exactly
#
# @param domains
# Domains to be handled by the certificate
# @param paths
# Vhost paths for each domain
define web::certs(
Array[String] $domains,
Array[String] $paths,
) {
$letsencypt_domain = 'theforeman.org'

letsencrypt::certonly { $letsencypt_domain:
plugin => 'webroot',
domains => $domains,
webroot_paths => $paths,
}
}
12 changes: 6 additions & 6 deletions puppet/modules/web/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
# start httpd, the certs have to exist, so keep SSL vhosts disabled until the
# certs are present via the HTTP vhost and only then enable the SSL vhosts.
#
# @param all_in_one
# Used when deploying all vhosts to the same machine.
#
class web(
Boolean $https = false,
Boolean $all_in_one = true,
) {
class { 'web::base':
letsencrypt => $https,
}

if $https {
$letsencypt_domain = 'theforeman.org'

letsencrypt::certonly { $letsencypt_domain:
plugin => 'webroot',
# domain / webroot_paths must match exactly
if $https and $all_in_one {
web::certs { 'web':
domains => [
'theforeman.org',
'archivedeb.theforeman.org',
Expand Down
17 changes: 17 additions & 0 deletions puppet/modules/web/manifests/vhost/rpm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@
script_content => epp('web/deploy-rpmrepo.sh.epp', $deploy_rpmrepo_context),
}

if $web::https {
web::certs { 'rpm':
domains => [
'yum.theforeman.org',
'stagingyum.theforeman.org',
'rpm.theforeman.org',
'stagingrpm.theforeman.org',
],
webroot_paths => [
'/var/www/vhosts/yum/htdocs',
'/var/www/vhosts/stagingyum/htdocs',
'/var/www/vhosts/rpm/htdocs',
'/var/www/vhosts/stagingrpm/htdocs',
],
}
}

include apache::mod::expires
include apache::mod::dir
include apache::mod::autoindex
Expand Down

0 comments on commit 3ffae01

Please sign in to comment.