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? All I could find in the googlesphere was how to create directories (and keep them clean) with puppet but not how to destroy them. Perhaps this would be TOO destructive a power for puppet to wield? Thanks Tim -- 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/-/ffzGcfykLHIJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Sat, Nov 24, 2012 at 8:28 AM, bluethundr <dunphymlb@gmail.com> wrote:> Is there a way using puppet to delete the home directories recursively of > employees who have left the company?Are your users managed by Puppet? If so, perhaps check out `managehome` of the user type. http://docs.puppetlabs.com/references/latest/type.html#user . Depending on the capabilities of the provider for your system, setting `managehome => true` will create/remove user home directories.> > 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? All I > could find in the googlesphere was how to create directories (and keep them > clean) with puppet but not how to destroy them. Perhaps this would be TOO > destructive a power for puppet to wield? > > Thanks > Tim > > -- > 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/-/ffzGcfykLHIJ. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Eduardo A Muñoz
2012-Nov-26 18:51 UTC
Re: [Puppet Users] Re: delete home directory rescurively
tidy puppet type works recursively too. On Mon, Nov 26, 2012 at 2:19 PM, jcbollinger <John.Bollinger@stjude.org>wrote:> > > 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+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- Eduardo A. Muñoz GPG Key fingerprint = 175E 6AEB AD23 8EFE 0FC3 F558 9AB1 7885 40A4 ABBB CCNA - CCNP -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.