summaryrefslogtreecommitdiff
path: root/manifests/key.pp
blob: b36bf3566cd317a3e58786b48b7895d97457505d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# @summary A single dns key (for zone updates and the like)
# 
# TODO add stuff to autogenerate these, and instead dump them to individual files.
#
# @param algorithm
#   Algorithm used, must match secret
# @param secret
#   Secret hash, must match algorithm
# @param keyname
#   Name of key
# @param ensure
#   Allows for manual removal of the key. Note that if
#   $dns::purge_keyconf is true then simply removing the
#   dns::key resource removes the file.
define dns::key (
  String $algorithm,
  Variant[String, Sensitive[String]] $secret,
  String $keyname = $name,
  Enum['present', 'absent'] $ensure = 'present',
) {
  file { "${dns::keyconf_dir}/${keyname}.conf":
    ensure  => $ensure,
    content => epp("${module_name}/key.epp", {
        keyname   => $keyname,
        algorithm => $algorithm,
        secret    => $secret,
    }),
  }
}