Hello All, I''m not sure what I''m missing here, but when defining a file resource, to use as my yum repo, I can''t seem to be able to purge other files in the directory. For instance, I just want to have base.repo under /etc/yum.repos.d/, so I''m using: file { "/etc/yum.repos.d/base.repo": owner => root, group => root, mode => 0644, purge => true, recurse => true, force => true, replace => true, content => template("yum/base.repo.erb") } The code creates the file, but fails to purge the rest of the data in that dir. Can anyone see what I''m missing here? Thanks, -- 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.
CraftyTech
2010-Dec-16 15:49 UTC
[Puppet Users] Re: file: ensure => present, purge => true
I''m using puppet 0.25.5 On Dec 16, 10:26 am, CraftyTech <hmmed...@gmail.com> wrote:> Hello All, > > I''m not sure what I''m missing here, but when defining a file > resource, to use as my yum repo, I can''t seem to be able to purge > other files in the directory. For instance, I just want to have > base.repo under /etc/yum.repos.d/, so I''m using: > file { "/etc/yum.repos.d/base.repo": > owner => root, > group => root, > mode => 0644, > purge => true, > recurse => true, > force => true, > replace => true, > content => template("yum/base.repo.erb") > } > The code creates the file, but fails to purge the rest of the data in > that dir. Can anyone see what I''m missing here? > > Thanks,-- 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.
Daniel Pittman
2010-Dec-16 22:26 UTC
Re: [Puppet Users] file: ensure => present, purge => true
On Fri, Dec 17, 2010 at 02:26, CraftyTech <hmmedina@gmail.com> wrote:> I''m not sure what I''m missing here, but when defining a file > resource, to use as my yum repo, I can''t seem to be able to purge > other files in the directory.When you specify recurse and purge to a file resource you need to do that on a *directory*, not a file within the directory. So, in your case you would need to give "/etc/yum.repos.d" as: file { "/etc/yum.repos.d": ensure => directory, recurse => true, purge => true, source => ... } Then you have two choices: First, you can point the source for that statement to a puppet:// URL that is a directory containing, for example, the ''base.repo'' file that you want installed, and nothing else. Puppet will then ensure that is all that ends up in that directory. Second, you can point it to an empty directory, then have extra, separate file statements like the one you did in your question - without the recurse and purge options - that define the individual files. Finally, you can actually combine both of those: if you explicitly manage a file it will override the "default" that the recurse/purge combination create, so you can have a base directory copied in place and everything except what puppet manages automatically removed. Regards, Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- 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.
Ayman Elkazzaz
2010-Dec-20 12:09 UTC
Re: [Puppet Users] Re: file: ensure => present, purge => true
CraftyTech <hmmedina <at> gmail.com> writes:> > I''m using puppet 0.25.5 > > On Dec 16, 10:26 am, CraftyTech <hmmed...@gmail.com> wrote: > > Hello All, > > > > I''m not sure what I''m missing here, but when defining a file > > resource, to use as my yum repo, I can''t seem to be able to purge > > other files in the directory. For instance, I just want to have > > base.repo under /etc/yum.repos.d/, so I''m using: > > file { "/etc/yum.repos.d/base.repo": > > owner => root, > > group => root, > > mode => 0644, > > purge => true, > > recurse => true, > > force => true, > > replace => true, > > content => template("yum/base.repo.erb") > > } > > The code creates the file, but fails to purge the rest of the data in > > that dir. Can anyone see what I''m missing here? > > > > Thanks, >I think you should do the following: 1- Put base.repo on Puppet master file server to be shared then 2- file { "/etc/yum.repos.d": owner => root, group => root, mode => 0644, purge => true, recurse => true, source => "puppet:///location_folder_which_contains_base.repo } It will delete all files other than base.repo -- 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.