hiera behaviour

45 views
Skip to first unread message

Alexander Dacre

unread,
Aug 5, 2015, 5:51:24 AM8/5/15
to Puppet Users
Hi,

I'm updating an existing Puppet module so that I can use it with Hiera.

The node yaml files contains the following

selinux::mode: 'enforcing'
selinux::booleans:
  'httpd_can_network_connect':
    ensure: true
  'httpd_setrlimit':
    ensure: true

I can get the lookup to work using the following class:

class selinux (
  $mode = $::selinux::params::mode,

  ### START Hiera Lookups ###
  $selinux_booleans = {}
  ### END Hiera Lookups ###
) inherits selinux::params {

  class { 'selinux::package': } ->
  class { 'selinux::config': }

  $booleans = hiera('selinux::booleans')
  create_resources('selinux::boolean', $booleans)
}

But it doesn't work with the one below (which is the format I've seen used elsewhere):

class selinux (
  $mode = $::selinux::params::mode,

  ### START Hiera Lookups ###
  $selinux_booleans = {}
  ### END Hiera Lookups ###
) inherits selinux::params {

  class { 'selinux::package': } ->
  class { 'selinux::config': }

  create_resources('selinux::boolean', $selinux_booleans)
}

Please could somebody let me know why the latter of the two doesn't work?

Thanks,
A

R.I.Pienaar

unread,
Aug 5, 2015, 5:54:45 AM8/5/15
to puppet-users


----- Original Message -----
> From: "Alexander Dacre" <al...@alexdacre.co.uk>
> To: "puppet-users" <puppet...@googlegroups.com>
> Sent: Wednesday, August 5, 2015 10:51:24 AM
> Subject: [Puppet Users] hiera behaviour

> Hi,
>
> I'm updating an existing Puppet module so that I can use it with Hiera.
>
> The node yaml files contains the following
>
> selinux::mode: 'enforcing'
> selinux::booleans:
> 'httpd_can_network_connect':
> ensure: true
> 'httpd_setrlimit':
> ensure: true

note the key here "selinux::booleans", this maps to:

class selinux($booleans) { ... }

> class selinux (
> $mode = $::selinux::params::mode,
>
> ### START Hiera Lookups ###
> $selinux_booleans = {}
> ### END Hiera Lookups ###
> ) inherits selinux::params {
>
> class { 'selinux::package': } ->
> class { 'selinux::config': }
>
> create_resources('selinux::boolean', $selinux_booleans)
> }

so yours have selinux($selinux_booleans) which is a different key.

Alexander Dacre

unread,
Aug 5, 2015, 6:02:03 AM8/5/15
to Puppet Users
Ahhhh, that makes sense.

Thank you!
Reply all
Reply to author
Forward
0 new messages