I am pretty new to puppet and am trying to POC different scenarios I
would envision we would use this product for.  One scenario I ran into
is setting a default kernel.sem value into /etc/sysctl.conf on linux
systems that can be overridden by a custom kernel.sem value for
systems that have specific applications installed that require a
modified value for application tuning.

So, as an example, I am setting the following as the default:

kernel.sem = 16384 262144 128 1023

So all systems should have the above value if they have no
applications installed that would modify that.  On a system that would
have Oracle DB installed, the value needs to be updated to:

kernel.sem = 16384 262144 128 1024

So the last value 1023 becomes 1024.

So to define a system as being a DB system I created a fact that lists
the applications a system will be used for:

service => OracleDB, SCSP

I then have in my site.pp:

include system_defaults
if $service =~ /OracleDB/ {
  include app_oracle
}

system_defaults has:

aug_conf::etc_sysctl_conf {
      "kernel.sem": attr => "kernel.sem", value => "16384 262144 128
1023";
}

app_oracle has:

aug_conf::etc_sysctl_conf {
      "kernel.sem": attr => "kernel.sem", value => "16384 262144 128
1024";
}

The define code is:

  define etc_sysctl_conf ( $attr = "", $value = "" ) {
    # guid of this entry
    $key = "$attr"

    $context = "/files/etc/sysctl.conf"

    $path_list  = "$attr"
    $path_exact = "*[self::$attr=\"$value\"]"

    augeas { "etc_sysctl_conf/$key":
      context => "$context",
      onlyif  => "match $path_exact size==0",
      changes => [
        # insert/modify new node at the end of tree
        "set $path_list \"$value\"",
      ],
    }
  }

So naturally this conflicts.  What I am doing as a workaround is I
modified system_defaults to instead look like:

# If not OracleDB
if $service =~ /^((?!OracleDB).)*$/ {
  aug_conf::etc_sysctl_conf {
    "kernel.sem": attr => "kernel.sem", value => "16384 262144 128
1023";
  }
}

This then makes things not conflict.  There are some issues with the
solution I came up with though:

1) Seems awkward
2) I do not want to have to keep updating the list of applications
that will also modify kernel.sem in my system_defaults recipe as they
come about

I feel like I am not understanding something completely on how I
should be designing this for puppet.  If anyone has any suggestions
please let me know.  Also, if you require more information let me
know.

Thanks,
Jake

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to