Since it's such a core component, I have added the type you suggested to my 
site.pp manifest and it works just fine.  Is there a better place for it?

Thanks for your help!

On Friday, December 5, 2014 7:55:46 AM UTC-5, Andy Taylor wrote:
>
> Hiera is just a source of data - you need to have Puppet manifests/modules 
> which interpet the data and act on it. 
>
> You can achieve installation of packages from Hiera data by using defined 
> types and the create_resources function:
>
> https://docs.puppetlabs.com/learning/definedtypes.html
> https://docs.puppetlabs.com/references/latest/function.html#createresources
>
> Basically you need to create a defined type which includes a package 
> resource. Once you've done that you can use the create_resources function 
> to pass the Hiera data to the defined type and install the packages. 
>
> The defined type would look something like this:
>
> define hiera::packages ( $ensure ) {
>
>   package { $title:
>     ensure => $ensure
>   }
>
> }
>
> and then the create_resources call would look like this:
>
> $packages = hiera('packages')
>
> create_resources(hiera::packages, $packages)
>
> Hope that helps,
>
> Andy
>
> On Thursday, 4 December 2014 21:00:34 UTC, Brantley Hobbs wrote:
>>
>> Hi all!
>>
>> I'm very new to puppet.  I have installed a puppet master which 
>> successfully sets the IP address and manages sudo on a couple of nodes.
>>
>> I'm using Puppet 3.7 with Hiera, and so far I haven't had to write any 
>> manifest files, apart from the one that pulls in Hiera.  As far as I can 
>> tell, this is a best practice.
>>
>> Now I would like to manage packages on my agents.  I assume that in the 
>> node specific Hiera file, I should be able do something like the following:
>>
>> packages:
>>   apache2:
>>     ensure: installed
>>
>> However, nothing gets installed.  I know I'm taking too simplistic of an 
>> approach, but I'm not sure where to start digging.  Most things I've found 
>> say that I need a "wrapper class" to read in the Hiera data and install the 
>> packages.  Is there no way to install packages purely from hiera?  I've 
>> found some modules that propose to do this, but so far I can't get them to 
>> work.  I'd like to do this without additional modules if possible; it seems 
>> like a pretty basic operation.
>>
>> Thanks!
>> Brantley Hobbs
>>
>

-- 
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/10043ef4-c808-4908-b156-4b8569592598%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to