Matthew Macdonald-Wallace
2010-May-03 06:23 UTC
[Puppet Users] Checking for files on the client?
Hi all, I''m looking for a way to run an exec statement if a file does not exist on the server is this possible? Example code: =================== define yumrepo(srcpkg = "",name = "") if(!exists("/etc/yum.repos.d/${name}.repo")) { if($srcpkg != "") { exec{"rpm -Uh ${srcpkg}"}, } } else { file { ''/etc/yum.repos.d/${name}.repo'': source => "puppet:///modules/yumrepos/${name}.repo", } } ================= The idea is that if a repo is requested but the appropriate file does not exist it is installed from the repo''s RPM (where possible) otherwise a file is pushed from the puppetmaster. What I want to avoid is the repo RPM being installed at every puppet run whilst also avoiding the need to push GPG keys (some of which are only available via the repo''s RPM as far as I can tell...) If someone could give me some pointers, that would be great! Thanks in advance, Matt -- 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.
Matthew Macdonald-Wallace
2010-May-03 17:00 UTC
Re: [Puppet Users] Checking for files on the client?
On Mon, 2010-05-03 at 07:23 +0100, Matthew Macdonald-Wallace wrote:> Hi all, > > I''m looking for a way to run an exec statement if a file does not exist > on the server is this possible?I''ve been thinking about this some more as I''ve been developing this module for easy install of RPM repos. Would it work if I pushed out a custom fact with the repo that I then called in the manifest? Example (pseudo-code!): =============if(!fact->$repoName){ install repo from rpm } else { check repo config against file } =========== I''m not convinced that this fixes everything but I think it might do the trick. Thoughts? M. -- 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.