On Monday, February 13, 2017 at 10:51:42 AM UTC-6, puppetstan wrote:
>
> thanks for your answer
>
> But with this conf, my package package-5.0.el6.noarch.rpm is automatically 
> downloaded even if my package version is 5.0. So it's my problem. I don't 
> want downloaded package package-5.0.el6.noarch.rpm if my version package is 
> 5.0...
>
> file { "/tmp/package-5.0.el6.noarch.rpm":
> #        ensure => 'present',
>        source => "puppet:///modules/puppet/package-5.0.el6.noarch.rpm"
>       }
>
>
> package { "package":
>         ensure => '5.0',
>         provider => 'rpm',
>         source => "/tmp/package-5.0.el6.noarch.rpm",
>         require => File["/tmp/package-5.0.el6.noarch.rpm"]
>         }
>
>

I strongly recommend creating a local repository for your RPMs, and using 
yum to manage packages (under Puppet direction).  The job you propose to 
have Puppet do is among yum's core behaviors.

If you insist on doing it manually, however, then you have two main choices:

   1. Accept that Puppet will maintain copies of your RPMs on each 
   machine.  Give it a place to put them where they will be persistent (i.e. 
   some place other than /tmp) -- Puppet will not download your RPMs again if 
   they are already there.
   2. Create one or more custom facts by which to convey to Puppet whether 
   the RPM(s) of interest are already installed and at the desired version.  
   Your manifests can then declare both the File resource and the Package 
   resource conditionally, based on the value of the fact.

Option (2) seems to be what you're asking for, but it is the messiest and 
most fragile alternative of all those available to you.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/61b9cbb1-63af-4a9a-b536-5b72ab95cb33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to