Skip to content

Allow hiera merging of sudo::sudoers #26

@christianbrensing

Description

@christianbrensing

If sudo::sudoers is defined via Hiera only the configuration from one hierarchy will be preserved.

Given the following hiera hierachy:

:hierarchy:
  - "%{::clientcert}"
  - "defaults"

If you define sudo::sudoers both in e.g. bar.foo.org.yaml and in defaults.yaml with different rules, only the rules hash from defaults.yaml will be autowired to the param sudoers of the sudo class, losing the rules defined in bar.foo.org.yaml.

Other module like https://github.com/saz/puppet-sudo are using hiera_hash() to merge all hashes.

Perhaps you could add a parameter hiera_merge_sudoers like the one in the nrpe module by ghoneycutt (https://github.com/ghoneycutt/puppet-module-nrpe), defaulting to false, to read and merge the hashes from Hiera.

Example implementation

if $hiera_merge_sudoers {
  $sudoers_real = hiera_hash(sudo::sudoers)
} else {
   $sudoers_real = $sudoers
}
create_resources('sudo::sudoers', $sudoers_real)

I could provide a pull request if you like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions