Skip to content

Hiera Support #45

Closed
Closed
@ruedigerblock

Description

@ruedigerblock

Hi,
I plan to use hiera for class assosiation in the future. Hiera does not allow calls to puppet defines, but it can be used with the create_resource function.
What I did to make it work is to create a manifest in your network module on my puppetmaster and include this is the nodes hiera file. What it does is simply to ask hiera for a hash containing data about interfaces and realizes them.

class network::hiera {
$resources = ['network::bridge::static', 'network::if::bridge']
define resource() {
$interfaces = hiera_hash($title,false)
if $interfaces {
create_resources($title,$interfaces)
}
}
network::hiera::resource {$resources:}
}

A hiera yaml file looks like this:

network::bridge::static: { "br0": { ensure: "up", ipaddress: "XXX.XXX.XXX.XXX", netmask: "255.255.255.128", stp: true, delay: "0", bridging_opts: "priority=65535" }}
network::if::bridge: { "em1": { ensure: "up", bridge: "br0" }}

I will include the remaining resources in the array and then one should be able to make use of your network module with hiera. At least I will.

regards,
Rüdiger Block

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions