Puppet Class: psick::limits

Defined in:
manifests/limits.pp

Overview

Generic class to manage limits

Examples:

include psick::limits

Parameters:

  • limits_conf_template (Optional[String]) (defaults to: undef)

    The epp or erb template to use for the main limits file.

  • limits_conf_source (Optional[String]) (defaults to: undef)

    The source to use for the main limits file. Alternative to limits_conf_template

  • limits_conf_path (String) (defaults to: '/etc/security/limits.conf')

    The path of the main limits file.

  • limits_conf_params (Hash) (defaults to: {})

    An hash of params to use for the limits.conf file. Use this, for example, to override default mode, onwer or group

  • parameters (Hash) (defaults to: {})

    Optional custom hash of key values to use in limits_conf_template.

  • limits_dir_path (String) (defaults to: '/etc/security/limits.d')

    The path of the limits.d directory.

  • limits_dir_source (Optional[String]) (defaults to: undef)

    The source (as used in source => ) to use to populate the limits.d directory

  • limits_dir_params (Hash) (defaults to: {})

    An hash of params to use for the limits.d diretcory file resource. Set { recurse => true, purge => true } to recursively purge the content of the directory and use only the files present in limits_dir_source

  • limits_hash (Hash) (defaults to: {})

    An hash of limits directives to pass to psick::limits::limit define. Hiera lookup uses deepo merge method.

  • config_hash

    An hash of limits files to pass to psick::limits::config define. Hiera lookup uses deepo merge method.

  • manage (Boolean) (defaults to: $psick::manage)

    If to actually manage any resource in this class. If false no resource is managed. Default value is taken from main psick class.

  • noop_manage (Boolean) (defaults to: $psick::noop_manage)

    If to use the noop() function for all the resources provided by this class. If this is true the noop function is called with $noop_value argument. This overrides any other noop setting (either set on client’s puppet.conf or by noop() function in main psick class). Default from psick class.

  • noop_value (Boolean) (defaults to: $psick::noop_value)

    The value to pass to noop() function if noop_manage is true. It applies to all the resources (and classes) declared in this class If true: noop metaparamenter is set to true, resources are not applied If false: noop metaparameter is set to false, and any eventual noop setting is overridden: resources are always applied. Default from psick class.

  • configs_hash (Hash) (defaults to: {})


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'manifests/limits.pp', line 48

class psick::limits (
  Optional[String] $limits_conf_template = undef,
  Optional[String] $limits_conf_source   = undef,
  String           $limits_conf_path     = '/etc/security/limits.conf',
  Hash             $limits_conf_params   = {},
  Hash             $parameters           = {},

  String           $limits_dir_path      = '/etc/security/limits.d',
  Optional[String] $limits_dir_source    = undef,
  Hash             $limits_dir_params    = {},

  Hash             $limits_hash          = {},
  Hash             $configs_hash         = {},

  Boolean          $manage               = $psick::manage,
  Boolean          $noop_manage          = $psick::noop_manage,
  Boolean          $noop_value           = $psick::noop_value,
) {
  if $manage {
    if $noop_manage {
      noop($noop_value)
    }

    if $limits_conf_source or $limits_conf_template {
      $limits_conf_content = $limits_conf_template ? {
        undef   => undef,
        default => psick::template($limits_conf_template , $parameters),
      }
      $limits_conf_params_default = {
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        source  => $limits_conf_source,
        path    => $limits_conf_path,
        content => $limits_conf_content,
      }
      file { $limits_conf_path:
        * => $limits_conf_params_default + $limits_conf_params,
      }
    }

    $limits_dir_params_default = {
      ensure  => 'directory',
      owner   => 'root',
      group   => 'root',
      mode    => '0755',
      recurse => true,
      path    => $limits_dir_path,
      source  => $limits_dir_source,
    }
    file { $limits_dir_path:
      * => $limits_dir_params_default + $limits_dir_params,
    }

    $limits_hash.each |$k,$v| {
      ::psick::limits::limit { $k:
        * => $v,
      }
    }
    $configs_hash.each |$k,$v| {
      ::psick::limits::config { $k:
        * => $v,
      }
    }
  }
}