Dec 14 09:08:18 sdc01ppt01 puppetmasterd[23453]: Compiled catalog for vdc01xmpp01.idc.logitech.com in 0.17 seconds
Dec 14 09:09:03 sdc01ppt01 puppetmasterd[23453]: (Scope(Auth::Key[joe])) add joe.pub to /home/joe/.ssh/authorized_keys
Dec 14 09:09:03 sdc01ppt01 puppetmasterd[23453]: (Scope(Auth::Key[joe])) line = [gibberish.key.content ]
Dec 14 09:09:03 sdc01ppt01 puppetmasterd[23453]: (Scope(Auth::Key[bob])) add bob.pub to /home/bob/.ssh/authorized_keys
Dec 14 09:09:03 sdc01ppt01 puppetmasterd[23453]: (Scope(Auth::Key[bob])) line = [gibberish.key.content ]
Dec 14 09:09:03 sdc01ppt01 puppetmasterd[23453]: Compiled catalog for vdc01xmpp02.idc.logitech.com in 0.14 seconds
$idcadmin_user_keys = [ "bob", "joe" ]
auth::key { $idcadmin_user_keys: ensure => append }
debug: Format s not supported for Puppet::Resource::Catalog; has not implemented method 'from_s'
err: Could not retrieve catalog from remote server: Could not intern from pson: Could not convert from pson: Could not find relationship target ''
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
$line = file("/etc/puppet/files/idcadmin/auth/keys/$name.pub")
notice("add $name.pub to /home/$name/.ssh/authorized_keys")
notice("line = [$line]")
line { "add $name.pub to /home/$name/.ssh/authorized_keys":
line => $line,
ensure => absent,
require => File["/home/$name/.ssh"],
file => "/home/$name/.ssh/authorized_keys";
}
define line( $file, $line, $ensure = 'present') {
case $ensure {
default : { err ( "unknown ensure value '${ensure}'" ) }
present: {
exec { "echo ${line} to ${file}":
command => "echo '${line}' >> '${file}'",
unless => "grep -qFx '${line}' '${file}'",
}
}
absent: {
exec { "remove the ${line} from ${file}":
command => "perl -ni -e 'print if \$_ ne \"${line}\n\";' '${file}'",
onlyif => "grep -qFx '${line}' '${file}'"
}
}
}
}