2024-02-06 21:40:19 +01:00
|
|
|
define kandra::ssh_authorized_keys(
|
2024-01-31 19:25:39 +01:00
|
|
|
$keys = true,
|
|
|
|
) {
|
|
|
|
$user = $name
|
|
|
|
if $keys == true {
|
|
|
|
$keypath = "prod/ssh/authorized_keys/${user}"
|
2024-02-02 17:05:40 +01:00
|
|
|
} elsif $keys.is_a(Array) {
|
|
|
|
$keypath = join($keys.map |$k| {"prod/ssh/authorized_keys/${k}"}, ' ')
|
2024-01-31 19:25:39 +01:00
|
|
|
} else {
|
|
|
|
$keypath = "prod/ssh/authorized_keys/${keys}"
|
|
|
|
}
|
|
|
|
exec { "ssh_authorized_keys ${user}":
|
|
|
|
require => File['/usr/local/bin/install-ssh-authorized-keys'],
|
|
|
|
command => "/usr/local/bin/install-ssh-authorized-keys ${user} ${keypath}",
|
2024-02-02 17:03:27 +01:00
|
|
|
unless => "[ -f /usr/local/bin/install-ssh-authorized-keys ] && /usr/local/bin/install-ssh-authorized-keys --check ${user} ${keypath}",
|
2024-01-31 19:25:39 +01:00
|
|
|
}
|
|
|
|
}
|