Re: [Puppet Users] apt-get update before package installations

Gino Lisignoli
Mon, 02 Apr 2012 03:22:35 -0000

This worked perfectly! Thanks!
Reading the documentation again now :)

On 31/03/12 12:26, Denmat wrote:
> Hi Gino,
>
> The good news with a work in progress is that you can start all over
> again ;)
>
> What you are trying to call is a define:
>
> http://docs.puppetlabs.com/learning/definedtypes.html
>
> http://docs.puppetlabs.com/guides/language_guide.html#resource-collections
>
> I would also take a look at this:
> http://docs.puppetlabs.com/puppet/2.7/reference/modules_fundamentals.html
>
> Here''s what I would do now.
>
> 1. Remove the import classes in site.pp
> 2. Make a module called base (or whatever name you want)
>   mkdir -p /etct/puppet/modules/base/manifests
> 3. Create an init.pp file and copy your existing package requirements
> into it.
> 4. In your apt module (modules/apt/manifests) create an init.pp
> This can be like (for now):
> class apt {
> }
> 5. Change your update exec to a class in the file apt_update.pp
> Like so:
> class apt::apt_update {
>  exec { .....}
> }
>
> Now in your base module you would have something like this:
> class base {
>   include apt::apt_update
>   Package [ require => Exec[''apt_update'']
>   ]
>
>   $package_list = [''a'', ''b'']
>
>   package {$package_list: }
> }
>
> Something like that should work - but hopefully you''ll get the
idea.
>  You can still use defines in require statements but the syntax is
> different (see docs).
>
> Cheers,
> Den
> On 30/03/2012, at 12:50, Gino Lisignoli <gino.lisignoli@opus.co.nz
> <mailto:gino.lisignoli@opus.co.nz>> wrote:
>