aboutsummaryrefslogtreecommitdiff
path: root/manifests/import_key.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/import_key.pp')
-rw-r--r--manifests/import_key.pp20
1 files changed, 20 insertions, 0 deletions
diff --git a/manifests/import_key.pp b/manifests/import_key.pp
new file mode 100644
index 0000000..ba965ce
--- /dev/null
+++ b/manifests/import_key.pp
@@ -0,0 +1,20 @@
+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"
+ }
+}