This is what we used to do, but I'm trying to get away from that for two 
reasons. Firstly, to my mind it kinda goes against how Puppet is supposed 
to work, and secondly we use Puppetboard for monitoring and an apt-get 
update is recorded as a change meaning that every run results in a change 
even if nothing else has been applied. I'm not concerned about stressing 
our mirrors as they're meaty boxes, but removing the need to do it every 
time will also speed up the runs.

On Monday, June 6, 2016 at 4:42:46 PM UTC+1, Christopher Wood wrote:
>
> Back when I was doing this on Debian/Ubuntu I ended up doing the apt-get 
> update on every agent run. This didn't stress the apt proxy (far from it) 
> and made sure the agent had an up to date view of apt every time no matter 
> what. 
>
> This would also cover if somebody uses ensure=>latest or ensure=>1.2.3.4 
> somewhere in the catalog. 
>
> On Mon, Jun 06, 2016 at 07:46:47AM -0700, Simon Weald wrote: 
> >    Hi everyone 
> > 
> >    I've got a little bit of an issue which I'm currently fighting with. 
> At 
> >    the moment, we pass an array of packages to be installed to the 
> package 
> >    resource, however I need to call an apt-get update prior to the 
> package 
> >    installation (in case we add a new repo etc). My snippet below should 
> >    probably give you a good idea of what I want to achieve: 
> > 
> >    $installpackages  = hiera_array('installed-packages') 
> >      
> >    exec  {  "apt-update": 
> >     command  =>  "/usr/bin/apt-get update", 
> >     refreshonly  =>  true, 
> >    } 
> >      
> >    package  {  $installpackages: 
> >     ensure  =>  'present', 
> >     require  =>  Exec['apt-update'], 
> >    } 
> >    Obviously my goal is to have the update only run if any packages are 
> >    actually going to be installed - I can't use empty() against the 
> array as 
> >    it will always contain content. 
> > 
> >    Can anyone suggest how I can achieve this? 
> > 
> >    Thanks! 
> > 
> >    -- 
> >    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 [1][email protected] <javascript:>. 
> >    To view this discussion on the web visit 
> >    [2]
> https://groups.google.com/d/msgid/puppet-users/8c248cca-5174-4406-a145-0634bfcfce9e%40googlegroups.com.
>  
>
> >    For more options, visit [3]https://groups.google.com/d/optout. 
> > 
> > References 
> > 
> >    Visible links 
> >    1. mailto:[email protected] <javascript:> 
> >    2. 
> https://groups.google.com/d/msgid/puppet-users/8c248cca-5174-4406-a145-0634bfcfce9e%40googlegroups.com?utm_medium=email&utm_source=footer
>  
> >    3. https://groups.google.com/d/optout 
>
>

-- 
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/69043b2d-34a9-4886-aee0-2b6655212ba1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to