On Saturday, November 24, 2012 10:28:44 AM UTC-6, bluethundr wrote:
>
> Is there a way using puppet to delete the home directories recursively of 
> employees who have left the company? 
>
> So far I've tried:
>
>    file { "/export/home/user":
>         name => "$home_dir/user",
>         ensure => 'absent'
>       }
>
> I also tried
>
>  
>
> file{'export/home/user':
>   name => "$home_dir/user",
>   purge => true,
>   recurse => true,
>   force => true,
>   backup => false,
> }
>
> But neither worked. Is there a way to do this with puppet currently?
>
>

If you don't want to or can't do this via User resources, then it ought to 
work to add "ensure => absent" in your second version.

Alternatively, you can always resort to

exec { "Remove ${user}'s Home":
  command => "/bin/rm -rf ${home_dir}/${user}",
  onlyif => "/usr/bin/test -e ${home_dir}/${user}"
}


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/dDIVaCy8uOQJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to