]> gitweb.fluxo.info Git - puppet-sshd.git/commitdiff
[feat] Optinally disable exported resources
authorvarac <varacanero@zeromail.org>
Mon, 9 Nov 2015 09:22:58 +0000 (10:22 +0100)
committervarac <varacanero@zeromail.org>
Mon, 9 Nov 2015 09:22:58 +0000 (10:22 +0100)
If run masterless, we cannot export resources, so
we move them to an own class. Including it can be
disabled by passing "use_storedconfig" to the sshd
class.

manifests/base.pp
manifests/init.pp
manifests/sshkey.pp [new file with mode: 0644]

index 6dddedfe0ec6883a8437074fccf1c9257004c79d..abd4fb88f797f9692a4af0ad1ad3d5f845ab5f1b 100644 (file)
@@ -25,21 +25,9 @@ class sshd::base {
   case $::sshrsakey {
     '': { info("no sshrsakey on ${::fqdn}") }
     default: {
-      @@sshkey{$::fqdn:
-        ensure => present,
-        tag    => 'fqdn',
-        type   => ssh-rsa,
-        key    => $::sshrsakey,
-      }
-      # In case the node has uses a shared network address,
-      # we don't define a sshkey resource using an IP address
-      if $sshd::shared_ip == 'no' {
-        @@sshkey{$sshd::sshkey_ipaddress:
-          ensure => present,
-          tag    => 'ipaddress',
-          type   => ssh-rsa,
-          key    => $::sshrsakey,
-        }
+      # only export sshkey when storedconfigs is enabled
+      if $::sshd::use_storedconfigs {
+        include ::ssh::sshkey
       }
     }
   }
index 2dfc71c0aac4481baca0e05673e5578f819461a1..b4157418296e9d15b47e219c5f2ca48d05ee36aa 100644 (file)
@@ -52,7 +52,8 @@ class sshd(
   $hostkey_type = versioncmp($::ssh_version, '6.5') ? {
     /(^1|0)/ => [ 'rsa', 'ed25519' ],
     /-1/    => [ 'rsa', 'dsa' ]
-  }
+  },
+  $use_storedconfigs = true
 ) {
 
   validate_bool($manage_shorewall)
diff --git a/manifests/sshkey.pp b/manifests/sshkey.pp
new file mode 100644 (file)
index 0000000..df37a66
--- /dev/null
@@ -0,0 +1,21 @@
+# deploys the
+class sshd::sshkey {
+
+  @@sshkey{$::fqdn:
+    ensure => present,
+    tag    => 'fqdn',
+    type   => 'ssh-rsa',
+    key    => $::sshrsakey,
+  }
+
+  # In case the node has uses a shared network address,
+  # we don't define a sshkey resource using an IP address
+  if $sshd::shared_ip == 'no' {
+    @@sshkey{$::sshd::sshkey_ipaddress:
+      ensure => present,
+      tag    => 'ipaddress',
+      type   => 'ssh-rsa',
+      key    => $::sshrsakey,
+    }
+  }
+}