cookbook 'kernel-modules', '~> 2.0.9'
kernel-modules (9) Versions 2.0.9 Follow0
Manage kernel modules on linux
cookbook 'kernel-modules', '~> 2.0.9', :supermarket
knife supermarket install kernel-modules
knife supermarket download kernel-modules
kernel-modules Cookbook
Configure and Load kernel modules.
Requirements:
Platforms
- CentOS 6.x/7.x
- RHEL 6.x/7.x
- OEL 6.x/7.x
- Ubuntu 16.04
Chef
- Chef version: >= 12.5.1
Attributes
kernel_modules
-
node['kernel_modules']['packages']
- used to make the packages requirements -
node['kernel_modules']['modules_load.d']
- used to define themodules_load.d
directory -
node['kernel_modules']['modprobe.d']
- use to define themodprobe.d
directory -
node['kernel_modules']['modules']
- use to define the list of modules you want to load/configure -
node['kernel_modules']['default_module_action']
- use to define default action for the attribute driven recipe
Usage
Using this cookbook will load and configure every module in the attribute: node['kernel_modules']['modules']
.
For instance:
``` ruby
$ cat roles/modules.rb
name 'Load modules'
description 'Example for using kernel modules'
run_list(
'kernel-modules'
)
default_attributes(
kernel_modules:
modules: {
nfs: {
options: [
'enable_ino64=1',
'nfs4_disable_idmapping=0',
],
alias: 'nfs4',
action: [:load],
onboot: true,
},
},
)
```
Providers & Resources
kernel_module
This provider allows to configure and load a kernel module
Actions
Action | Description |
---|---|
configure | Add the module at boot time (if needed) and set the module's modprobe configuration file |
load | Load the module once it is configured (When used the configure action will be implicitly launched before) |
unload | Unload the module |
remove | Remove the modprobe configuration file and remove the module at boot time |
Property
Name | Description | Default | Type |
---|---|---|---|
module_name |
module name | name | String |
onboot |
load the module at boot time | true | Boolean |
reload |
allow the module to be reloaded if module configuration changes | false | Boolean |
force_reload |
allow the module to be unloaded even if the module is used[1]. | false | Boolean |
alias |
set the modprobe command alias | nil | Array/String |
options |
set the modprobe command options | nil | Array/String/NilClass |
install |
set the modprobe command install | nil | String/NilClass |
remove |
set the modprobe command remove | nil | String/NilClass |
blacklist |
set the modprobe command blacklist | nil | Boolean/NilClass |
check_availability |
before loading or configuring, ensure the module is available on disk for the running kernel | false | Boolean |
For instance:
``` ruby
To load and configure "mlx4_en"
kernel_module 'mlx4_en' do
onboot true # Make the loading persistent
reload false # We don't want to reload our network module
options %w(inline_thold=120 udp_rss=1) # Specific loading options
check_availability true # Only load and configure when module is present
end
To blacklist a module
kernel_module 'pcspkr' do
onboot true
blacklist true
end
```
Contributing
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
License and Authors
Authors: Jeremy Mauro (j.mauro@criteo.com)
Copyright 2014-2015, Criteo. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
[1]Note: it has no effect unless CONFIG_MODULE_FORCE_UNLOAD was set when the kernel was compiled
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
Collaborator Number Metric
2.0.9 failed this metric
Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
2.0.9 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Cookstyle Metric
2.0.9 failed this metric
Chef/Deprecations/FoodcriticTesting: The Foodcritic cookbook linter has been deprecated and should no longer be used for validating cookbooks. (https://docs.chef.io/workstation/cookstyle/chef_deprecations_foodcritictesting): kernel-modules/Gemfile: 18
Chef/Deprecations/ResourceWithoutUnifiedTrue: Set `unified_mode true` in Chef Infra Client 15.3+ custom resources to ensure they work correctly in Chef Infra Client 18 (April 2022) when Unified Mode becomes the default. (https://docs.chef.io/workstation/cookstyle/chef_deprecations_resourcewithoutunifiedtrue): kernel-modules/resources/kernel_module.rb: 1
Chef/Modernize/ClassEvalActionClass: In Chef Infra Client 12.9 and later it is no longer necessary to call the class_eval method on the action class block. (https://docs.chef.io/workstation/cookstyle/chef_modernize_classevalactionclass): kernel-modules/resources/kernel_module.rb: 142
Chef/Modernize/DefinesChefSpecMatchers: ChefSpec matchers are now auto generated by ChefSpec 7.1+ and do not need to be defined in a cookbook (https://docs.chef.io/workstation/cookstyle/chef_modernize_defineschefspecmatchers): kernel-modules/libraries/matchers.rb: 19
Chef/Modernize/IncludingMixinShelloutInResources: There is no need to include Chef::Mixin::ShellOut or Chef::Mixin::PowershellOut in resources or providers as this is already done by Chef Infra Client 12.4+. (https://docs.chef.io/workstation/cookstyle/chef_modernize_includingmixinshelloutinresources): kernel-modules/resources/kernel_module.rb: 20
Chef/Modernize/IncludingMixinShelloutInResources: There is no need to include Chef::Mixin::ShellOut or Chef::Mixin::PowershellOut in resources or providers as this is already done by Chef Infra Client 12.4+. (https://docs.chef.io/workstation/cookstyle/chef_modernize_includingmixinshelloutinresources): kernel-modules/resources/kernel_module.rb: 21
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): kernel-modules/metadata.rb: 9
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): kernel-modules/metadata.rb: 10
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): kernel-modules/metadata.rb: 15
Chef/Modernize/ShellOutHelper: Use the built-in `shell_out` helper available in Chef Infra Client 12.11+ instead of calling `Mixlib::ShellOut.new('foo').run_command`. (https://docs.chef.io/workstation/cookstyle/chef_modernize_shellouthelper): kernel-modules/rakelib/50-rubocop.rake: 37
Chef/Modernize/WhyRunSupportedTrue: whyrun_supported? no longer needs to be set to true as it is the default in Chef Infra Client 13+ (https://docs.chef.io/workstation/cookstyle/chef_modernize_whyrunsupportedtrue): kernel-modules/resources/kernel_module.rb: 164
Chef/RedundantCode/LongDescriptionMetadata: The long_description metadata.rb method is not used and is unnecessary in cookbooks. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_longdescriptionmetadata): kernel-modules/metadata.rb: 6
Chef/RedundantCode/StringPropertyWithNilDefault: Properties have a nil value by default so there is no need to set the default value to nil. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_stringpropertywithnildefault): kernel-modules/resources/kernel_module.rb: 42
Chef/RedundantCode/StringPropertyWithNilDefault: Properties have a nil value by default so there is no need to set the default value to nil. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_stringpropertywithnildefault): kernel-modules/resources/kernel_module.rb: 43
Run with Cookstyle Version 7.32.1 with cops Chef/Deprecations,Chef/Correctness,Chef/Sharing,Chef/RedundantCode,Chef/Modernize,Chef/Security,InSpec/Deprecations
No Binaries Metric
2.0.9 passed this metric
Testing File Metric
2.0.9 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
2.0.9 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
2.0.9 failed this metric
2.0.9 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Cookstyle Metric
2.0.9 failed this metric
Chef/Deprecations/FoodcriticTesting: The Foodcritic cookbook linter has been deprecated and should no longer be used for validating cookbooks. (https://docs.chef.io/workstation/cookstyle/chef_deprecations_foodcritictesting): kernel-modules/Gemfile: 18
Chef/Deprecations/ResourceWithoutUnifiedTrue: Set `unified_mode true` in Chef Infra Client 15.3+ custom resources to ensure they work correctly in Chef Infra Client 18 (April 2022) when Unified Mode becomes the default. (https://docs.chef.io/workstation/cookstyle/chef_deprecations_resourcewithoutunifiedtrue): kernel-modules/resources/kernel_module.rb: 1
Chef/Modernize/ClassEvalActionClass: In Chef Infra Client 12.9 and later it is no longer necessary to call the class_eval method on the action class block. (https://docs.chef.io/workstation/cookstyle/chef_modernize_classevalactionclass): kernel-modules/resources/kernel_module.rb: 142
Chef/Modernize/DefinesChefSpecMatchers: ChefSpec matchers are now auto generated by ChefSpec 7.1+ and do not need to be defined in a cookbook (https://docs.chef.io/workstation/cookstyle/chef_modernize_defineschefspecmatchers): kernel-modules/libraries/matchers.rb: 19
Chef/Modernize/IncludingMixinShelloutInResources: There is no need to include Chef::Mixin::ShellOut or Chef::Mixin::PowershellOut in resources or providers as this is already done by Chef Infra Client 12.4+. (https://docs.chef.io/workstation/cookstyle/chef_modernize_includingmixinshelloutinresources): kernel-modules/resources/kernel_module.rb: 20
Chef/Modernize/IncludingMixinShelloutInResources: There is no need to include Chef::Mixin::ShellOut or Chef::Mixin::PowershellOut in resources or providers as this is already done by Chef Infra Client 12.4+. (https://docs.chef.io/workstation/cookstyle/chef_modernize_includingmixinshelloutinresources): kernel-modules/resources/kernel_module.rb: 21
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): kernel-modules/metadata.rb: 9
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): kernel-modules/metadata.rb: 10
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): kernel-modules/metadata.rb: 15
Chef/Modernize/ShellOutHelper: Use the built-in `shell_out` helper available in Chef Infra Client 12.11+ instead of calling `Mixlib::ShellOut.new('foo').run_command`. (https://docs.chef.io/workstation/cookstyle/chef_modernize_shellouthelper): kernel-modules/rakelib/50-rubocop.rake: 37
Chef/Modernize/WhyRunSupportedTrue: whyrun_supported? no longer needs to be set to true as it is the default in Chef Infra Client 13+ (https://docs.chef.io/workstation/cookstyle/chef_modernize_whyrunsupportedtrue): kernel-modules/resources/kernel_module.rb: 164
Chef/RedundantCode/LongDescriptionMetadata: The long_description metadata.rb method is not used and is unnecessary in cookbooks. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_longdescriptionmetadata): kernel-modules/metadata.rb: 6
Chef/RedundantCode/StringPropertyWithNilDefault: Properties have a nil value by default so there is no need to set the default value to nil. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_stringpropertywithnildefault): kernel-modules/resources/kernel_module.rb: 42
Chef/RedundantCode/StringPropertyWithNilDefault: Properties have a nil value by default so there is no need to set the default value to nil. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_stringpropertywithnildefault): kernel-modules/resources/kernel_module.rb: 43
Run with Cookstyle Version 7.32.1 with cops Chef/Deprecations,Chef/Correctness,Chef/Sharing,Chef/RedundantCode,Chef/Modernize,Chef/Security,InSpec/Deprecations
No Binaries Metric
2.0.9 passed this metric
Testing File Metric
2.0.9 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
2.0.9 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
2.0.9 failed this metric
Chef/Deprecations/ResourceWithoutUnifiedTrue: Set `unified_mode true` in Chef Infra Client 15.3+ custom resources to ensure they work correctly in Chef Infra Client 18 (April 2022) when Unified Mode becomes the default. (https://docs.chef.io/workstation/cookstyle/chef_deprecations_resourcewithoutunifiedtrue): kernel-modules/resources/kernel_module.rb: 1
Chef/Modernize/ClassEvalActionClass: In Chef Infra Client 12.9 and later it is no longer necessary to call the class_eval method on the action class block. (https://docs.chef.io/workstation/cookstyle/chef_modernize_classevalactionclass): kernel-modules/resources/kernel_module.rb: 142
Chef/Modernize/DefinesChefSpecMatchers: ChefSpec matchers are now auto generated by ChefSpec 7.1+ and do not need to be defined in a cookbook (https://docs.chef.io/workstation/cookstyle/chef_modernize_defineschefspecmatchers): kernel-modules/libraries/matchers.rb: 19
Chef/Modernize/IncludingMixinShelloutInResources: There is no need to include Chef::Mixin::ShellOut or Chef::Mixin::PowershellOut in resources or providers as this is already done by Chef Infra Client 12.4+. (https://docs.chef.io/workstation/cookstyle/chef_modernize_includingmixinshelloutinresources): kernel-modules/resources/kernel_module.rb: 20
Chef/Modernize/IncludingMixinShelloutInResources: There is no need to include Chef::Mixin::ShellOut or Chef::Mixin::PowershellOut in resources or providers as this is already done by Chef Infra Client 12.4+. (https://docs.chef.io/workstation/cookstyle/chef_modernize_includingmixinshelloutinresources): kernel-modules/resources/kernel_module.rb: 21
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): kernel-modules/metadata.rb: 9
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): kernel-modules/metadata.rb: 10
Chef/Modernize/RespondToInMetadata: It is no longer necessary to use respond_to? or defined? in metadata.rb in Chef Infra Client 12.15 and later (https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtoinmetadata): kernel-modules/metadata.rb: 15
Chef/Modernize/ShellOutHelper: Use the built-in `shell_out` helper available in Chef Infra Client 12.11+ instead of calling `Mixlib::ShellOut.new('foo').run_command`. (https://docs.chef.io/workstation/cookstyle/chef_modernize_shellouthelper): kernel-modules/rakelib/50-rubocop.rake: 37
Chef/Modernize/WhyRunSupportedTrue: whyrun_supported? no longer needs to be set to true as it is the default in Chef Infra Client 13+ (https://docs.chef.io/workstation/cookstyle/chef_modernize_whyrunsupportedtrue): kernel-modules/resources/kernel_module.rb: 164
Chef/RedundantCode/LongDescriptionMetadata: The long_description metadata.rb method is not used and is unnecessary in cookbooks. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_longdescriptionmetadata): kernel-modules/metadata.rb: 6
Chef/RedundantCode/StringPropertyWithNilDefault: Properties have a nil value by default so there is no need to set the default value to nil. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_stringpropertywithnildefault): kernel-modules/resources/kernel_module.rb: 42
Chef/RedundantCode/StringPropertyWithNilDefault: Properties have a nil value by default so there is no need to set the default value to nil. (https://docs.chef.io/workstation/cookstyle/chef_redundantcode_stringpropertywithnildefault): kernel-modules/resources/kernel_module.rb: 43
Run with Cookstyle Version 7.32.1 with cops Chef/Deprecations,Chef/Correctness,Chef/Sharing,Chef/RedundantCode,Chef/Modernize,Chef/Security,InSpec/Deprecations
2.0.9 passed this metric
Testing File Metric
2.0.9 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
2.0.9 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
2.0.9 failed this metric
2.0.9 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number