aboutsummaryrefslogtreecommitdiff
path: root/manifests/import_key.pp
diff options
context:
space:
mode:
authorAntoine Beaupré <anarcat@koumbit.org>2013-10-16 15:06:00 -0400
committerAntoine Beaupré <anarcat@koumbit.org>2013-10-16 15:06:00 -0400
commit7218eb738f4d4cbcade57cdf72c7cd6c878cd60e (patch)
tree498abe5e6b8cab2c31156b9edac08c40533afd20 /manifests/import_key.pp
parent5ac51aa1072c59e7998602a8466cd9bbc2aa8cef (diff)
downloadpuppet-monkeysphere-7218eb738f4d4cbcade57cdf72c7cd6c878cd60e.tar.gz
puppet-monkeysphere-7218eb738f4d4cbcade57cdf72c7cd6c878cd60e.tar.bz2
split into separate file according to autoloading rules
Diffstat (limited to 'manifests/import_key.pp')
-rw-r--r--manifests/import_key.pp16
1 files changed, 16 insertions, 0 deletions
diff --git a/manifests/import_key.pp b/manifests/import_key.pp
new file mode 100644
index 0000000..ec00fee
--- /dev/null
+++ b/manifests/import_key.pp
@@ -0,0 +1,16 @@
+define monkeysphere::import_key ( $scheme = 'ssh://', $port = '', $path = '/etc/ssh/ssh_host_rsa_key', $hostname = $fqdn ) {
+
+ # if we're getting a port number, prefix with a colon so it's valid
+ $prefixed_port = $port ? {
+ '' => '',
+ default => ":$port"
+ }
+
+ $key = "${scheme}${fqdn}${prefixed_port}"
+
+ exec { "monkeysphere-host import-key $path $key":
+ alias => "monkeysphere-import-key",
+ require => [ Package["monkeysphere"], File["monkeysphere_host_conf"] ],
+ unless => "/usr/sbin/monkeysphere-host s | grep $key > /dev/null"
+ }
+}