|
13 | 13 | # source => 'https://apt.puppetlabs.com/keyring.gpg'
|
14 | 14 | # }
|
15 | 15 | # }
|
| 16 | +# @example Deploy the apt source and associated keyring file with checksum |
| 17 | +# apt::source { 'puppet8-release': |
| 18 | +# location => 'http://apt.puppetlabs.com', |
| 19 | +# repos => 'puppet8', |
| 20 | +# key => { |
| 21 | +# name => 'puppetlabs-keyring.gpg', |
| 22 | +# source => 'https://apt.puppetlabs.com/keyring.gpg' |
| 23 | +# checksum => 'sha256', |
| 24 | +# checksum_value => '9d7a61ab06b18454e9373edec4fc7c87f9a91bacfc891893ba0da37a33069771', |
| 25 | +# } |
| 26 | +# } |
16 | 27 | #
|
17 | 28 | # @param dir
|
18 | 29 | # Path to the directory where the keyring will be stored.
|
|
32 | 43 | # @param ensure
|
33 | 44 | # Ensure presence or absence of the resource.
|
34 | 45 | #
|
| 46 | +# @param checksum |
| 47 | +# Checksum type of the keyfile. |
| 48 | +# Only md5, sha256, sha224, sha384 and sha512 are supported when specifying |
| 49 | +# this parameter. (due to checksum_value parameter). |
| 50 | +# Optional, but is useful if the keyfile is from a remote HTTP source that |
| 51 | +# does not provide the necessary headers for the file resource to determine if |
| 52 | +# content has changed. |
| 53 | +# |
| 54 | +# @param checksum_value |
| 55 | +# The value of the checksum, must be a String. |
| 56 | +# Only md5, sha256, sha224, sha384 and sha512 are supported when specifying |
| 57 | +# this parameter. |
| 58 | +# |
35 | 59 | define apt::keyring (
|
36 |
| - Stdlib::Absolutepath $dir = '/etc/apt/keyrings', |
37 |
| - String[1] $filename = $name, |
38 |
| - Stdlib::Filemode $mode = '0644', |
39 |
| - Optional[Stdlib::Filesource] $source = undef, |
40 |
| - Optional[String[1]] $content = undef, |
41 |
| - Enum['present','absent'] $ensure = 'present', |
| 60 | + Stdlib::Absolutepath $dir = '/etc/apt/keyrings', |
| 61 | + String[1] $filename = $name, |
| 62 | + Stdlib::Filemode $mode = '0644', |
| 63 | + Optional[Stdlib::Filesource] $source = undef, |
| 64 | + Optional[String[1]] $content = undef, |
| 65 | + Enum['present','absent'] $ensure = 'present', |
| 66 | + Optional[Enum['md5','sha256','sha224','sha384','sha512']] $checksum = undef, |
| 67 | + Optional[String] $checksum_value = undef, |
42 | 68 | ) {
|
43 | 69 | ensure_resource('file', $dir, { ensure => 'directory', mode => '0755', })
|
44 | 70 | if $source and $content {
|
|
52 | 78 | case $ensure {
|
53 | 79 | 'present': {
|
54 | 80 | file { $file:
|
55 |
| - ensure => 'file', |
56 |
| - mode => $mode, |
57 |
| - owner => 'root', |
58 |
| - group => 'root', |
59 |
| - source => $source, |
60 |
| - content => $content, |
| 81 | + ensure => 'file', |
| 82 | + mode => $mode, |
| 83 | + owner => 'root', |
| 84 | + group => 'root', |
| 85 | + source => $source, |
| 86 | + content => $content, |
| 87 | + checksum => $checksum, |
| 88 | + checksum_value => $checksum_value, |
61 | 89 | }
|
62 | 90 | }
|
63 | 91 | 'absent': {
|
|
0 commit comments