Hi,
You can use in your main manifest something like this:
hiera_include('classes', '')
This will load classes from hiera. Parameters for those classes can be
set from hiera also:
"myfirewall::block_iptables": true
Best regards,
Cristian Falcas
On Fri, Dec 5, 2014 at 2:55 PM, Andy Taylor <[email protected]> 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/7ad3abab-32f7-42b5-9d00-01c0e8db5424%40googlegroups.com.
>
> For more options, visit 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/CAMo7R_cLQVRT63a8yDjVxRvJ-C_vxVJ1X%2B1Ce6kCgL4mEN%3D1Sw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.