summaryrefslogtreecommitdiff
path: root/puppet/modules/x509/manifests/key.pp
diff options
context:
space:
mode:
authorMicah <micah@leap.se>2016-07-12 16:46:04 -0400
committerMicah <micah@leap.se>2016-07-12 16:46:04 -0400
commit95d95925e53ec98f3f5868479328a69449de3ca7 (patch)
tree008a31bbdd1967be862e502bdf77c0956d8733b1 /puppet/modules/x509/manifests/key.pp
parentd8ecd5d2f933c40f2413a58e6324558d0e689b6a (diff)
git subrepo clone https://leap.se/git/puppet_x509 puppet/modules/x509
subrepo: subdir: "puppet/modules/x509" merged: "19254a3" upstream: origin: "https://leap.se/git/puppet_x509" branch: "master" commit: "19254a3" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo" commit: "1e79595" Change-Id: Ia024613b147d34a7b4c888818da08152a2fa63dc
Diffstat (limited to 'puppet/modules/x509/manifests/key.pp')
-rw-r--r--puppet/modules/x509/manifests/key.pp37
1 files changed, 37 insertions, 0 deletions
diff --git a/puppet/modules/x509/manifests/key.pp b/puppet/modules/x509/manifests/key.pp
new file mode 100644
index 00000000..fd7e25fd
--- /dev/null
+++ b/puppet/modules/x509/manifests/key.pp
@@ -0,0 +1,37 @@
+define x509::key (
+ $content = 'absent',
+ $source = 'absent',
+ $owner = 'root',
+ $group = 'ssl-cert'
+) {
+ include x509::variables
+ include x509::base
+
+ file { "${x509::variables::keys}/${name}.key":
+ ensure => file,
+ mode => '0640',
+ owner => $owner,
+ group => $group,
+ require => Package['ssl-cert']
+ }
+
+ 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"] {
+ content => $content
+ }
+ }
+ }
+}