Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragments from multiple hiera hierarchies #41

Open
voxter opened this issue May 27, 2014 · 4 comments
Open

Fragments from multiple hiera hierarchies #41

voxter opened this issue May 27, 2014 · 4 comments

Comments

@voxter
Copy link

voxter commented May 27, 2014

I have a couple hierarchies in hiera as follows:

:hierarchy:

  • "nodes/%{::clientcert}"
  • "hostgroup/%{::hostgroup}"
  • "location/%{::hostlocation}"
  • global

When specifying rsyslog fragments in multiple hierarchies, the first match is treated exclusively. I'm sure this is expected behavior due to the hiera syntax, I'm curious if you know of a good way around it without duplicating code?

ie. in global.yaml:

rsyslog::rsyslog_fragments:
5-rate-limits:
content: "$SystemLogRateLimitInterval 0\n$SystemLogRateLimitBurst 0\n"

then in hostgroup/somegroup.yaml:
rsyslog::rsyslog_fragments:
somegroup:
content: ". @@somegroup.logserver"

"somegroup" is retained in /etc/rsyslog.d/ and 5-rate-limits is completely ignored. It would be great to have them combine, if at all possible?

@ghoneycutt
Copy link
Owner

at line 59 of manifests/init.pp change it to look like https://github.com/ghoneycutt/puppet-module-ssh/blob/master/manifests/init.pp#L549-558

If you specify the option, we want the ability to use hiera_hash() which will pull all of the found fragments instead of stopping at the first one.

@voxter
Copy link
Author

voxter commented May 27, 2014

Brilliant, thank you!

Are you going to make this patch on your own, or would you like me to issue a pull request?

I added at line 10:
$hiera_merge = false,

And changed the code block at line 59 to read:

if $rsyslog_fragments != undef {
if $hiera_merge == true {
$rsyslog_fragments_real = hiera_hash('rsyslog::rsyslog_fragments')
} else {
$rsyslog_fragments_real = $rsyslog_fragments
notice('rsyslog::rsyslog_fragments has hiera_merge_real beliving to be false.')
}
validate_hash($rsyslog_fragments_real)
create_resources('rsyslog::fragment', $rsyslog_fragments_real)
}

And enable it via rsyslog::hiera_merge: true in my hiera yaml definition.

@voxter
Copy link
Author

voxter commented May 27, 2014

Woops, left an extra notice debug in my paste by mistake.

@ghoneycutt
Copy link
Owner

Could you please submit a pull request and close this issue? I'm more than happy to help you through the process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant