cookbook 'ulimit', '= 0.3.3'
ulimit (15) Versions 0.3.3 Follow44
Resources for manaing ulimits
cookbook 'ulimit', '= 0.3.3', :supermarket
knife supermarket install ulimit
knife supermarket download ulimit
Description
This is a short-and-simple cookbook to provide a user_ulimit resource for overriding various ulimit settings. It places configured templates into /etc/security/limits.d/, named for the user the ulimit applies to.
It also provides a helper recipe (default.rb) for allowing ulimit overrides with the 'su' command on Ubuntu, which is disabled by default for some reason.
Finally, it also supplies a more advanced ulimit_domain
resource, allowing you to configure a complex set of rules beyond those supported by the definition.
Requirements
Add to your repo, then depend upon this cookbook from wherever you need to override ulimits. (If you're on Ubuntu, you'll also need to add recipe[ulimit]
to your runlist, or the files created by this cookbook will be ignored.)
Attributes
-
node['ulimit']['pam_su_template_cookbook']
- Defaults to nil (current cookbook). Determines what cookbook the su pam.d template is taken from -
node['ulimit']['users']
- Defaults to empty Mash. List of users with their limits, as below.
Usage
Consume the user_ulimit resource like so:
ruby
user_ulimit "tomcat" do
filehandle_limit 8192 # optional
filehandle_soft_limit 8192 # optional; not used if filehandle_limit is set)
filehandle_hard_limit 8192 # optional; not used if filehandle_limit is set)
process_limit 61504 # optional
process_soft_limit 61504 # optional; not used if process_limit is set)
process_hard_limit 61504 # optional; not used if process_limit is set)
memory_limit 1024 # optional
core_limit 2048 # optional
core_soft_limit 1024 # optional
core_hard_limit 'unlimited' # optional
stack_soft_limit 2048 # optional
stack_hard_limit 2048 # optional
end
You can also define limits using attributes on roles or nodes:
"default_attributes": {
"ulimit": {
"users": {
"tomcat": {
"filehandle_limit": 8193,
"process_limit": 61504
},
"hbase": {
"filehandle_limit": 32768
}
}
}
}
Domain LWRP
Note: The ulimit_domain
resource creates files named after the domain with no modifiers by default. To override this behavior, specify the filename
parameter to the resource.
ulimit_domain 'my_user' do rule do item :nofile type :hard value 10000 end rule do item :nofile type :soft value 5000 end end
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
CHANGELOG for ulimit
This file is used to list changes made in each version of ulimit.
0.3.2
- Resolves issue some users were having with a resource-loading race condition, thanks to Chris Roberts (https://github.com/chrisroberts)
0.3.1
- Fix domain typo, thanks to David Radcliffe (https://github.com/dwradcliffe) (also reported by Lewis Thompson (https://github.com/lewisthompson))
- Add support for split hard/soft nofile limits, thanks to Troy Ready (https://github.com/troyready)
- Fix license boilerplate, thanks to Troy Ready (https://github.com/troyready)
- Fix limits.d file extension, thanks to https://github.com/soul-rebel
0.3.0
- Add Domain LWRP for arbitrary rule creation. Thanks for Chris Roberts (https://github.com/chrisroberts)
0.2.0
- Support specifying users via attributes (as long as your runlist includes the ulimit::default recipe). Thanks to Dmytro Shteflyuk (https://github.com/kpumuk)
0.1.5
- Allow setting core_limit. Thanks to Aaron Nichols (https://github.com/adnichols)
0.1.4:
- Does not set any ulimit parameter by default - only when specified. Thanks to Graham Christensen (https://github.com/zippykid)
0.1.3:
- Adds node attribute node['ulimit']['pam_su_template_cookbook'] to allow users to provide a su pam.d template from another cookbook
0.1.2:
- Add memory limit handling, courtesy of Sean Porter (https://github.com/bmhatfield/chef-ulimit/pull/3)
0.1.0:
- Initial release of ulimit
Check the Markdown Syntax Guide for help with Markdown.
The Github Flavored Markdown page describes the differences between markdown on github and standard markdown.
Foodcritic Metric
0.3.3 failed this metric
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/providers/rule.rb:3
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/providers/rule.rb:4
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/providers/rule.rb:8
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/providers/rule.rb:9
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/templates/default/domain.erb:1
FC015: Consider converting definition to a LWRP: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/definitions/user_ulimit.rb:1
FC017: LWRP does not notify when updated: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/providers/rule.rb:7
FC031: Cookbook without metadata file: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/metadata.rb:1
0.3.3 failed this metric
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/providers/rule.rb:4
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/providers/rule.rb:8
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/providers/rule.rb:9
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/templates/default/domain.erb:1
FC015: Consider converting definition to a LWRP: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/definitions/user_ulimit.rb:1
FC017: LWRP does not notify when updated: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/providers/rule.rb:7
FC031: Cookbook without metadata file: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/7aaffd18ab159c93c6649147/ulimit/metadata.rb:1