summaryrefslogtreecommitdiff
path: root/manifests/key.pp
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2012-11-22 15:44:48 -0500
committerMicah Anderson <micah@riseup.net>2012-11-22 15:44:48 -0500
commitc45e3f01141f9740030fa1d5670e7037c86c4b5e (patch)
tree4af2f318298baba01f524ef4166ccfb787f41ec9 /manifests/key.pp
parent932d98c71576cf64d14760f2dd7b275056d5de0c (diff)
add more flexible source/content options
this makes it so you can do one of a few things: 1. pass no $content, or $source and the default will be taken (search path checking first for site_x509/{CAs,keys,certs}/$::fqdn/${name}.crt, secondly for site_x509/{CAs,keys,certs}/${name}.crt 2. pass $content, allowing you to specify templates etc. 3. pass $source, allowing you to specify any source you wish
Diffstat (limited to 'manifests/key.pp')
-rw-r--r--manifests/key.pp24
1 files changed, 22 insertions, 2 deletions
diff --git a/manifests/key.pp b/manifests/key.pp
index f083a02..999b767 100644
--- a/manifests/key.pp
+++ b/manifests/key.pp
@@ -1,5 +1,6 @@
define x509::key (
- $source = "puppet:///modules/site_x509/files/keys/${name}.key"
+ $content = 'absent',
+ $source = 'absent'
) {
include x509::variables
include x509::base
@@ -8,7 +9,26 @@ define x509::key (
ensure => file,
mode => '0600',
group => 'ssl-cert',
- source => $source,
require => Package['openssl']
}
+
+ case $content {
+ 'absent': {
+ $real_source = $source ? {
+ 'absent' => [
+ "puppet:///modules/site_x509/keys/${::fqdn}/${name}.key",
+ "puppet:///modules/site_x509/keys/${name}.key"
+ ],
+ default => "puppet:///$source",
+ }
+ File["${x509::variables::keys}/${name}.key"] {
+ source => $real_source
+ }
+ }
+ default: {
+ File["${x509::variables::keys}/${name}.key"] {
+ source => $content
+ }
+ }
+ }
}