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].
> 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]
> 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/20160606154239.GA8861%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.