I found that a single "apt-get update" exec before any packages were managed was useful enough. Out of interest, what is the use case that needs "apt-get update" before every package is installed?
Lately here the "yum upgrade" is a daily thing with some incremental canarying as the month goes on, but same general concept. If you were using puppet to install apt repositories before packages, you could use some chained collectors to make sure you got the apt-get update after your repositories were installed, but before any packages were installed. To wit: file { '/etc/apt/sources.list.d/myrepo.repo': content => "deb etc. etc.\n", tag => 'apt', } package { 'mypackage': } exec { '/usr/bin/apt-get -y update': refreshonly => true, } File <| tag == 'apt' |> ~> Exec['/usr/bin/apt-get -y update'] Exec['/usr/bin/apt-get -y update'] -> Package <| |> (Of course the file resource could have a notify instead of a tag in this case.) We are doing something broadly similar with yum for the last several years with no complaints. One trade-off is that all repositories are declared through resources rather than shipped with packages but that also means we have a single list of all our repos currently in use. On Tue, Dec 05, 2017 at 05:32:21AM -0800, Kristian Rink wrote: > Folks; > using puppet with the apt module, I am looking for a way to do > - an apt-get update && apt-get dist-upgrade *once* on each puppet agent > run, and > - an apt-get update before each package to be installed. > Right now I am playing with various exec[] approaches but none seems > really to do what I want. > Is there any "best" way to do this? > TIA and all the best, > Kristian > > -- > 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]puppet-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > > [2]https://groups.google.com/d/msgid/puppet-users/31e6de73-5a60-43f1-9ead-c642bb5ade58%40googlegroups.com. > For more options, visit [3]https://groups.google.com/d/optout. > > References > > Visible links > 1. mailto:puppet-users+unsubscr...@googlegroups.com > 2. > https://groups.google.com/d/msgid/puppet-users/31e6de73-5a60-43f1-9ead-c642bb5ade58%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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/20171205143356.nrq3t2rr375sz6xb%40iniquitous.heresiarch.ca. For more options, visit https://groups.google.com/d/optout.