Simplify ssh_authorized_key
This commit is contained in:
parent
cbfa047a71
commit
feeb9400e5
1 changed files with 27 additions and 34 deletions
|
@ -48,45 +48,38 @@ define sshd::ssh_authorized_key(
|
||||||
# nothing a user can't already do by writing their own file resources,
|
# nothing a user can't already do by writing their own file resources,
|
||||||
# we still depend on the filesystem permissions to keep things safe.
|
# we still depend on the filesystem permissions to keep things safe.
|
||||||
if $override_builtin {
|
if $override_builtin {
|
||||||
case $options {
|
$header = "# HEADER: This file is managed by Puppet.\n"
|
||||||
'absent': {
|
|
||||||
info("not setting any option for ssh_authorized_key: ${name}")
|
|
||||||
$header = "# HEADER: This file is managed by Puppet.\n"
|
|
||||||
|
|
||||||
file { $real_target:
|
if $options == 'absent' {
|
||||||
ensure => $ensure,
|
info("not setting any option for ssh_authorized_key: ${name}")
|
||||||
content => "${header}${type} ${key}",
|
$content = "${header}${type} ${key}"
|
||||||
owner => $real_user,
|
} else {
|
||||||
mode => '0600';
|
$content = "${header}${options} ${type} ${key}"
|
||||||
}
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
file { $real_target:
|
|
||||||
ensure => $ensure,
|
|
||||||
content => "${header}${options} ${type} ${key}",
|
|
||||||
owner => $real_user,
|
|
||||||
mode => '0600';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file { $real_target:
|
||||||
|
ensure => $ensure,
|
||||||
|
content => $content,
|
||||||
|
owner => $real_user,
|
||||||
|
mode => '0600',
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ssh_authorized_key{$name:
|
|
||||||
ensure => $ensure,
|
if $options == 'absent' {
|
||||||
type => $type,
|
info("not setting any option for ssh_authorized_key: ${name}")
|
||||||
key => $key,
|
} else {
|
||||||
user => $real_user,
|
$real_options = $options
|
||||||
target => $real_target,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case $options {
|
ssh_authorized_key{$name:
|
||||||
'absent': {
|
ensure => $ensure,
|
||||||
info("not setting any option for ssh_authorized_key: ${name}")
|
type => $type,
|
||||||
}
|
key => $key,
|
||||||
default: {
|
user => $real_user,
|
||||||
Ssh_authorized_key[$name]{
|
target => $real_target,
|
||||||
options => $options,
|
options => $real_options,
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue