-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
322 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
--- | ||
caddy::caddy_shell: '/usr/sbin/nologin' | ||
|
||
caddy::repo_settings: | ||
location: https://dl.cloudsmith.io/public/caddy/stable/deb/debian | ||
release: any-version | ||
repos: main | ||
key: | ||
name: caddy-archive-keyring.asc | ||
source: https://dl.cloudsmith.io/public/caddy/stable/gpg.key | ||
checksum_value: 5791c2fb6b6e82feb5a69834dd2131f4bcc30af0faec37783b2dc1c5c224a82a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
caddy::repo_settings: | ||
copr_repo: '@caddy/caddy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# @summary | ||
# This class handles Caddy installation from a package repository | ||
# | ||
# @api private | ||
# | ||
class caddy::install::repo { | ||
assert_private() | ||
|
||
if $caddy::manage_repo and $caddy::repo_settings.length == 0 { | ||
fail("'repo_settings' parameter should be set when 'manage_repo' is true") | ||
} | ||
|
||
# Inject `before` into the repository settings | ||
$repo = $caddy::repo_settings + { | ||
before => Package[$caddy::package_name], | ||
} | ||
|
||
case $facts['os']['family'] { | ||
'Debian': { | ||
include apt | ||
|
||
if $caddy::manage_repo { | ||
# Use this when issues below are resolved | ||
# apt::source { 'caddy': | ||
# * => $repo, | ||
# } | ||
|
||
# Below is a temporary workaround until | ||
# https://github.com/puppetlabs/puppetlabs-apt/issues/1196 is resolved. | ||
# dl.cloudsmith.io returns no headers Puppet can use to check if file | ||
# is changed. | ||
# Etag header is not supported, but discussed here: | ||
# https://github.com/puppetlabs/puppet/issues/9319 | ||
# Checksum is not supported by apt::source's key nor by apt::keyring | ||
# resource. See https://github.com/puppetlabs/puppetlabs-apt/pull/1199 | ||
|
||
if $repo.get('key.source') { | ||
$keyring_path = "/etc/apt/keyrings/${$repo.get('key.name')}" | ||
|
||
file { '/etc/apt/keyrings': ensure => 'directory' } | ||
|
||
file { $keyring_path: | ||
ensure => 'file', | ||
source => $repo.get('key.source'), | ||
checksum => $repo.get('key.checksum', 'sha256'), | ||
checksum_value => $repo.get('key.checksum_value'), | ||
before => Apt::Source['caddy'], | ||
} | ||
} else { | ||
$keyring_path = undef | ||
} | ||
|
||
# Drop 'key' from repo settings for now. Also, add `keyring` | ||
apt::source { 'caddy': | ||
* => $repo - 'key' + { 'keyring' => $keyring_path }, | ||
} | ||
} | ||
} | ||
'RedHat': { | ||
include yum | ||
|
||
if $caddy::manage_repo { | ||
yum::copr { 'caddy': | ||
* => $repo, | ||
} | ||
} | ||
} | ||
default: { | ||
fail("OS family ${facts['os']['family']} has no support for 'repo' install method") | ||
} | ||
} | ||
|
||
package { $caddy::package_name: | ||
ensure => $caddy::package_ensure.lest || { 'installed' }, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.