Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case $ensure {
- present: {
- $key = file("/etc/puppet/files/idcadmin/auth/keys/$sourcekeys.pub")
- line {
- [ $sourcekeys ]:
- line => $key,
- ensure => present,
- require => File["/home/$destuser/.ssh/authorized_keys"],
- file => "/home/$destuser/.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}'"
- }
- }
- }
- }
- $dhg_user_keys = [ "bob", "joe" ]
- auth::key { "add dhg_user_keys to IDC user for remote mgmt":
- ensure => present,
- destuser => "idc",
- sourcekeys => $dhg_user_keys,
- }
- err: Could not retrieve catalog: Could not find any files from /etc/puppet/files/idcadmin/auth/keys/bobjoe.pub at /etc/puppet/modules/auth/manifests/init.pp:94 on node vdc01b01ubuntu01
Add Comment
Please, Sign In to add comment