aboutsummaryrefslogtreecommitdiff
path: root/manifests/ssh_authorized_key.pp
blob: 2d528da16ab19b6e70a2468d071c881fcfa13bba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# wrapper to have some defaults.
define sshd::ssh_authorized_key(
    $type = 'ssh-dss',
    $key,
    $user = 'root',
    $target = 'absent',
    $options = 'absent'
){

    case $target {
        'absent': {
            case $user {
                'root': { $real_target = '/root/.ssh/authorized_keys' }
                default: { $real_target = "/home/${user}/.ssh/authorized_keys" }
            }
        }
        default: {
            $real_target = $target
        }
    }
    ssh_authorized_key{$name:
        type => $type,
        key => $key,
        user => $user,
        target => $real_target,
    }

    case $options {
        'absent': { info("not setting any option for ssh_authorized_key: $name") }
        default: {
            Ssh_authorized_key[$name]{
                options => $options,
            }
        }
    }
}