thias / puppet-sysctl

Puppet module to manage sysctl parameters
Other
35 stars 86 forks source link

Create a puppet 4 branch to adopt improved hiera lookups #46

Closed tpdownes closed 8 years ago

tpdownes commented 8 years ago

Eliminate need for hiera_merge_values because advanced lookup features are now built-in to Puppet 4 and more recent versions of hiera.

Additionally, resolve weirdness of namespace where sysctl is not a class but sysctl::base is a class, by making sysctl a class and moving defined resource to sysctl::configuration. The new way of using this class is to

include sysctl

and set, e.g.,

sysctl::values:
  net.ipv4.ip_forward:
    value: '0'

Because Puppet 4 is a breaking upgrade in many ways I do not feel uncomfortable making this a breaking upgrade. There are a number of issues open that seem to stem from the fact that sysctl is a defined resource but not a class.

tpdownes commented 8 years ago

P.S. I have 2 more commits which fixes a number of other problems.

  1. Use alternative /etc/sysctl.d directory in creating the files.
  2. Only create files in /etc/sysctl.d that pass inspection by sysctl through use of the validate_cmd parameter to file. This has the impact that the setting actually precedes the file creation but not such a big deal.
  3. Add parameter named variable to defined resource that defaults to $title. This allows the logging to take on vernacular-friendly names.
  4. Management of /etc/sysctl.conf is confusing. Variable is set in 2 places if it exists in /etc/sysctl.conf prior to execution. Modify behavior to remove entries from /etc/sysctl.conf.
  5. refreshonly precludes use of onlyif in exec resource. Eliminate refreshonly and rely on combination of notify and onlyif to prevent unnecessary executions.
  6. Create /etc/sysctl.d file prior to enforcing the value. Prevents another unnecessary exec resource from running.

P.P.S. I intend for this to be a new branch, not to overwrite master. But I can't express that in a pull request.

tpdownes commented 8 years ago

If you're willing to introduce a dependency on puppetlabs-stdlib, you could replace the line removal exec with a file_line.

c33s commented 8 years ago

@thias are you willing to accept this PR? @tpdownes if @thias won't accept your PR would you add your fork to the puppetforge as own module?