aboutsummaryrefslogtreecommitdiff
path: root/manifests/import_key.pp
blob: ba965ce985fc007a8f7d647758c5ec42dc4b4302 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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"
  }
}