From 14347a1fd9caea0f5738f082fadfd88a25011e50 Mon Sep 17 00:00:00 2001 From: Jake Humphries Date: Wed, 20 Jan 2016 16:52:26 +0000 Subject: [PATCH 01/32] Updates to allow for arrays to be used in defined type's parameters. --- README.md | 18 ++++++++++++------ manifests/params.pp | 26 +++++++++++++------------- manifests/rule.pp | 10 +++++++--- templates/rule.conf.erb | 8 ++++++-- 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index ff497f5..f1390c2 100644 --- a/README.md +++ b/README.md @@ -18,16 +18,22 @@ ulimit::rule { 'example1': ulimit_domain => '*', - ulimit_type => 'soft', - ulimit_item => 'nofile', - ulimit_value => '1024'; + ulimit_type => ['soft'], + ulimit_item => ['nofile'], + ulimit_value => ['1024']; 'example2': ensure => absent, ulimit_domain => '*', - ulimit_type => 'hard', - ulimit_item => 'nofile', - ulimit_value => '50000'; + ulimit_type => ['hard'], + ulimit_item => ['nofile'], + ulimit_value => ['50000']; + + 'example3': + ulimit_domain => '*', + ulimit_type => ['soft', 'soft'], + ulimit_item => ['nofile', 'nproc''], + ulimit_value => ['1024', 'unlimited']; } } diff --git a/manifests/params.pp b/manifests/params.pp index c7a96bf..dab4551 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -22,16 +22,16 @@ 'nproc_user_defaults' => { 'priority' => '90', 'ulimit_domain' => '*', - 'ulimit_item' => 'nproc', - 'ulimit_type' => 'soft', - 'ulimit_value' => '1024', + 'ulimit_item' => ['nproc'], + 'ulimit_type' => ['soft'], + 'ulimit_value' => ['1024'], }, 'nproc_root_defaults' => { 'priority' => '90', 'ulimit_domain' => 'root', - 'ulimit_item' => 'nproc', - 'ulimit_type' => 'soft', - 'ulimit_value' => 'unlimited', + 'ulimit_item' => ['nproc'], + 'ulimit_type' => ['soft'], + 'ulimit_value' => ['unlimited'], }, } } elsif $::operatingsystemmajrelease == '7' { @@ -40,16 +40,16 @@ 'nproc_user_defaults' => { 'priority' => '20', 'ulimit_domain' => '*', - 'ulimit_item' => 'nproc', - 'ulimit_type' => 'soft', - 'ulimit_value' => '4096', + 'ulimit_item' => ['nproc'], + 'ulimit_type' => ['soft'], + 'ulimit_value' => ['4096'], }, 'nproc_root_defaults' => { 'priority' => '20', - 'ulimit_domain' => 'root', - 'ulimit_item' => 'nproc', - 'ulimit_type' => 'soft', - 'ulimit_value' => 'unlimited', + 'ulimit_domain' => ['root'], + 'ulimit_item' => ['nproc'], + 'ulimit_type' => ['soft'], + 'ulimit_value' => ['unlimited'], }, } } else { diff --git a/manifests/rule.pp b/manifests/rule.pp index 9ea77ab..980be5a 100644 --- a/manifests/rule.pp +++ b/manifests/rule.pp @@ -49,13 +49,17 @@ # define ulimit::rule ( $ulimit_domain, - $ulimit_type, - $ulimit_item, - $ulimit_value, + $ulimit_type = [], + $ulimit_item = [], + $ulimit_value = [], $priority = 80, $ensure = present, ) { require ::ulimit + + if (size($ulimit_type) != size($ulimit_item)) or (size($ulimit_item) != size($ulimit_value)) { + fail("Array's are not the same size") + } File { group => $::ulimit::config_group, diff --git a/templates/rule.conf.erb b/templates/rule.conf.erb index 3351770..0b23360 100644 --- a/templates/rule.conf.erb +++ b/templates/rule.conf.erb @@ -1,4 +1,8 @@ +# File controlled by Puppet +# DO NOT EDIT LOCALLY +# # # - -<%= @ulimit_domain %> <%= @ulimit_type %> <%= @ulimit_item %> <%= @ulimit_value %> +<% (0..@ulimit_type.length-1).each do |i| %> +<%= @ulimit_domain %> <%= @ulimit_type[i] %> <%= @ulimit_item[i] %> <%= @ulimit_value[i] %> +<% end %> From d3fa2d50961c64d3524e2d2df93e867b5237ed22 Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Wed, 4 Oct 2017 21:09:37 +0200 Subject: [PATCH 02/32] update content of 'Rakefile' Signed-off-by: Sebastien Varrette --- Rakefile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Rakefile diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..b4597de --- /dev/null +++ b/Rakefile @@ -0,0 +1,31 @@ +############################################################################## +# Rakefile - Configuration file for rake (http://rake.rubyforge.org/) +# Time-stamp: +# +# Copyright (c) 2017 <> +# ____ _ __ _ _ +# | _ \ __ _| | _____ / _(_) | ___ +# | |_) / _` | |/ / _ \ |_| | |/ _ \ +# | _ < (_| | < __/ _| | | __/ +# |_| \_\__,_|_|\_\___|_| |_|_|\___| +# +# Use 'rake -T' to list the available actions +# +# Resources: +# * http://www.stuartellis.eu/articles/rake/ +############################################################################## +require 'falkorlib' + +## placeholder for custom configuration of FalkorLib.config.* +## See https://github.com/Falkor/falkorlib + + +# Git flow customization +FalkorLib.config.gitflow do |c| + c[:branches] = { + :master => 'production', + :develop => 'master' + } +end + +require 'falkorlib/tasks/git' From eaa3942b9f5d87e0dd1e4c8c925b9d797bb2e850 Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Wed, 4 Oct 2017 21:09:42 +0200 Subject: [PATCH 03/32] add '.ruby-version' Signed-off-by: Sebastien Varrette --- .ruby-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..8dbb0f2 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.1.10 From 5be37b54c1ce514bc7b052e4c90e896a49dc6dc3 Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Wed, 4 Oct 2017 21:09:49 +0200 Subject: [PATCH 04/32] add '.ruby-gemset' Signed-off-by: Sebastien Varrette --- .ruby-gemset | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-gemset diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..17cb753 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +puppet From 3a467fa1ab3c2d6e2dfd56224d203381b0808b7c Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Wed, 4 Oct 2017 21:41:49 +0200 Subject: [PATCH 05/32] update layout for puppet module Signed-off-by: Sebastien Varrette --- .ruby-gemset | 2 +- Gemfile | 32 +++++----- Gemfile.lock | 170 ++++++++++++++++++++++++++++++++++++++------------- Rakefile | 4 ++ 4 files changed, 147 insertions(+), 61 deletions(-) diff --git a/.ruby-gemset b/.ruby-gemset index 17cb753..f5c9f65 100644 --- a/.ruby-gemset +++ b/.ruby-gemset @@ -1 +1 @@ -puppet +puppet-ulimit diff --git a/Gemfile b/Gemfile index ddf6bff..f366309 100644 --- a/Gemfile +++ b/Gemfile @@ -1,21 +1,21 @@ source 'https://rubygems.org' -puppetversion = ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : ['>= 3.8.1'] -gem 'puppet', puppetversion +gem 'falkorlib' #, :path => '~/git/github.com/Falkor/falkorlib' -if puppetversion =~ /^3/ - ## rspec-hiera-puppet is puppet 3 only - gem 'rspec-hiera-puppet', '>=1.0.0' +group :test do + gem "rake" + gem "puppet", ENV['PUPPET_GEM_VERSION'] || '~> 4.10.0' + gem 'puppet-strings' + gem 'puppetlabs_spec_helper' + gem 'metadata-json-lint' + gem "puppet-lint-absolute_classname-check" + gem "puppet-lint-leading_zero-check" + gem "puppet-lint-trailing_comma-check" + gem "puppet-lint-version_comparison-check" + gem "puppet-lint-classes_and_types_beginning_with_digits-check" + gem "puppet-lint-unquoted_string-check" + gem 'puppet-lint-resource_reference_syntax' + gem 'puppet-syntax' end -facterversion = ENV.key?('FACTER_VERSION') ? "~> #{ENV['FACTER_VERSION']}" : ['>= 2.4.4'] - -gem 'facter', facterversion - -gem 'rake' -gem 'rspec' -gem 'puppet-lint', '>=1.1.0' -gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git' -gem 'puppetlabs_spec_helper', '>=0.10.3' -gem 'puppet-syntax' - +require 'falkorlib/tasks/puppet' diff --git a/Gemfile.lock b/Gemfile.lock index b2aa50c..80387ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,60 +1,142 @@ -GIT - remote: https://github.com/rodjek/rspec-puppet.git - revision: ee85f33a47a671207f0c88713e1c82a55c096081 - specs: - rspec-puppet (2.3.0) - rspec - GEM remote: https://rubygems.org/ specs: - CFPropertyList (2.2.8) - diff-lcs (1.2.5) - facter (2.4.4) - CFPropertyList (~> 2.2.6) - hiera (2.0.0) - json_pure - json_pure (1.8.2) + activesupport (4.2.10) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + artii (2.1.2) + awesome_print (1.8.0) + configatron (3.2.0) + deep_merge (1.0.1) + diff-lcs (1.3) + diffy (3.2.0) + facter (2.4.6) + falkorlib (0.7.9) + activesupport (~> 4.0) + artii (>= 2.1) + awesome_print (~> 1.2) + configatron (~> 3.2) + deep_merge (~> 1.0.1) + diffy (>= 3.0) + facter (~> 2.4.1) + git_remote_branch (~> 0) + json (~> 1.8) + license-generator (~> 0) + logger (>= 1.2.8) + minigit (~> 0) + rake (~> 10.1, >= 10.1.0) + term-ansicolor (~> 1.3) + thor (>= 0.19) + thor-zsh_completion + fast_gettext (1.1.0) + gettext (3.2.4) + locale (>= 2.0.5) + text (>= 1.3.0) + gettext-setup (0.28) + fast_gettext (~> 1.1.0) + gettext (>= 3.0.2) + locale + git_remote_branch (0.3.8) + hiera (3.4.2) + i18n (0.8.6) + json (1.8.6) + json-schema (2.8.0) + addressable (>= 2.4) + json_pure (1.8.6) + license-generator (0.4.1) + thor + locale (2.1.2) + logger (1.2.8) metaclass (0.0.4) - mocha (1.1.0) + metadata-json-lint (2.0.2) + json-schema (~> 2.8) + spdx-licenses (~> 1.0) + minigit (0.0.4) + minitest (5.10.3) + mocha (1.3.0) metaclass (~> 0.0.1) - puppet (4.1.0) + public_suffix (3.0.0) + puppet (4.10.8) facter (> 2.0, < 4) - hiera (>= 2.0, < 3) - json_pure - puppet-lint (1.1.0) - puppet-syntax (2.0.0) + gettext-setup (>= 0.10, < 1) + hiera (>= 2.0, < 4) + json_pure (~> 1.8) + locale (~> 2.1) + puppet-lint (2.3.3) + puppet-lint-absolute_classname-check (0.2.4) + puppet-lint (>= 1.0, < 3.0) + puppet-lint-classes_and_types_beginning_with_digits-check (0.1.2) + puppet-lint (>= 1.0, < 3.0) + puppet-lint-leading_zero-check (0.1.1) + puppet-lint (>= 1.0, < 3.0) + puppet-lint-resource_reference_syntax (1.0.10) + puppet-lint (>= 1.0, < 3.0) + puppet-lint-trailing_comma-check (0.3.2) + puppet-lint (>= 1.0, < 3.0) + puppet-lint-unquoted_string-check (0.3.0) + puppet-lint (>= 1.0, < 3.0) + puppet-lint-version_comparison-check (0.2.1) + puppet-lint (>= 1.0, < 3.0) + puppet-strings (1.1.0) + yard (~> 0.9.5) + puppet-syntax (2.4.1) rake - puppetlabs_spec_helper (0.10.3) - mocha - puppet-lint - puppet-syntax - rake - rspec-puppet - rake (10.4.2) - rspec (3.2.0) - rspec-core (~> 3.2.0) - rspec-expectations (~> 3.2.0) - rspec-mocks (~> 3.2.0) - rspec-core (3.2.3) - rspec-support (~> 3.2.0) - rspec-expectations (3.2.1) + puppetlabs_spec_helper (2.3.2) + mocha (~> 1.0) + puppet-lint (~> 2.0) + puppet-syntax (~> 2.0) + rspec-puppet (~> 2.0) + rake (10.5.0) + rspec (3.6.0) + rspec-core (~> 3.6.0) + rspec-expectations (~> 3.6.0) + rspec-mocks (~> 3.6.0) + rspec-core (3.6.0) + rspec-support (~> 3.6.0) + rspec-expectations (3.6.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.2.0) - rspec-mocks (3.2.1) + rspec-support (~> 3.6.0) + rspec-mocks (3.6.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.2.0) - rspec-support (3.2.2) + rspec-support (~> 3.6.0) + rspec-puppet (2.6.9) + rspec + rspec-support (3.6.0) + spdx-licenses (1.1.0) + term-ansicolor (1.6.0) + tins (~> 1.0) + text (1.3.1) + thor (0.20.0) + thor-zsh_completion (0.1.4) + thor (~> 0) + thread_safe (0.3.6) + tins (1.15.0) + tzinfo (1.2.3) + thread_safe (~> 0.1) + yard (0.9.9) PLATFORMS ruby DEPENDENCIES - facter (>= 2.4.4) - puppet (>= 3.8.1) - puppet-lint (>= 1.1.0) + falkorlib + metadata-json-lint + puppet (~> 4.10.0) + puppet-lint-absolute_classname-check + puppet-lint-classes_and_types_beginning_with_digits-check + puppet-lint-leading_zero-check + puppet-lint-resource_reference_syntax + puppet-lint-trailing_comma-check + puppet-lint-unquoted_string-check + puppet-lint-version_comparison-check + puppet-strings puppet-syntax - puppetlabs_spec_helper (>= 0.10.3) + puppetlabs_spec_helper rake - rspec - rspec-puppet! + +BUNDLED WITH + 1.15.4 diff --git a/Rakefile b/Rakefile index b4597de..e889ccd 100644 --- a/Rakefile +++ b/Rakefile @@ -15,10 +15,14 @@ # * http://www.stuartellis.eu/articles/rake/ ############################################################################## require 'falkorlib' +require 'puppetlabs_spec_helper/rake_tasks' ## placeholder for custom configuration of FalkorLib.config.* ## See https://github.com/Falkor/falkorlib +FalkorLib.config.versioning do |c| + c[:type] = 'puppet_module' +end # Git flow customization FalkorLib.config.gitflow do |c| From c4530353f06ed27af185caceb08fa46f637f2b2d Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Thu, 5 Oct 2017 10:23:55 +0200 Subject: [PATCH 06/32] update metadata Signed-off-by: Sebastien Varrette --- metadata.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/metadata.json b/metadata.json index 7cdcb10..2202d37 100644 --- a/metadata.json +++ b/metadata.json @@ -1,14 +1,14 @@ { - "name": "arioch-ulimit", + "name": "falkor-ulimit", "version": "0.0.2", - "author": "Tom De Vylder", - "summary": "Ulimit module", + "author": "Tom De Vylder, Sebastien Varrette", + "summary": "Puppet Ulimit module, fork from arioch/puppet-ulimit to allow a version release compliant with Puppet 4 the time Tom release the official new version on his slide", "license": "Apache License, Version 2.0", - "source": "https://github.com/arioch/puppet-ulimit", + "source": "https://github.com/Falkor/puppet-ulimit", "project_page": "http://arioch.github.io/puppet-ulimit/", "issues_url": "https://github.com/arioch/puppet-ulimit/issues", "dependencies": [ - + ], "description": "ulimit", "tags": [ From 9746c2094063c51f598fefe38813b6342dcfcf2c Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Thu, 5 Oct 2017 10:25:35 +0200 Subject: [PATCH 07/32] lint Signed-off-by: Sebastien Varrette --- manifests/rule.pp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/manifests/rule.pp b/manifests/rule.pp index 980be5a..3b45d80 100644 --- a/manifests/rule.pp +++ b/manifests/rule.pp @@ -56,8 +56,7 @@ $ensure = present, ) { require ::ulimit - - if (size($ulimit_type) != size($ulimit_item)) or (size($ulimit_item) != size($ulimit_value)) { + if (size($ulimit_type) != size($ulimit_item)) or (size($ulimit_item) != size($ulimit_value)) { fail("Array's are not the same size") } @@ -87,4 +86,3 @@ } } } - From 821ab1890b7d3ed1da6daf071792b6151cfe27eb Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Thu, 5 Oct 2017 10:25:47 +0200 Subject: [PATCH 08/32] bump to version '0.1.0' Signed-off-by: Sebastien Varrette --- metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index 2202d37..9eb6852 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "falkor-ulimit", - "version": "0.0.2", + "version": "0.1.0", "author": "Tom De Vylder, Sebastien Varrette", "summary": "Puppet Ulimit module, fork from arioch/puppet-ulimit to allow a version release compliant with Puppet 4 the time Tom release the official new version on his slide", "license": "Apache License, Version 2.0", @@ -59,4 +59,4 @@ ] } ] -} +} \ No newline at end of file From 0b125c119792842a009503fdc9bed5f69725d76d Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Thu, 5 Oct 2017 11:13:50 +0200 Subject: [PATCH 09/32] correct module name Signed-off-by: Sebastien Varrette --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 9eb6852..d68a3f9 100644 --- a/metadata.json +++ b/metadata.json @@ -1,5 +1,5 @@ { - "name": "falkor-ulimit", + "name": "svarrette-ulimit", "version": "0.1.0", "author": "Tom De Vylder, Sebastien Varrette", "summary": "Puppet Ulimit module, fork from arioch/puppet-ulimit to allow a version release compliant with Puppet 4 the time Tom release the official new version on his slide", From 4e2e22e44706139cac28f66065c0452ac4042e41 Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Thu, 5 Oct 2017 11:14:36 +0200 Subject: [PATCH 10/32] bump to version '0.1.1' Signed-off-by: Sebastien Varrette --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index d68a3f9..5a974f7 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "svarrette-ulimit", - "version": "0.1.0", + "version": "0.1.1", "author": "Tom De Vylder, Sebastien Varrette", "summary": "Puppet Ulimit module, fork from arioch/puppet-ulimit to allow a version release compliant with Puppet 4 the time Tom release the official new version on his slide", "license": "Apache License, Version 2.0", From f79564b0fee28154c0bd043b14074ff2538f1d76 Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Thu, 5 Oct 2017 11:18:12 +0200 Subject: [PATCH 11/32] mispelling Signed-off-by: Sebastien Varrette --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 5a974f7..8989123 100644 --- a/metadata.json +++ b/metadata.json @@ -2,7 +2,7 @@ "name": "svarrette-ulimit", "version": "0.1.1", "author": "Tom De Vylder, Sebastien Varrette", - "summary": "Puppet Ulimit module, fork from arioch/puppet-ulimit to allow a version release compliant with Puppet 4 the time Tom release the official new version on his slide", + "summary": "Puppet Ulimit module, fork from arioch/puppet-ulimit to allow a version release compliant with Puppet 4 the time Tom release the official new version on his module", "license": "Apache License, Version 2.0", "source": "https://github.com/Falkor/puppet-ulimit", "project_page": "http://arioch.github.io/puppet-ulimit/", From 055f130b0226b59bf2eccb0e62b0ed095028b342 Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Thu, 5 Oct 2017 12:43:08 +0200 Subject: [PATCH 12/32] dep on stdlib for empty() and is_a?() Signed-off-by: Sebastien Varrette --- metadata.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index 8989123..ff875ff 100644 --- a/metadata.json +++ b/metadata.json @@ -8,7 +8,10 @@ "project_page": "http://arioch.github.io/puppet-ulimit/", "issues_url": "https://github.com/arioch/puppet-ulimit/issues", "dependencies": [ - + { + "name": "puppetlabs-stdlib", + "version_requirement": ">=4.2.2 <5.0.0" + }, ], "description": "ulimit", "tags": [ @@ -59,4 +62,4 @@ ] } ] -} \ No newline at end of file +} From 25e7a1f862700ea5313320f7cdee57cbd4e8cc5b Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Thu, 5 Oct 2017 12:44:11 +0200 Subject: [PATCH 13/32] puppet string docs Signed-off-by: Sebastien Varrette --- manifests/config.pp | 12 +++++++++++- manifests/init.pp | 43 +++++++++++++++++++++++++++++++------------ manifests/params.pp | 21 ++++++++++++++++++++- 3 files changed, 62 insertions(+), 14 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index bd1db7c..c9f96f8 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,5 +1,16 @@ +################################################################################ +# Time-stamp: +# +# File:: config.pp +# Author:: Tom De Vylder, Sebastien Varrette +# Copyright:: Copyright (c) 2015-2017 arioch,Falkor +# License:: Apache-2.0 +# +# ------------------------------------------------------------------------------ # == Class: ulimit::config # +# This PRIVATE class handles the configuration of ulimit +# class ulimit::config { File { group => $::ulimit::config_group, @@ -17,4 +28,3 @@ } } - diff --git a/manifests/init.pp b/manifests/init.pp index 7b3ae96..0985c8e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,20 +1,39 @@ +################################################################################ +# Time-stamp: +# +# File:: init.pp +# Author:: Tom De Vylder, Sebastien Varrette +# Copyright:: Copyright (c) 2015-2017 arioch,Falkor +# License:: Apache-2.0 +# +# ------------------------------------------------------------------------------ # == Class: ulimit # -# === Parameters +# ulimit provides control over the resources available to the shell and to +# processes started by it, on systems that allow such control. +# This class offers the ulimit::rule definition which permits to define soft +# and/or hard limits over various domains. +# - The soft limit is the value that the kernel enforces for the corresponding +# resource. +# - The hard limit acts as a ceiling for the soft limit. # -# [*use_default_ulimits*] -# Boolean. If true, then default ulimit configuration for the OS/release is -# applied (if found) -# Default: true +# @param config_dir [String] Default: '/etc/security/limits.d' +# @param config_group [String] Default: 'root' +# @param config_user [String] Default: 'root' +# @param use_default_ulimits [String] Default: true +# If true, then default ulimit configuration for the OS/release is +# applied (if found) +# @param purge [String] Default: true # class ulimit ( - $config_dir = $ulimit::params::config_dir, - $config_group = $ulimit::params::config_group, - $config_user = $ulimit::params::config_user, - $use_default_ulimits = $ulimit::params::use_default_ulimits, - $purge = $ulimit::params::purge, -) inherits ::ulimit::params { + String $config_dir = $ulimit::params::config_dir, + String $config_group = $ulimit::params::config_group, + String $config_user = $ulimit::params::config_user, + Boolean $use_default_ulimits = $ulimit::params::use_default_ulimits, + Boolean $purge = $ulimit::params::purge, +) +inherits ::ulimit::params +{ $default_ulimits = $ulimit::params::default_ulimits include ::ulimit::config } - diff --git a/manifests/params.pp b/manifests/params.pp index dab4551..7d3d0dc 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,6 +1,26 @@ +################################################################################ +# Time-stamp: +# +# File:: params.pp +# Author:: Tom De Vylder, Sebastien Varrette +# Copyright:: Copyright (c) 2015-2017 arioch,Falkor +# License:: Apache-2.0 +# +# ------------------------------------------------------------------------------ # == Class: ulimit::params # +# In this class are defined as default variables values that are used in all +# other ulimit classes and definitions. +# This class should be included, where necessary, and eventually be enhanced +# with support for more Operating Systems. +# +# class ulimit::params { + + #### MODULE INTERNAL VARIABLES ######### + # (Modify to adapt to unsupported OSes) + ######################################### + $config_dir = '/etc/security/limits.d' $config_group = 'root' $config_user = 'root' @@ -61,4 +81,3 @@ } } } - From ba6d4a35ffeee2e511cb182d167b834d6411a2eb Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Thu, 5 Oct 2017 12:44:22 +0200 Subject: [PATCH 14/32] support for string or array in ulimit::rule Signed-off-by: Sebastien Varrette --- manifests/rule.pp | 95 ++++++++++++++++++++++++----------------- templates/rule.conf.erb | 19 ++++++--- 2 files changed, 69 insertions(+), 45 deletions(-) diff --git a/manifests/rule.pp b/manifests/rule.pp index 3b45d80..ca8097d 100644 --- a/manifests/rule.pp +++ b/manifests/rule.pp @@ -1,9 +1,25 @@ +################################################################################ +# Time-stamp: +# +# File:: rule.pp +# Author:: Tom De Vylder, Sebastien Varrette +# Copyright:: Copyright (c) 2015-2017 arioch,Falkor +# License:: Apache-2.0 +# +# ------------------------------------------------------------------------------ # == Define: ulimit::rule # +# Add a new ulimit rule within /etc/security/limits.d/ +# # === Parameters: # -# $ulimit_domain:: Domain -# can be: +# @param ensure [String] Default: 'present'. +# Ensure the presence (or absence) of the ulimit rule +# @param priority [Integer] Default: 80 +# Priority of the file, i.e. this rule will create the file +# '/etc/security/limits.d/_