├── spec ├── fixtures │ └── unit │ │ └── puppet │ │ └── provider │ │ └── kmod_setting │ │ └── augeas │ │ ├── empty │ │ ├── full │ │ └── broken ├── spec_helper.rb ├── defines │ ├── kmod_install_spec.rb │ ├── kmod_option_spec.rb │ ├── kmod_load_spec.rb │ ├── kmod_blacklist_spec.rb │ ├── kmod_alias_spec.rb │ └── kmod_setting_spec.rb └── classes │ └── kmod_spec.rb ├── .gitattributes ├── .sync.yml ├── templates └── redhat.modprobe.erb ├── .puppet-lint.rc ├── .msync.yml ├── .rubocop.yml ├── .fixtures.yml ├── .github ├── labeler.yml ├── workflows │ ├── labeler.yml │ ├── ci.yml │ ├── release.yml │ └── prepare_release.yml ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE.md └── release.yml ├── .editorconfig ├── .gitignore ├── manifests ├── blacklist.pp ├── install.pp ├── alias.pp ├── option.pp ├── load.pp ├── setting.pp └── init.pp ├── .pmtignore ├── hiera.yaml ├── Gemfile ├── Rakefile ├── lib └── facter │ └── kmod.rb ├── .overcommit.yml ├── metadata.json ├── HISTORY.md ├── README.md ├── CHANGELOG.md ├── REFERENCE.md └── LICENSE /spec/fixtures/unit/puppet/provider/kmod_setting/augeas/empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.rb eol=lf 2 | *.erb eol=lf 3 | *.pp eol=lf 4 | *.sh eol=lf 5 | *.epp eol=lf 6 | -------------------------------------------------------------------------------- /.sync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | .puppet-lint.rc: 3 | enabled_lint_checks: 4 | - parameter_documentation 5 | - parameter_types 6 | -------------------------------------------------------------------------------- /templates/redhat.modprobe.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # file managed by puppet 4 | 5 | exec /sbin/modprobe <%= @name %> > /dev/null 2>&1 6 | -------------------------------------------------------------------------------- /.puppet-lint.rc: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | --fail-on-warnings 5 | -------------------------------------------------------------------------------- /.msync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | modulesync_config_version: '10.4.0' 6 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | inherit_gem: 6 | voxpupuli-test: rubocop.yml 7 | -------------------------------------------------------------------------------- /.fixtures.yml: -------------------------------------------------------------------------------- 1 | --- 2 | fixtures: 3 | repositories: 4 | augeas_core: https://github.com/puppetlabs/puppetlabs-augeas_core.git 5 | stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git 6 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | skip-changelog: 6 | - head-branch: ['^release-*', 'release'] 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | # Managed by modulesync - DO NOT EDIT 4 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 5 | 6 | root = true 7 | 8 | [*] 9 | charset = utf-8 10 | end_of_line = lf 11 | indent_size = 2 12 | tab_width = 2 13 | indent_style = space 14 | insert_final_newline = true 15 | trim_trailing_whitespace = true 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | /pkg/ 5 | /Gemfile.lock 6 | /Gemfile.local 7 | /vendor/ 8 | /.vendor/ 9 | /spec/fixtures/manifests/ 10 | /spec/fixtures/modules/ 11 | /.vagrant/ 12 | /.bundle/ 13 | /.ruby-version 14 | /coverage/ 15 | /log/ 16 | /.idea/ 17 | /.dependencies/ 18 | /.librarian/ 19 | /Puppetfile.lock 20 | *.iml 21 | .*.sw? 22 | /.yardoc/ 23 | /Guardfile 24 | bolt-debug.log 25 | .rerun.json 26 | -------------------------------------------------------------------------------- /.github/workflows/labeler.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: "Pull Request Labeler" 6 | 7 | # yamllint disable-line rule:truthy 8 | on: 9 | pull_request_target: {} 10 | 11 | permissions: 12 | contents: read 13 | pull-requests: write 14 | 15 | jobs: 16 | labeler: 17 | permissions: 18 | contents: read 19 | pull-requests: write 20 | runs-on: ubuntu-latest 21 | steps: 22 | - uses: actions/labeler@v5 23 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: CI 6 | 7 | # yamllint disable-line rule:truthy 8 | on: 9 | pull_request: {} 10 | push: 11 | branches: 12 | - main 13 | - master 14 | 15 | concurrency: 16 | group: ${{ github.ref_name }} 17 | cancel-in-progress: true 18 | 19 | permissions: 20 | contents: read 21 | 22 | jobs: 23 | puppet: 24 | name: Puppet 25 | uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v4 26 | -------------------------------------------------------------------------------- /manifests/blacklist.pp: -------------------------------------------------------------------------------- 1 | # @summary Set a kernel module as blacklisted. 2 | # 3 | # @param ensure State of the setting 4 | # @param file File to manage 5 | # 6 | # @example 7 | # kmod::blacklist { 'pcspkr': } 8 | define kmod::blacklist ( 9 | Enum['present', 'absent'] $ensure = 'present', 10 | Stdlib::Unixpath $file = '/etc/modprobe.d/blacklist.conf', 11 | ) { 12 | include kmod 13 | 14 | kmod::setting { "kmod::blacklist ${title}": 15 | ensure => $ensure, 16 | module => $name, 17 | file => $file, 18 | category => 'blacklist', 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 9 | #### Pull Request (PR) description 10 | 13 | 14 | #### This Pull Request (PR) fixes the following issues 15 | 21 | -------------------------------------------------------------------------------- /.pmtignore: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | /docs/ 5 | /pkg/ 6 | /Gemfile 7 | /Gemfile.lock 8 | /Gemfile.local 9 | /vendor/ 10 | /.vendor/ 11 | /spec/ 12 | /Rakefile 13 | /.vagrant/ 14 | /.bundle/ 15 | /.ruby-version 16 | /coverage/ 17 | /log/ 18 | /.idea/ 19 | /.dependencies/ 20 | /.github/ 21 | /.librarian/ 22 | /Puppetfile.lock 23 | /Puppetfile 24 | *.iml 25 | /.editorconfig 26 | /.fixtures.yml 27 | /.gitignore 28 | /.msync.yml 29 | /.overcommit.yml 30 | /.pmtignore 31 | /.rspec 32 | /.rspec_parallel 33 | /.rubocop.yml 34 | /.sync.yml 35 | .*.sw? 36 | /.yardoc/ 37 | /.yardopts 38 | /Dockerfile 39 | /HISTORY.md 40 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: Release 6 | 7 | # yamllint disable-line rule:truthy 8 | on: 9 | push: 10 | tags: 11 | - '*' 12 | 13 | permissions: 14 | contents: write 15 | 16 | jobs: 17 | release: 18 | name: Release 19 | uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v3 20 | with: 21 | allowed_owner: 'voxpupuli' 22 | secrets: 23 | # Configure secrets here: 24 | # https://docs.github.com/en/actions/security-guides/encrypted-secrets 25 | username: ${{ secrets.PUPPET_FORGE_USERNAME }} 26 | api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} 27 | -------------------------------------------------------------------------------- /manifests/install.pp: -------------------------------------------------------------------------------- 1 | # @summary Set a kernel module as installed 2 | # 3 | # @param ensure State of the setting 4 | # @param command Command associated with the kernel module 5 | # @param file File where the stanza is written 6 | # 7 | # @example 8 | # kmod::install { 'pcspkr': } 9 | define kmod::install ( 10 | Enum['present', 'absent'] $ensure = 'present', 11 | String[1] $command = '/bin/true', 12 | Stdlib::Unixpath $file = "/etc/modprobe.d/${name}.conf", 13 | ) { 14 | include kmod 15 | 16 | kmod::setting { "kmod::install ${title}": 17 | ensure => $ensure, 18 | module => $name, 19 | file => $file, 20 | category => 'install', 21 | option => 'command', 22 | value => $command, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 10 | 11 | ## Affected Puppet, Ruby, OS and module versions/distributions 12 | 13 | - Puppet: 14 | - Ruby: 15 | - Distribution: 16 | - Module version: 17 | 18 | ## How to reproduce (e.g Puppet code you use) 19 | 20 | ## What are you seeing 21 | 22 | ## What behaviour did you expect instead 23 | 24 | ## Output log 25 | 26 | ## Any additional information you'd like to impart 27 | -------------------------------------------------------------------------------- /hiera.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 5 3 | 4 | defaults: # Used for any hierarchy level that omits these keys. 5 | datadir: data # This path is relative to hiera.yaml's directory. 6 | data_hash: yaml_data # Use the built-in YAML backend. 7 | 8 | hierarchy: 9 | - name: "osfamily/major release" 10 | paths: 11 | - "os/%{facts.os.family}/%{facts.os.release.major}.yaml" 12 | # Used for Solaris 13 | - "os/%{facts.os.family}/%{facts.kernelrelease}.yaml" 14 | # Used to distinguish between Debian and Ubuntu 15 | - "os/%{facts.os.name}/%{facts.os.release.major}.yaml" 16 | - name: "osfamily" 17 | paths: 18 | - "os/%{facts.os.family}.yaml" 19 | - "os/%{facts.os.name}.yaml" 20 | - name: 'common' 21 | path: 'common.yaml' 22 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | source ENV['GEM_SOURCE'] || 'https://rubygems.org' 5 | 6 | group :test do 7 | gem 'voxpupuli-test', '~> 13.0', :require => false 8 | gem 'puppet_metadata', '~> 5.0', :require => false 9 | end 10 | 11 | group :development do 12 | gem 'guard-rake', :require => false 13 | gem 'overcommit', '>= 0.39.1', :require => false 14 | end 15 | 16 | group :system_tests do 17 | gem 'voxpupuli-acceptance', '~> 4.0', :require => false 18 | end 19 | 20 | group :release do 21 | gem 'voxpupuli-release', '~> 5.0', :require => false 22 | end 23 | 24 | gem 'rake', :require => false 25 | 26 | gem 'openvox', ENV.fetch('OPENVOX_GEM_VERSION', [">= 7", "< 9"]), :require => false, :groups => [:test] 27 | 28 | # vim: syntax=ruby 29 | -------------------------------------------------------------------------------- /manifests/alias.pp: -------------------------------------------------------------------------------- 1 | # @summary Manage kernel module aliases 2 | # 3 | # @param source Name of the module to alias 4 | # @param ensure State of the alias 5 | # @param file File to manage 6 | # @param aliasname Name of the alias (defaults to the resource title) 7 | # 8 | # @example 9 | # kmod::alias { 'bond0': 10 | # source => 'bonding', 11 | # } 12 | define kmod::alias ( 13 | String[1] $source, 14 | Enum['present', 'absent'] $ensure = 'present', 15 | Stdlib::Unixpath $file = "/etc/modprobe.d/${name}.conf", 16 | String[1] $aliasname = $name, 17 | ) { 18 | include kmod 19 | 20 | kmod::setting { "kmod::alias ${title}": 21 | ensure => $ensure, 22 | module => $aliasname, 23 | file => $file, 24 | category => 'alias', 25 | option => 'modulename', 26 | value => $source, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Managed by modulesync - DO NOT EDIT 4 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 5 | 6 | # puppetlabs_spec_helper will set up coverage if the env variable is set. 7 | # We want to do this if lib exists and it hasn't been explicitly set. 8 | ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) 9 | 10 | require 'voxpupuli/test/spec_helper' 11 | 12 | RSpec.configure do |c| 13 | c.facterdb_string_keys = false 14 | end 15 | 16 | add_mocked_facts! 17 | 18 | if File.exist?(File.join(__dir__, 'default_module_facts.yml')) 19 | facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) 20 | facts&.each do |name, value| 21 | add_custom_fact name.to_sym, value 22 | end 23 | end 24 | Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } 25 | -------------------------------------------------------------------------------- /.github/workflows/prepare_release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: 'Prepare Release' 6 | 7 | on: 8 | workflow_dispatch: 9 | inputs: 10 | version: 11 | description: 'Module version to be released. Must be a valid semver string without leading v. (1.2.3)' 12 | required: false 13 | 14 | permissions: 15 | contents: write 16 | pull-requests: write 17 | 18 | jobs: 19 | release_prep: 20 | uses: 'voxpupuli/gha-puppet/.github/workflows/prepare_release.yml@v3' 21 | with: 22 | version: ${{ github.event.inputs.version }} 23 | allowed_owner: 'voxpupuli' 24 | secrets: 25 | # Configure secrets here: 26 | # https://docs.github.com/en/actions/security-guides/encrypted-secrets 27 | github_pat: '${{ secrets.PCCI_PAT_RELEASE_PREP }}' 28 | -------------------------------------------------------------------------------- /manifests/option.pp: -------------------------------------------------------------------------------- 1 | # @summary Manage kernel module options 2 | # 3 | # @param option Option to manage 4 | # @param value Value of kernel module option 5 | # @param module Kernel module to manage 6 | # @param ensure State of the option 7 | # @param file File to manage 8 | # 9 | # @example 10 | # kmod::option { 'bond0 mode': 11 | # module => 'bond0', 12 | # option => 'mode', 13 | # value => '1', 14 | # } 15 | define kmod::option ( 16 | String[1] $option, 17 | Scalar $value, 18 | String[1] $module = $name, 19 | Enum['present', 'absent'] $ensure = 'present', 20 | Stdlib::Unixpath $file = "/etc/modprobe.d/${module}.conf", 21 | ) { 22 | include kmod 23 | 24 | kmod::setting { "kmod::option ${title}": 25 | ensure => $ensure, 26 | module => $module, 27 | category => 'options', 28 | file => $file, 29 | option => $option, 30 | value => $value, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | # https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes 6 | 7 | changelog: 8 | exclude: 9 | labels: 10 | - duplicate 11 | - invalid 12 | - modulesync 13 | - question 14 | - skip-changelog 15 | - wont-fix 16 | - wontfix 17 | 18 | categories: 19 | - title: Breaking Changes 🛠 20 | labels: 21 | - backwards-incompatible 22 | 23 | - title: New Features 🎉 24 | labels: 25 | - enhancement 26 | 27 | - title: Bug Fixes 🐛 28 | labels: 29 | - bug 30 | 31 | - title: Documentation Updates 📚 32 | labels: 33 | - documentation 34 | - docs 35 | 36 | - title: Dependency Updates ⬆️ 37 | labels: 38 | - dependencies 39 | 40 | - title: Other Changes 41 | labels: 42 | - "*" 43 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | begin 5 | require 'voxpupuli/test/rake' 6 | rescue LoadError 7 | # only available if gem group test is installed 8 | end 9 | 10 | begin 11 | require 'voxpupuli/acceptance/rake' 12 | rescue LoadError 13 | # only available if gem group acceptance is installed 14 | end 15 | 16 | begin 17 | require 'voxpupuli/release/rake_tasks' 18 | rescue LoadError 19 | # only available if gem group releases is installed 20 | else 21 | GCGConfig.user = 'voxpupuli' 22 | GCGConfig.project = 'puppet-kmod' 23 | end 24 | 25 | desc "Run main 'test' task and report merged results to coveralls" 26 | task test_with_coveralls: [:test] do 27 | if Dir.exist?(File.expand_path('../lib', __FILE__)) 28 | require 'coveralls/rake/task' 29 | Coveralls::RakeTask.new 30 | Rake::Task['coveralls:push'].invoke 31 | else 32 | puts 'Skipping reporting to coveralls. Module has no lib dir' 33 | end 34 | end 35 | 36 | # vim: syntax=ruby 37 | -------------------------------------------------------------------------------- /manifests/load.pp: -------------------------------------------------------------------------------- 1 | # @summary Manage a kernel module in /etc/modules. 2 | # 3 | # @param ensure State of the setting 4 | # 5 | # @example 6 | # kmod::load { 'sha256': } 7 | define kmod::load ( 8 | Enum['present', 'absent'] $ensure = 'present', 9 | ) { 10 | include kmod 11 | 12 | case $ensure { 13 | 'present': { 14 | case $facts['os']['family'] { 15 | 'Debian': { 16 | $changes = "clear '${name}'" 17 | } 18 | 'Suse': { 19 | $changes = "set MODULES_LOADED_ON_BOOT/value[.='${name}'] '${name}'" 20 | } 21 | default: {} 22 | } 23 | 24 | exec { "modprobe ${name}": 25 | path => '/bin:/sbin:/usr/bin:/usr/sbin', 26 | unless => "grep -qE '^${name} ' /proc/modules", 27 | } 28 | } 29 | 30 | 'absent': { 31 | case $facts['os']['family'] { 32 | 'Debian': { 33 | $changes = "rm '${name}'" 34 | } 35 | 'Suse': { 36 | $changes = "rm MODULES_LOADED_ON_BOOT/value[.='${name}']" 37 | } 38 | default: {} 39 | } 40 | 41 | exec { "modprobe -r ${name}": 42 | path => '/bin:/sbin:/usr/bin:/usr/sbin', 43 | onlyif => "grep -qE '^${name} ' /proc/modules", 44 | } 45 | } 46 | 47 | default: { fail "${module_name}: unknown ensure value ${ensure}" } 48 | } 49 | 50 | file { "/etc/modules-load.d/${name}.conf": 51 | ensure => $ensure, 52 | mode => $kmod::file_mode, 53 | owner => $kmod::owner, 54 | group => $kmod::group, 55 | content => "# This file is managed by the puppet kmod module.\n${name}\n", 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/facter/kmod.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # @summary Return a hash of loaded kernel modules 4 | 5 | Facter.add(:kmods) do 6 | confine kernel: :linux 7 | 8 | kmod = {} 9 | 10 | setcode do 11 | if File.exist?('/sys/module') 12 | Dir.foreach('/sys/module') do |directory| 13 | next if ['.', '..'].include?(directory) 14 | 15 | kmod[directory] = { 16 | 'parameters' => {}, 17 | 'used_by' => [], 18 | } 19 | 20 | if File.directory?("/sys/module/#{directory}/parameters") 21 | Dir.foreach("/sys/module/#{directory}/parameters") do |param| 22 | next if ['.', '..'].include?(param) 23 | 24 | next unless File.readable?("/sys/module/#{directory}/parameters/#{param}") 25 | 26 | begin 27 | kmod[directory]['parameters'][param] = File.read("/sys/module/#{directory}/parameters/#{param}").chomp.delete("\u0000") 28 | rescue StandardError 29 | # some kernel parameters are write only 30 | # even though they have the read bit set 31 | # so just ignore read errors 32 | nil 33 | end 34 | end 35 | end 36 | 37 | if File.directory?("/sys/module/#{directory}/holders") 38 | Dir.foreach("/sys/module/#{directory}/holders") do |used| 39 | next if ['.', '..'].include?(used) 40 | 41 | kmod[directory]['used_by'] << used 42 | end 43 | end 44 | end 45 | 46 | kmod 47 | else 48 | Facter.debug('/sys/module is not found. skipping.') 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /spec/defines/kmod_install_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'kmod::install', type: :define do 6 | let(:title) { 'foo' } 7 | 8 | on_supported_os.each do |os, facts| 9 | context "on #{os}" do 10 | let(:facts) do 11 | facts.merge(augeasversion: '1.2.0') 12 | end 13 | 14 | let(:params) { { ensure: 'present', command: '/bin/true', file: '/etc/modprobe.d/foo.conf' } } 15 | 16 | context 'when ensure is set to present' do 17 | it { is_expected.to contain_kmod__install('foo') } 18 | 19 | it { 20 | is_expected.to contain_kmod__setting('kmod::install foo'). 21 | with('ensure' => 'present', 22 | 'category' => 'install', 23 | 'module' => 'foo', 24 | 'option' => 'command', 25 | 'value' => '/bin/true', 26 | 'file' => '/etc/modprobe.d/foo.conf') 27 | } 28 | end 29 | 30 | context 'when file permissions are specified' do 31 | let(:pre_condition) do 32 | <<~END 33 | class { 'kmod': 34 | owner => 'adm', 35 | group => 'sys', 36 | file_mode => '0600', 37 | } 38 | END 39 | end 40 | 41 | it { is_expected.to contain_kmod__install('foo') } 42 | 43 | it { 44 | is_expected.to contain_file(params[:file]). 45 | with( 46 | 'owner' => 'adm', 47 | 'group' => 'sys', 48 | 'mode' => '0600' 49 | ) 50 | } 51 | end 52 | end 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /.overcommit.yml: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | # 4 | # Hooks are only enabled if you take action. 5 | # 6 | # To enable the hooks run: 7 | # 8 | # ``` 9 | # bundle exec overcommit --install 10 | # # ensure .overcommit.yml does not harm to you and then 11 | # bundle exec overcommit --sign 12 | # ``` 13 | # 14 | # (it will manage the .git/hooks directory): 15 | # 16 | # Examples howto skip a test for a commit or push: 17 | # 18 | # ``` 19 | # SKIP=RuboCop git commit 20 | # SKIP=PuppetLint git commit 21 | # SKIP=RakeTask git push 22 | # ``` 23 | # 24 | # Don't invoke overcommit at all: 25 | # 26 | # ``` 27 | # OVERCOMMIT_DISABLE=1 git commit 28 | # ``` 29 | # 30 | # Read more about overcommit: https://github.com/brigade/overcommit 31 | # 32 | # To manage this config yourself in your module add 33 | # 34 | # ``` 35 | # .overcommit.yml: 36 | # unmanaged: true 37 | # ``` 38 | # 39 | # to your modules .sync.yml config 40 | --- 41 | PreCommit: 42 | RuboCop: 43 | enabled: true 44 | description: 'Runs rubocop on modified files only' 45 | command: ['bundle', 'exec', 'rubocop'] 46 | RakeTarget: 47 | enabled: true 48 | description: 'Runs lint on modified files only' 49 | targets: 50 | - 'lint' 51 | command: ['bundle', 'exec', 'rake'] 52 | YamlSyntax: 53 | enabled: true 54 | JsonSyntax: 55 | enabled: true 56 | TrailingWhitespace: 57 | enabled: true 58 | 59 | PrePush: 60 | RakeTarget: 61 | enabled: true 62 | description: 'Run rake targets' 63 | targets: 64 | - 'validate' 65 | - 'test' 66 | - 'rubocop' 67 | command: ['bundle', 'exec', 'rake'] 68 | -------------------------------------------------------------------------------- /spec/defines/kmod_option_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'kmod::option', type: :define do 6 | let(:title) { 'foo' } 7 | let(:default_params) do 8 | { 9 | 'module' => 'bond0', 10 | 'option' => 'mode', 11 | 'value' => '1', 12 | } 13 | end 14 | 15 | on_supported_os.each do |os, os_facts| 16 | context "on #{os}" do 17 | let(:facts) { os_facts.merge(augeasversion: '1.2.0') } 18 | let(:params) { default_params } 19 | 20 | context 'when ensure is default (present)' do 21 | it { is_expected.to compile } 22 | it { is_expected.to contain_kmod__option(title).with(params) } 23 | 24 | it do 25 | is_expected.to contain_kmod__setting("kmod::option #{title}"). 26 | with_ensure('present'). 27 | with_module(params['module']). 28 | with_category('options'). 29 | with_file("/etc/modprobe.d/#{params['module']}.conf"). 30 | with_option(params['option']). 31 | with_value(params['value']) 32 | end 33 | end 34 | 35 | context 'when file permissions are specified' do 36 | let(:params) { default_params } 37 | let(:pre_condition) do 38 | <<~END 39 | class { 'kmod': 40 | owner => 'adm', 41 | group => 'sys', 42 | file_mode => '0600', 43 | } 44 | END 45 | end 46 | 47 | it { is_expected.to contain_kmod__option(title) } 48 | 49 | it { 50 | is_expected.to contain_file("/etc/modprobe.d/#{params['module']}.conf"). 51 | with( 52 | 'owner' => 'adm', 53 | 'group' => 'sys', 54 | 'mode' => '0600' 55 | ) 56 | } 57 | end 58 | end 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /manifests/setting.pp: -------------------------------------------------------------------------------- 1 | # @summary Manage kernel module settings 2 | # 3 | # @param file File to manage 4 | # @param category Setting type 5 | # @param option Key to manage 6 | # @param value Value to manage 7 | # @param module Module to manage 8 | # @param ensure State of the setting 9 | # 10 | # @example 11 | # kmod__setting { 'kmod::option bond0 mode': 12 | # ensure => 'present', 13 | # module => 'bond0', 14 | # category => 'options', 15 | # file => '/etc/modprobe.d/bond0.conf', 16 | # option => 'mode', 17 | # value => '1', 18 | # } 19 | define kmod::setting ( 20 | Stdlib::Unixpath $file, 21 | String[1] $category, 22 | Optional[String] $option = undef, 23 | Optional[Scalar] $value = undef, 24 | String[1] $module = $name, 25 | Enum['present', 'absent'] $ensure = 'present', 26 | ) { 27 | include kmod 28 | 29 | ensure_resource( 30 | 'file', 31 | $file, 32 | { 33 | 'ensure' => 'file', 34 | 'owner' => $kmod::owner, 35 | 'group' => $kmod::group, 36 | 'mode' => $kmod::file_mode, 37 | } 38 | ) 39 | 40 | case $ensure { 41 | 'present': { 42 | if $option { 43 | $changes = [ 44 | "set ${category}[. = '${module}'] ${module}", 45 | "set ${category}[. = '${module}']/${option} ${value}", 46 | ] 47 | } else { 48 | $changes = [ 49 | "set ${category}[. = '${module}'] ${module}", 50 | ] 51 | } 52 | } 53 | 54 | 'absent': { 55 | $changes = "rm ${category}[. = '${module}']" 56 | } 57 | 58 | default: { fail ( "unknown ensure value ${ensure}" ) } 59 | } 60 | 61 | augeas { "kmod::setting ${title} ${module}": 62 | incl => $file, 63 | lens => 'Modprobe.lns', 64 | changes => $changes, 65 | require => File[$file], 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "puppet-kmod", 3 | "version": "5.0.1-rc0", 4 | "author": "Vox Pupuli", 5 | "summary": "Manage Linux kernel modules with Puppet", 6 | "license": "Apache-2.0", 7 | "source": "https://github.com/voxpupuli/puppet-kmod", 8 | "project_page": "https://github.com/voxpupuli/puppet-kmod", 9 | "issues_url": "https://github.com/voxpupuli/puppet-kmod/issues", 10 | "dependencies": [ 11 | { 12 | "name": "puppetlabs/stdlib", 13 | "version_requirement": ">= 5.0.0 < 10.0.0" 14 | } 15 | ], 16 | "operatingsystem_support": [ 17 | { 18 | "operatingsystem": "Debian", 19 | "operatingsystemrelease": [ 20 | "10", 21 | "11", 22 | "12", 23 | "13" 24 | ] 25 | }, 26 | { 27 | "operatingsystem": "Ubuntu", 28 | "operatingsystemrelease": [ 29 | "18.04", 30 | "20.04", 31 | "22.04", 32 | "24.04" 33 | ] 34 | }, 35 | { 36 | "operatingsystem": "SLES", 37 | "operatingsystemrelease": [ 38 | "11", 39 | "15" 40 | ] 41 | }, 42 | { 43 | "operatingsystem": "RedHat", 44 | "operatingsystemrelease": [ 45 | "7", 46 | "8", 47 | "9" 48 | ] 49 | }, 50 | { 51 | "operatingsystem": "CentOS", 52 | "operatingsystemrelease": [ 53 | "7", 54 | "8" 55 | ] 56 | }, 57 | { 58 | "operatingsystem": "AlmaLinux", 59 | "operatingsystemrelease": [ 60 | "8" 61 | ] 62 | }, 63 | { 64 | "operatingsystem": "Rocky", 65 | "operatingsystemrelease": [ 66 | "8" 67 | ] 68 | }, 69 | { 70 | "operatingsystem": "OracleLinux", 71 | "operatingsystemrelease": [ 72 | "7", 73 | "8" 74 | ] 75 | }, 76 | { 77 | "operatingsystem": "Archlinux" 78 | } 79 | ], 80 | "requirements": [ 81 | { 82 | "name": "openvox", 83 | "version_requirement": ">= 8.19.0 < 9.0.0" 84 | } 85 | ], 86 | "description": "Manage Linux kernel modules with Puppet" 87 | } 88 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | ## [2.5.0](https://github.com/voxpupuli/puppet-kmod/tree/2.5.0) (2020-03-09) 2 | 3 | * Add support for EL8 [GH #59] 4 | 5 | ## 2020-01-07 - Release 2.4.0 6 | 7 | * Remove augeasversion check [GH #53] 8 | * Convert to PDK [GH #54] 9 | 10 | ## 2019-07-30 - Release 2.3.1 11 | 12 | * Allow stdlib 6 13 | 14 | ## 2019-03-01 - Release 2.3.0 15 | 16 | * Add hiera class parameters and update documentation [GH #47] 17 | * kmod::load: load modules the systemd way if the system runs systemd [GH #48] 18 | * Adapt tests for Puppet 6 19 | 20 | ## 2017-08-09 - Release 2.2.0 21 | 22 | * Add ArchLinux support [GH #39, #40] 23 | * Fix ensure=absent in alias [GH #42] 24 | 25 | ## 2015-08-27 - Release 2.1.0 26 | 27 | Add minimal SuSE support 28 | 29 | ## 2015-08-21 - Release 2.0.11 30 | 31 | Use docker for acceptance tests 32 | 33 | ## 2015-06-26 - Release 2.0.10 34 | 35 | Fix strict_variables activation with rspec-puppet 2.2 36 | 37 | ## 2015-05-28 - Release 2.0.9 38 | 39 | Add beaker_spec_helper to Gemfile 40 | 41 | ## 2015-05-26 - Release 2.0.8 42 | 43 | Use random application order in nodeset 44 | 45 | ## 2015-05-26 - Release 2.0.7 46 | 47 | add utopic & vivid nodesets 48 | 49 | ## 2015-05-25 - Release 2.0.6 50 | 51 | Don't allow failure on Puppet 4 52 | 53 | ## 2015-05-13 - Release 2.0.5 54 | 55 | Add puppet-lint-file_source_rights-check gem 56 | 57 | ## 2015-05-12 - Release 2.0.4 58 | 59 | Don't pin beaker 60 | 61 | ## 2015-04-27 - Release 2.0.3 62 | 63 | Add nodeset ubuntu-12.04-x86_64-openstack 64 | 65 | ## 2015-04-18 - Release 2.0.2 66 | 67 | - Add beaker nodeset 68 | 69 | ## 2015-04-15 - Release 2.0.1 70 | 71 | - Fix kmod::install's file class parameter's default 72 | 73 | ## 2015-04-03 - Release 2.0.0 74 | 75 | - Add kmod::option and refactored everything to use kmod::setting 76 | - removed obsolete generic.pp 77 | 78 | ## 2015-03-24 - Release 1.0.6 79 | 80 | - Lint 81 | 82 | ## 2015-01-19 - Release 1.0.5 83 | 84 | - Fix relative class inclusions 85 | 86 | ## 2015-01-07 - Release 1.0.4 87 | 88 | - Fix unquoted strings in cases 89 | 90 | ## 2014-12-16 - Release 1.0.1 91 | 92 | - Fix for future parser 93 | 94 | ## 2014-10-20 - Release 1.0.0 95 | 96 | - Setup automatic Forge releases 97 | 98 | ## 2014-07-02 - Release 0.1.1 99 | 100 | - Fix deprecation warnings, #22 101 | 102 | ## 2014-07-02 - Release 0.1.0 103 | 104 | - Add unit tests 105 | - Various improvements 106 | -------------------------------------------------------------------------------- /spec/defines/kmod_load_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'kmod::load', type: :define do 6 | let(:title) { 'foo' } 7 | 8 | on_supported_os.each do |os, facts| 9 | context "on #{os}" do 10 | let(:facts) do 11 | facts.merge({ augeasversion: '1.2.0' }) 12 | end 13 | 14 | context 'with ensure set to present' do 15 | let(:params) { { ensure: 'present' } } 16 | 17 | it { is_expected.to contain_kmod__load('foo') } 18 | 19 | it { 20 | is_expected.to contain_exec('modprobe foo'). 21 | with('unless' => "grep -qE '^foo ' /proc/modules") 22 | } 23 | 24 | context 'when on systemd' do 25 | it { 26 | is_expected.to contain_file('/etc/modules-load.d/foo.conf'). 27 | with('ensure' => 'present', 28 | 'mode' => '0644', 29 | 'content' => "# This file is managed by the puppet kmod module.\nfoo\n") 30 | } 31 | end 32 | end 33 | 34 | context 'with ensure set to absent' do 35 | let(:params) { { ensure: 'absent', } } 36 | 37 | it { is_expected.to contain_kmod__load('foo') } 38 | 39 | it { 40 | is_expected.to contain_exec('modprobe -r foo'). 41 | with('onlyif' => "grep -qE '^foo ' /proc/modules") 42 | } 43 | 44 | context 'when on systemd' do 45 | it { 46 | is_expected.to contain_file('/etc/modules-load.d/foo.conf'). 47 | with('ensure' => 'absent', 48 | 'mode' => '0644', 49 | 'content' => "# This file is managed by the puppet kmod module.\nfoo\n") 50 | } 51 | end 52 | end 53 | 54 | context 'when file permissions are specified' do 55 | let(:params) { { ensure: 'present', } } 56 | let(:pre_condition) do 57 | <<~END 58 | class { 'kmod': 59 | owner => 'adm', 60 | group => 'sys', 61 | file_mode => '0600', 62 | exe_mode => '0711', 63 | } 64 | END 65 | end 66 | 67 | it { is_expected.to contain_kmod__load('foo') } 68 | 69 | it do 70 | is_expected.to contain_file('/etc/modules-load.d/foo.conf'). 71 | with( 72 | 'owner' => 'adm', 73 | 'group' => 'sys', 74 | 'mode' => '0600' 75 | ) 76 | end 77 | end 78 | end 79 | end 80 | end 81 | -------------------------------------------------------------------------------- /spec/defines/kmod_blacklist_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'kmod::blacklist', type: :define do 6 | let(:title) { 'foo' } 7 | 8 | on_supported_os.each do |os, facts| 9 | context "on #{os}" do 10 | let(:facts) do 11 | facts.merge(augeasversion: '1.2.0') 12 | end 13 | 14 | context 'when ensure is set to present' do 15 | let(:params) { { ensure: 'present', file: '/bar/baz' } } 16 | 17 | it { is_expected.to contain_kmod__blacklist('foo') } 18 | 19 | it { 20 | is_expected.to contain_kmod__setting('kmod::blacklist foo'). 21 | with('ensure' => 'present', 22 | 'category' => 'blacklist', 23 | 'module' => 'foo', 24 | 'file' => '/bar/baz') 25 | } 26 | end 27 | 28 | context 'when file is not specified' do 29 | let(:params) { { ensure: 'present' } } 30 | 31 | it { is_expected.to contain_kmod__blacklist('foo') } 32 | 33 | it { 34 | is_expected.to contain_kmod__setting('kmod::blacklist foo'). 35 | with('ensure' => 'present', 36 | 'category' => 'blacklist', 37 | 'module' => 'foo', 38 | 'file' => '/etc/modprobe.d/blacklist.conf') 39 | } 40 | end 41 | 42 | context 'when ensure is set to absent' do 43 | let(:params) { { ensure: 'absent', file: '/bar/baz' } } 44 | 45 | it { is_expected.to contain_kmod__blacklist('foo') } 46 | 47 | it { 48 | is_expected.to contain_kmod__setting('kmod::blacklist foo'). 49 | with('ensure' => 'absent', 50 | 'category' => 'blacklist', 51 | 'module' => 'foo', 52 | 'file' => '/bar/baz') 53 | } 54 | end 55 | 56 | context 'when file permissions are specified' do 57 | let(:params) { { file: '/bar/baz' } } 58 | let(:pre_condition) do 59 | <<~END 60 | class { 'kmod': 61 | owner => 'adm', 62 | group => 'sys', 63 | file_mode => '0600', 64 | } 65 | END 66 | end 67 | 68 | it { is_expected.to contain_kmod__blacklist('foo') } 69 | 70 | it { 71 | is_expected.to contain_file(params[:file]). 72 | with( 73 | 'owner' => 'adm', 74 | 'group' => 'sys', 75 | 'mode' => '0600' 76 | ) 77 | } 78 | end 79 | end 80 | end 81 | end 82 | -------------------------------------------------------------------------------- /spec/defines/kmod_alias_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'kmod::alias', type: :define do 6 | let(:title) { 'foo' } 7 | 8 | on_supported_os.each do |os, facts| 9 | context "on #{os}" do 10 | let(:facts) do 11 | facts.merge(augeasversion: '1.2.0') 12 | end 13 | 14 | let(:default_params) { { source: 'bar', file: '/baz' } } 15 | 16 | context 'when a file is specified' do 17 | let(:params) { default_params } 18 | 19 | it { is_expected.to contain_kmod__alias('foo') } 20 | 21 | it { 22 | is_expected.to contain_kmod__setting('kmod::alias foo'). 23 | with('ensure' => 'present', 24 | 'module' => 'foo', 25 | 'file' => '/baz', 26 | 'category' => 'alias', 27 | 'option' => 'modulename', 28 | 'value' => 'bar') 29 | } 30 | end 31 | 32 | context 'when a file is specified and an aliasname' do 33 | let(:params) { default_params.merge!(aliasname: 'tango') } 34 | 35 | it { is_expected.to contain_kmod__alias('foo') } 36 | 37 | it { 38 | is_expected.to contain_kmod__setting('kmod::alias foo'). 39 | with('ensure' => 'present', 40 | 'module' => 'tango', 41 | 'file' => '/baz', 42 | 'category' => 'alias', 43 | 'option' => 'modulename', 44 | 'value' => 'bar') 45 | } 46 | end 47 | 48 | context 'when ensure absent is specified' do 49 | let(:params) { default_params.merge!(ensure: 'absent') } 50 | 51 | it { is_expected.to contain_kmod__alias('foo') } 52 | 53 | it { 54 | is_expected.to contain_kmod__setting('kmod::alias foo'). 55 | with('ensure' => 'absent') 56 | } 57 | end 58 | 59 | context 'when file permissions are specified' do 60 | let(:params) { default_params } 61 | let(:pre_condition) do 62 | <<~END 63 | class { 'kmod': 64 | owner => 'adm', 65 | group => 'sys', 66 | file_mode => '0600', 67 | } 68 | END 69 | end 70 | 71 | it { is_expected.to contain_kmod__alias('foo') } 72 | 73 | it { 74 | is_expected.to contain_file(params[:file]). 75 | with( 76 | 'owner' => 'adm', 77 | 'group' => 'sys', 78 | 'mode' => '0600' 79 | ) 80 | } 81 | end 82 | end 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /spec/fixtures/unit/puppet/provider/kmod_setting/augeas/full: -------------------------------------------------------------------------------- 1 | # autoloader aliases 2 | install sound-slot-0 /sbin/modprobe snd-card-0 3 | install sound-slot-1 /sbin/modprobe snd-card-1 4 | install sound-slot-2 /sbin/modprobe snd-card-2 5 | install sound-slot-3 /sbin/modprobe snd-card-3 6 | install sound-slot-4 /sbin/modprobe snd-card-4 7 | install sound-slot-5 /sbin/modprobe snd-card-5 8 | install sound-slot-6 /sbin/modprobe snd-card-6 9 | install sound-slot-7 /sbin/modprobe snd-card-7 10 | 11 | # Cause optional modules to be loaded above generic modules 12 | install snd /sbin/modprobe --ignore-install snd $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-ioctl32 ; /sbin/modprobe --quiet --use-blacklist snd-seq ; } 13 | # 14 | # Workaround at bug #499695 (reverted in Ubuntu see LP #319505) 15 | install snd-pcm /sbin/modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-pcm-oss ; : ; } 16 | install snd-mixer /sbin/modprobe --ignore-install snd-mixer $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-mixer-oss ; : ; } 17 | install snd-seq /sbin/modprobe --ignore-install snd-seq $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; /sbin/modprobe --quiet --use-blacklist snd-seq-oss ; : ; } 18 | # 19 | install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; : ; } 20 | # Cause optional modules to be loaded above sound card driver modules 21 | install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-emu10k1-synth ; } 22 | install snd-via82xx /sbin/modprobe --ignore-install snd-via82xx $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq ; } 23 | 24 | # Load saa7134-alsa instead of saa7134 (which gets dragged in by it anyway) 25 | install saa7134 /sbin/modprobe --ignore-install saa7134 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist saa7134-alsa ; : ; } 26 | # Prevent abnormal drivers from grabbing index 0 27 | options bt87x index=-2 28 | options cx88_alsa index=-2 29 | options saa7134-alsa index=-2 30 | options snd-atiixp-modem index=-2 31 | options snd-intel8x0m index=-2 32 | options snd-via82xx-modem index=-2 33 | options snd-usb-audio index=-2 34 | options snd-usb-caiaq index=-2 35 | options snd-usb-ua101 index=-2 36 | options snd-usb-us122l index=-2 37 | options snd-usb-usx2y index=-2 38 | # Ubuntu #62691, enable MPU for snd-cmipci 39 | options snd-cmipci mpu_port=0x330 fm_port=0x388 40 | # Keep snd-pcsp from being loaded as first soundcard 41 | options snd-pcsp index=-2 42 | # Keep snd-usb-audio from beeing loaded as first soundcard 43 | options snd-usb-audio index=-2 44 | -------------------------------------------------------------------------------- /spec/fixtures/unit/puppet/provider/kmod_setting/augeas/broken: -------------------------------------------------------------------------------- 1 | # autoloader aliases 2 | install sound-slot-0 /sbin/modprobe snd-card-0 3 | install sound-slot-1 /sbin/modprobe snd-card-1 4 | ins tall sound-slot-2 /sbin/modprobe snd-card-2 5 | install sound-slot-3 /sbin/modprobe snd-card-3 6 | install sound-slot-4 /sbin/modprobe snd-card-4 7 | install sound-slot-5 /sbin/modprobe snd-card-5 8 | install sound-slot-6 /sbin/modprobe snd-card-6 9 | install sound-slot-7 /sbin/modprobe snd-card-7 10 | 11 | # Cause optional modules to be loaded above generic modules 12 | install snd /sbin/modprobe --ignore-install snd $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-ioctl32 ; /sbin/modprobe --quiet --use-blacklist snd-seq ; } 13 | # 14 | # Workaround at bug #499695 (reverted in Ubuntu see LP #319505) 15 | install snd-pcm /sbin/modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-pcm-oss ; : ; } 16 | install snd-mixer /sbin/modprobe --ignore-install snd-mixer $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-mixer-oss ; : ; } 17 | install snd-seq /sbin/modprobe --ignore-install snd-seq $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; /sbin/modprobe --quiet --use-blacklist snd-seq-oss ; : ; } 18 | # 19 | install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; : ; } 20 | # Cause optional modules to be loaded above sound card driver modules 21 | install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-emu10k1-synth ; } 22 | install snd-via82xx /sbin/modprobe --ignore-install snd-via82xx $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq ; } 23 | 24 | # Load saa7134-alsa instead of saa7134 (which gets dragged in by it anyway) 25 | install saa7134 /sbin/modprobe --ignore-install saa7134 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist saa7134-alsa ; : ; } 26 | # Prevent abnormal drivers from grabbing index 0 27 | options bt87x index=-2 28 | options cx88_alsa index=-2 29 | options saa7134-alsa index=-2 30 | options snd-atiixp-modem index=-2 31 | options snd-intel8x0m index=-2 32 | options snd-via82xx-modem index=-2 33 | options snd-usb-audio index=-2 34 | options snd-usb-caiaq index=-2 35 | options snd-usb-ua101 index=-2 36 | options snd-usb-us122l index=-2 37 | options snd-usb-usx2y index=-2 38 | # Ubuntu #62691, enable MPU for snd-cmipci 39 | options snd-cmipci mpu_port=0x330 fm_port=0x388 40 | # Keep snd-pcsp from being loaded as first soundcard 41 | options snd-pcsp index=-2 42 | # Keep snd-usb-audio from beeing loaded as first soundcard 43 | options snd-usb-audio index=-2 44 | -------------------------------------------------------------------------------- /spec/defines/kmod_setting_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'kmod::setting', type: :define do 6 | let(:title) { 'foo' } 7 | 8 | on_supported_os.each do |os, facts| 9 | context "on #{os}" do 10 | let(:facts) do 11 | facts.merge(augeasversion: '1.2.0') 12 | end 13 | 14 | let(:default_params) { { file: '/etc/modprobe.conf' } } 15 | let(:params) { default_params } 16 | 17 | context 'add an alias' do 18 | let(:params) { default_params.merge(category: 'alias', option: 'modulename', value: 'tango') } 19 | 20 | it { is_expected.to contain_kmod__setting('foo') } 21 | 22 | it { 23 | is_expected.to contain_augeas('kmod::setting foo foo'). 24 | with('incl' => '/etc/modprobe.conf', 25 | 'lens' => 'Modprobe.lns', 26 | 'changes' => ["set alias[. = 'foo'] foo", "set alias[. = 'foo']/modulename tango"], 27 | 'require' => 'File[/etc/modprobe.conf]') 28 | } 29 | end 30 | 31 | context 'add a blacklist' do 32 | let(:params) { { file: '/etc/modprobe.d/blacklist.conf', category: 'blacklist' } } 33 | 34 | it { is_expected.to contain_kmod__setting('foo') } 35 | 36 | it { 37 | is_expected.to contain_augeas('kmod::setting foo foo'). 38 | with('incl' => '/etc/modprobe.d/blacklist.conf', 39 | 'lens' => 'Modprobe.lns', 40 | 'changes' => ["set blacklist[. = 'foo'] foo"], 41 | 'require' => 'File[/etc/modprobe.d/blacklist.conf]') 42 | } 43 | end 44 | 45 | context 'add an install with file permissions specified' do 46 | let(:params) do 47 | default_params.merge( 48 | category: 'install', 49 | option: 'command', 50 | value: '/bin/true' 51 | ) 52 | end 53 | let(:pre_condition) do 54 | <<~END 55 | class { 'kmod': 56 | owner => 'adm', 57 | group => 'sys', 58 | file_mode => '0600', 59 | } 60 | END 61 | end 62 | 63 | it { is_expected.to contain_kmod__setting('foo') } 64 | 65 | it { 66 | is_expected.to contain_augeas('kmod::setting foo foo'). 67 | with('incl' => '/etc/modprobe.conf', 68 | 'lens' => 'Modprobe.lns', 69 | 'changes' => ["set install[. = 'foo'] foo", "set install[. = 'foo']/command /bin/true"], 70 | 'require' => 'File[/etc/modprobe.conf]') 71 | } 72 | 73 | it { 74 | is_expected.to contain_file(params[:file]). 75 | with( 76 | 'owner' => 'adm', 77 | 'group' => 'sys', 78 | 'mode' => '0600' 79 | ) 80 | } 81 | end 82 | end 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /manifests/init.pp: -------------------------------------------------------------------------------- 1 | # @summary Ensures a couple of mandatory files are present before managing their content. 2 | # 3 | # @param list_of_aliases Hash of [`kmod::alias`](#kmodalias) resources 4 | # @param list_of_blacklists Hash of [`kmod::blacklist`](#kmodblacklist) resources 5 | # @param list_of_installs Hash of [`kmod::install`](#kmodinstall) resources 6 | # @param list_of_loads Hash of [`kmod::load`](#kmodload) resources 7 | # @param list_of_options Hash of [`kmod::option`](#kmodoption) resources 8 | # @param owner Default owner for all files (set via Hiera to allow defaults on all defined types) 9 | # @param group Default group for all files (set via Hiera to allow defaults on all defined types) 10 | # @param directory_mode Default mode for all directories (set via Hiera to allow defaults on all defined types) 11 | # @param file_mode Default mode for all regular files (set via Hiera to allow defaults on all defined types) 12 | # @param exe_mode Default mode for all executable files (set via Hiera to allow defaults on all defined types) 13 | # @param modprobe_d Location of `modprobe.d` directory 14 | # @param modprobe_d_files Default files to create in `modprobe.d` directory 15 | # 16 | # @example 17 | # include kmod 18 | class kmod ( 19 | Hash $list_of_aliases = {}, 20 | Hash $list_of_blacklists = {}, 21 | Hash $list_of_installs = {}, 22 | Hash $list_of_loads = {}, 23 | Hash $list_of_options = {}, 24 | String[1] $owner = 'root', 25 | String[1] $group = 'root', 26 | Stdlib::Filemode $directory_mode = '0755', 27 | Stdlib::Filemode $file_mode = '0644', 28 | Stdlib::Filemode $exe_mode = '0755', 29 | Stdlib::Unixpath $modprobe_d = '/etc/modprobe.d', 30 | Array[Stdlib::Unixpath] $modprobe_d_files = [ 31 | '/etc/modprobe.d/modprobe.conf', 32 | '/etc/modprobe.d/aliases.conf', 33 | '/etc/modprobe.d/blacklist.conf', 34 | ], 35 | ) { 36 | file { $modprobe_d: 37 | ensure => directory, 38 | owner => $owner, 39 | group => $group, 40 | mode => $directory_mode, 41 | } 42 | 43 | file { $modprobe_d_files: 44 | ensure => file, 45 | owner => $owner, 46 | group => $group, 47 | mode => $file_mode, 48 | } 49 | 50 | $list_of_aliases.each | $name, $data | { 51 | kmod::alias { $name: 52 | * => $data, 53 | } 54 | } 55 | $list_of_blacklists.each | $name, $data | { 56 | kmod::blacklist { $name: 57 | * => $data, 58 | } 59 | } 60 | $list_of_installs.each | $name, $data | { 61 | kmod::install { $name: 62 | * => $data, 63 | } 64 | } 65 | $list_of_loads.each | $name, $data | { 66 | kmod::load { $name: 67 | * => $data, 68 | } 69 | } 70 | $list_of_options.each | $name, $data | { 71 | kmod::option { $name: 72 | * => $data, 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /spec/classes/kmod_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'kmod', type: :class do 6 | on_supported_os.each do |os, facts| 7 | context "on #{os} with default parameters" do 8 | let(:facts) do 9 | facts.merge(augeasversion: '1.2.0') 10 | end 11 | 12 | it { is_expected.to contain_class('kmod') } 13 | 14 | it do 15 | is_expected.to contain_file('/etc/modprobe.d').with( 16 | 'ensure' => 'directory', 17 | 'owner' => 'root', 18 | 'group' => 'root', 19 | 'mode' => '0755' 20 | ) 21 | end 22 | 23 | ['modprobe.conf', 'aliases.conf', 'blacklist.conf'].each do |file| 24 | it do 25 | is_expected.to contain_file("/etc/modprobe.d/#{file}").with( 26 | 'ensure' => 'file', 27 | 'owner' => 'root', 28 | 'group' => 'root', 29 | 'mode' => '0644' 30 | ) 31 | end 32 | end 33 | end 34 | 35 | context "on #{os} with modified file permissions" do 36 | let(:facts) do 37 | facts.merge(augeasversion: '1.2.0') 38 | end 39 | let(:params) do 40 | { 41 | 'owner' => 'adm', 42 | 'group' => 'sys', 43 | 'directory_mode' => '0711', 44 | 'file_mode' => '0640', 45 | } 46 | end 47 | 48 | it { is_expected.to contain_class('kmod') } 49 | 50 | it do 51 | is_expected.to contain_file('/etc/modprobe.d').with( 52 | 'ensure' => 'directory', 53 | 'owner' => params['owner'], 54 | 'group' => params['group'], 55 | 'mode' => params['directory_mode'] 56 | ) 57 | end 58 | 59 | ['modprobe.conf', 'aliases.conf', 'blacklist.conf'].each do |file| 60 | it do 61 | is_expected.to contain_file("/etc/modprobe.d/#{file}").with( 62 | 'ensure' => 'file', 63 | 'owner' => params['owner'], 64 | 'group' => params['group'], 65 | 'mode' => params['file_mode'] 66 | ) 67 | end 68 | end 69 | end 70 | 71 | context "on #{os} with hash parameters" do 72 | let(:facts) do 73 | facts.merge({ augeasversion: '1.2.0' }) 74 | end 75 | let(:params) do 76 | { 77 | 'list_of_blacklists' => { 78 | 'foo01' => {}, 79 | 'foo02' => {}, 80 | 'foo03' => {}, 81 | }, 82 | 'list_of_aliases' => { 83 | 'foo01' => { 84 | 'source' => 'squashfs', 85 | 'aliasname' => 'squash01', 86 | }, 87 | 'foo02' => { 88 | 'source' => 'squashfs', 89 | 'aliasname' => 'squash02', 90 | }, 91 | }, 92 | 'list_of_installs' => { 93 | 'dccp' => { 94 | 'command' => '/bin/false', 95 | }, 96 | 'blah' => { 97 | 'command' => '/bin/true', 98 | }, 99 | }, 100 | 'list_of_loads' => { 101 | 'cramfs' => {}, 102 | 'vfat' => {}, 103 | }, 104 | 'list_of_options' => { 105 | 'bond0 mode' => { 106 | 'module' => 'bond0', 107 | 'option' => 'mode', 108 | 'value' => '1', 109 | }, 110 | 'bond0' => { 111 | 'option' => 'mode', 112 | 'value' => '1', 113 | }, 114 | }, 115 | } 116 | end 117 | 118 | it do 119 | params['list_of_blacklists'].each do |key, value| 120 | is_expected.to contain_kmod__blacklist(key).with(value) 121 | end 122 | end 123 | 124 | it do 125 | params['list_of_aliases'].each do |key, value| 126 | is_expected.to contain_kmod__alias(key).with(value) 127 | end 128 | end 129 | 130 | it do 131 | params['list_of_installs'].each do |key, value| 132 | is_expected.to contain_kmod__install(key).with(value) 133 | end 134 | end 135 | 136 | it do 137 | params['list_of_loads'].each do |key, value| 138 | is_expected.to contain_kmod__load(key).with(value) 139 | end 140 | end 141 | 142 | it do 143 | params['list_of_options'].each do |key, value| 144 | is_expected.to contain_kmod__option(key).with(value) 145 | end 146 | end 147 | end 148 | end 149 | end 150 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kmod Puppet module 2 | 3 | [![Build Status](https://github.com/voxpupuli/puppet-kmod/workflows/CI/badge.svg)](https://github.com/voxpupuli/puppet-kmod/actions?query=workflow%3ACI) 4 | [![Release](https://github.com/voxpupuli/puppet-kmod/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-kmod/actions/workflows/release.yml) 5 | [![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/kmod.svg)](https://forge.puppetlabs.com/puppet/kmod) 6 | [![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/kmod.svg)](https://forge.puppetlabs.com/puppet/kmod) 7 | [![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/kmod.svg)](https://forge.puppetlabs.com/puppet/kmod) 8 | [![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/kmod.svg)](https://forge.puppetlabs.com/puppet/kmod) 9 | [![puppetmodule.info docs](http://www.puppetmodule.info/images/badge.png)](http://www.puppetmodule.info/m/puppet-kmod) 10 | [![Apache 2 License](https://img.shields.io/github/license/voxpupuli/puppet-kmod.svg)](LICENSE) 11 | [![Donated by Camptocamp](https://img.shields.io/badge/donated%20by-camptocamp-fb7047.svg)](#transfer-notice) 12 | 13 | ## Description 14 | 15 | This module provides definitions to manipulate modprobe.conf (5) stanzas: 16 | 17 | * kmod::alias 18 | * kmod::install 19 | * kmod::blacklist 20 | 21 | It depends on Augeas with the modprobe lens. 22 | 23 | ## Usage 24 | 25 | This module has five main defined types: 26 | 27 | * kmod::load 28 | * kmod::alias 29 | * kmod::option 30 | * kmod::install 31 | * kmod::blacklist 32 | 33 | 34 | ### kmod::load 35 | 36 | Loads a module using modprobe and manages persistent modules in /etc/sysconfig/modules 37 | 38 | ```puppet 39 | kmod::load { 'mymodule': } 40 | ``` 41 | 42 | ### kmod::alias 43 | 44 | Adds an alias to modprobe.conf, by default `/etc/modprobe.d/.conf` is assumed for a filename. 45 | 46 | ```puppet 47 | kmod::alias { 'bond0': 48 | source => 'bonding', 49 | } 50 | ``` 51 | 52 | Params: 53 | * `source`: Name of the module to alias 54 | * `aliasname`: Name of the alias (defaults to the resource title) 55 | * `file`: File to write to (see above default) 56 | 57 | ### kmod::option 58 | 59 | Adds an option to modprobe.conf 60 | 61 | ```puppet 62 | kmod::option { 'bond0 mode': 63 | module => 'bond0', 64 | option => 'mode', 65 | value => '1', 66 | } 67 | 68 | kmod::option { 'bond0': 69 | option => 'mode', 70 | value => '1', 71 | } 72 | ``` 73 | 74 | Params: 75 | * `option`: Name of the parameter to add 76 | * `value`: Value of the parameter 77 | * `module`: Name of the module (if ommited, the resource title is used) 78 | * `file`: File to write to (defaults to `/etc/modprobe.d/.conf`) 79 | 80 | ### kmod::blacklist 81 | 82 | Manages modprobe blacklist entries. Blacklist entries prevents module aliases from being used, 83 | but would not prevent the module from being loaded. 84 | To prevent a module from being loaded use `kmod::install` 85 | 86 | ```puppet 87 | kmod::blacklist { 'foo': } 88 | ``` 89 | 90 | Params: 91 | * `file`: File to write to, defaults to `/etc/modprobe.d/blacklist.conf` 92 | 93 | ### kmod::install 94 | 95 | Manage modprobe install entries 96 | 97 | ```puppet 98 | kmod::install { 'pcspkr': } 99 | ``` 100 | 101 | If you want to ensure that module can't be loaded at all you can do the following: 102 | ```puppet 103 | kmod::install { 'dccp': command => '/bin/false' } 104 | ``` 105 | 106 | Params: 107 | * `file`: File to write to (defaults to `/etc/modprobe.d/.conf`) 108 | * `command`: (optional) command associated with the install, defaults to `/bin/true` 109 | 110 | ## Using the module with hiera 111 | The module makes available lists for every defined type that will create those 112 | defined types if defined as class parameters. The parameters are: 113 | * kmod::list_of_blacklists: 114 | * kmod::list_of_aliases: 115 | * kmod::list_of_installs: 116 | * kmod::list_of_loads: 117 | * kmod::list_of_options: 118 | 119 | Example usage: 120 | ``` 121 | --- 122 | kmod::list_of_blacklists: 123 | 'foo01': {} 124 | 'foo02': {} 125 | 'foo03': {} 126 | kmod::list_of_aliases: 127 | 'foo01': 128 | source: 'squashfs' 129 | aliasname: 'squash01' 130 | 'foo02': 131 | source: 'squashfs' 132 | aliasname: 'squash02' 133 | kmod::list_of_installs: 134 | 'dccp': 135 | command: '/bin/false' 136 | 'blah': 137 | command: '/bin/true' 138 | kmod::list_of_loads: 139 | 'cramfs': {} 140 | 'vfat': {} 141 | kmod::list_of_options: 142 | 'bond0 mode': 143 | module: 'bond0' 144 | option: 'mode' 145 | value: '1' 146 | 'bond0': 147 | option: 'mode' 148 | value: '1' 149 | ``` 150 | 151 | ## Contributing 152 | 153 | Please report bugs and feature request using [GitHub issue 154 | tracker](https://github.com/camptocamp/puppet-kmod/issues). 155 | 156 | For pull requests, it is very much appreciated to check your Puppet manifest 157 | with [puppet-lint](https://github.com/camptocamp/puppet-kmod/issues) to follow the recommended Puppet style guidelines from the 158 | [Puppet Labs style guide](http://docs.puppetlabs.com/guides/style_guide.html). 159 | 160 | 161 | ## Transfer Notice 162 | 163 | This plugin was originally authored by [Camptocamp](http://www.camptocamp.com). 164 | The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance. 165 | Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of Camptocamp. 166 | 167 | Previously: https://github.com/camptocamp/puppet-kmod 168 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | Each new release typically also includes the latest modulesync defaults. 5 | These should not affect the functionality of the module. 6 | 7 | ## [v5.0.0](https://github.com/voxpupuli/puppet-kmod/tree/v5.0.0) (2025-11-11) 8 | 9 | [Full Changelog](https://github.com/voxpupuli/puppet-kmod/compare/v4.1.0...v5.0.0) 10 | 11 | **Breaking changes:** 12 | 13 | - Drop puppet, update openvox minimum version to 8.19 [\#127](https://github.com/voxpupuli/puppet-kmod/pull/127) ([TheMeier](https://github.com/TheMeier)) 14 | 15 | **Implemented enhancements:** 16 | 17 | - Declare support for Debian 11, 12, 13 and Ubuntu 22.04, 24.04 [\#129](https://github.com/voxpupuli/puppet-kmod/pull/129) ([kenyon](https://github.com/kenyon)) 18 | - metadata.json: Add OpenVox [\#123](https://github.com/voxpupuli/puppet-kmod/pull/123) ([jstraw](https://github.com/jstraw)) 19 | 20 | ## [v4.1.0](https://github.com/voxpupuli/puppet-kmod/tree/v4.1.0) (2024-12-10) 21 | 22 | [Full Changelog](https://github.com/voxpupuli/puppet-kmod/compare/v4.0.1...v4.1.0) 23 | 24 | **Implemented enhancements:** 25 | 26 | - Add support for EL9 [\#119](https://github.com/voxpupuli/puppet-kmod/pull/119) ([ghoneycutt](https://github.com/ghoneycutt)) 27 | 28 | ## [v4.0.1](https://github.com/voxpupuli/puppet-kmod/tree/v4.0.1) (2023-10-02) 29 | 30 | [Full Changelog](https://github.com/voxpupuli/puppet-kmod/compare/v4.0.0...v4.0.1) 31 | 32 | **Fixed bugs:** 33 | 34 | - kmods fact produces null byte in parameters datastructure [\#98](https://github.com/voxpupuli/puppet-kmod/issues/98) 35 | 36 | **Merged pull requests:** 37 | 38 | - Strip null bytes in kmods fact [\#107](https://github.com/voxpupuli/puppet-kmod/pull/107) ([saz](https://github.com/saz)) 39 | 40 | ## [v4.0.0](https://github.com/voxpupuli/puppet-kmod/tree/v4.0.0) (2023-08-07) 41 | 42 | [Full Changelog](https://github.com/voxpupuli/puppet-kmod/compare/v3.2.0...v4.0.0) 43 | 44 | **Breaking changes:** 45 | 46 | - Drop legacy code for non-systemd systems [\#104](https://github.com/voxpupuli/puppet-kmod/pull/104) ([bastelfreak](https://github.com/bastelfreak)) 47 | - Drop EoL Debian 9 [\#103](https://github.com/voxpupuli/puppet-kmod/pull/103) ([bastelfreak](https://github.com/bastelfreak)) 48 | - Drop Puppet 6 support [\#95](https://github.com/voxpupuli/puppet-kmod/pull/95) ([bastelfreak](https://github.com/bastelfreak)) 49 | 50 | **Implemented enhancements:** 51 | 52 | - Add AlmaLinux/Rocky support [\#102](https://github.com/voxpupuli/puppet-kmod/pull/102) ([bastelfreak](https://github.com/bastelfreak)) 53 | - Add Puppet 8 support [\#99](https://github.com/voxpupuli/puppet-kmod/pull/99) ([bastelfreak](https://github.com/bastelfreak)) 54 | - puppetlabs/stdlib: Allow 9.x [\#97](https://github.com/voxpupuli/puppet-kmod/pull/97) ([bastelfreak](https://github.com/bastelfreak)) 55 | 56 | **Fixed bugs:** 57 | 58 | - Replace egrep usage with grep -E [\#92](https://github.com/voxpupuli/puppet-kmod/pull/92) ([mika](https://github.com/mika)) 59 | 60 | ## [v3.2.0](https://github.com/voxpupuli/puppet-kmod/tree/v3.2.0) (2022-05-04) 61 | 62 | [Full Changelog](https://github.com/voxpupuli/puppet-kmod/compare/v3.1.1...v3.2.0) 63 | 64 | **Implemented enhancements:** 65 | 66 | - \(\#86\) Enforce permissions on created files [\#87](https://github.com/voxpupuli/puppet-kmod/pull/87) ([silug](https://github.com/silug)) 67 | 68 | **Fixed bugs:** 69 | 70 | - kmod::alias documentation incorrectly refers to modulename [\#82](https://github.com/voxpupuli/puppet-kmod/issues/82) 71 | - Ignore kmod fact read errors [\#81](https://github.com/voxpupuli/puppet-kmod/pull/81) ([jcpunk](https://github.com/jcpunk)) 72 | 73 | **Closed issues:** 74 | 75 | - Need a way to enforce permissions on created files [\#86](https://github.com/voxpupuli/puppet-kmod/issues/86) 76 | - README.md kmod::alias example is incorrect [\#84](https://github.com/voxpupuli/puppet-kmod/issues/84) 77 | - Warning after upgrading to v3.1.0 [\#79](https://github.com/voxpupuli/puppet-kmod/issues/79) 78 | 79 | **Merged pull requests:** 80 | 81 | - Fix kmod::alias example [\#85](https://github.com/voxpupuli/puppet-kmod/pull/85) ([silug](https://github.com/silug)) 82 | - Update kmod::alias documentation [\#83](https://github.com/voxpupuli/puppet-kmod/pull/83) ([silug](https://github.com/silug)) 83 | 84 | ## [v3.1.1](https://github.com/voxpupuli/puppet-kmod/tree/v3.1.1) (2022-02-07) 85 | 86 | [Full Changelog](https://github.com/voxpupuli/puppet-kmod/compare/v3.1.0...v3.1.1) 87 | 88 | **Merged pull requests:** 89 | 90 | - Hide read error on params when you can't read them [\#78](https://github.com/voxpupuli/puppet-kmod/pull/78) ([jcpunk](https://github.com/jcpunk)) 91 | 92 | ## [v3.1.0](https://github.com/voxpupuli/puppet-kmod/tree/v3.1.0) (2022-02-02) 93 | 94 | [Full Changelog](https://github.com/voxpupuli/puppet-kmod/compare/v3.0.0...v3.1.0) 95 | 96 | **Implemented enhancements:** 97 | 98 | - Add kmod fact [\#44](https://github.com/voxpupuli/puppet-kmod/pull/44) ([jcpunk](https://github.com/jcpunk)) 99 | 100 | **Fixed bugs:** 101 | 102 | - Fix file detection to gather kmod fact [\#75](https://github.com/voxpupuli/puppet-kmod/pull/75) ([kajinamit](https://github.com/kajinamit)) 103 | 104 | **Closed issues:** 105 | 106 | - kmod fact consistently fails with 'expected argument to be a String, Symbol, or Hash' [\#74](https://github.com/voxpupuli/puppet-kmod/issues/74) 107 | 108 | **Merged pull requests:** 109 | 110 | - Allow stdlib 8.0.0 [\#71](https://github.com/voxpupuli/puppet-kmod/pull/71) ([smortex](https://github.com/smortex)) 111 | - pull fixtures from git and not forge [\#70](https://github.com/voxpupuli/puppet-kmod/pull/70) ([bastelfreak](https://github.com/bastelfreak)) 112 | 113 | ## [v3.0.0](https://github.com/voxpupuli/puppet-kmod/tree/v3.0.0) (2021-06-14) 114 | 115 | [Full Changelog](https://github.com/voxpupuli/puppet-kmod/compare/2.5.0...v3.0.0) 116 | 117 | **Breaking changes:** 118 | 119 | - Drop Ubuntu 12/14 support; Add 18/20 support [\#68](https://github.com/voxpupuli/puppet-kmod/pull/68) ([bastelfreak](https://github.com/bastelfreak)) 120 | - Drop EoL Debian 6-8 support; add Debian 10 [\#67](https://github.com/voxpupuli/puppet-kmod/pull/67) ([bastelfreak](https://github.com/bastelfreak)) 121 | - Drop EoL CentOS 5/6 support [\#66](https://github.com/voxpupuli/puppet-kmod/pull/66) ([bastelfreak](https://github.com/bastelfreak)) 122 | - Drop EoL puppet 4/5 support; add Puppet 7 [\#65](https://github.com/voxpupuli/puppet-kmod/pull/65) ([bastelfreak](https://github.com/bastelfreak)) 123 | 124 | **Implemented enhancements:** 125 | 126 | - Allow SUSE 15 [\#61](https://github.com/voxpupuli/puppet-kmod/pull/61) ([caherrera](https://github.com/caherrera)) 127 | 128 | ## [2.5.0](https://github.com/voxpupuli/puppet-kmod/tree/2.5.0) (2020-03-09) 129 | 130 | * Add support for EL8 [GH #59] 131 | 132 | ## 2020-01-07 - Release 2.4.0 133 | 134 | * Remove augeasversion check [GH #53] 135 | * Convert to PDK [GH #54] 136 | 137 | ## 2019-07-30 - Release 2.3.1 138 | 139 | * Allow stdlib 6 140 | 141 | ## 2019-03-01 - Release 2.3.0 142 | 143 | * Add hiera class parameters and update documentation [GH #47] 144 | * kmod::load: load modules the systemd way if the system runs systemd [GH #48] 145 | * Adapt tests for Puppet 6 146 | 147 | ## 2017-08-09 - Release 2.2.0 148 | 149 | * Add ArchLinux support [GH #39, #40] 150 | * Fix ensure=absent in alias [GH #42] 151 | 152 | ## 2015-08-27 - Release 2.1.0 153 | 154 | Add minimal SuSE support 155 | 156 | ## 2015-08-21 - Release 2.0.11 157 | 158 | Use docker for acceptance tests 159 | 160 | ## 2015-06-26 - Release 2.0.10 161 | 162 | Fix strict_variables activation with rspec-puppet 2.2 163 | 164 | ## 2015-05-28 - Release 2.0.9 165 | 166 | Add beaker_spec_helper to Gemfile 167 | 168 | ## 2015-05-26 - Release 2.0.8 169 | 170 | Use random application order in nodeset 171 | 172 | ## 2015-05-26 - Release 2.0.7 173 | 174 | add utopic & vivid nodesets 175 | 176 | ## 2015-05-25 - Release 2.0.6 177 | 178 | Don't allow failure on Puppet 4 179 | 180 | ## 2015-05-13 - Release 2.0.5 181 | 182 | Add puppet-lint-file_source_rights-check gem 183 | 184 | ## 2015-05-12 - Release 2.0.4 185 | 186 | Don't pin beaker 187 | 188 | ## 2015-04-27 - Release 2.0.3 189 | 190 | Add nodeset ubuntu-12.04-x86_64-openstack 191 | 192 | ## 2015-04-18 - Release 2.0.2 193 | 194 | - Add beaker nodeset 195 | 196 | ## 2015-04-15 - Release 2.0.1 197 | 198 | - Fix kmod::install's file class parameter's default 199 | 200 | ## 2015-04-03 - Release 2.0.0 201 | 202 | - Add kmod::option and refactored everything to use kmod::setting 203 | - removed obsolete generic.pp 204 | 205 | ## 2015-03-24 - Release 1.0.6 206 | 207 | - Lint 208 | 209 | ## 2015-01-19 - Release 1.0.5 210 | 211 | - Fix relative class inclusions 212 | 213 | ## 2015-01-07 - Release 1.0.4 214 | 215 | - Fix unquoted strings in cases 216 | 217 | ## 2014-12-16 - Release 1.0.1 218 | 219 | - Fix for future parser 220 | 221 | ## 2014-10-20 - Release 1.0.0 222 | 223 | - Setup automatic Forge releases 224 | 225 | ## 2014-07-02 - Release 0.1.1 226 | 227 | - Fix deprecation warnings, #22 228 | 229 | ## 2014-07-02 - Release 0.1.0 230 | 231 | - Add unit tests 232 | - Various improvements 233 | 234 | 235 | \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* 236 | -------------------------------------------------------------------------------- /REFERENCE.md: -------------------------------------------------------------------------------- 1 | # Reference 2 | 3 | 4 | 5 | ## Table of Contents 6 | 7 | ### Classes 8 | 9 | * [`kmod`](#kmod): Ensures a couple of mandatory files are present before managing their content. 10 | 11 | ### Defined types 12 | 13 | * [`kmod::alias`](#kmod--alias): Manage kernel module aliases 14 | * [`kmod::blacklist`](#kmod--blacklist): Set a kernel module as blacklisted. 15 | * [`kmod::install`](#kmod--install): Set a kernel module as installed 16 | * [`kmod::load`](#kmod--load): Manage a kernel module in /etc/modules. 17 | * [`kmod::option`](#kmod--option): Manage kernel module options 18 | * [`kmod::setting`](#kmod--setting): Manage kernel module settings 19 | 20 | ## Classes 21 | 22 | ### `kmod` 23 | 24 | Ensures a couple of mandatory files are present before managing their content. 25 | 26 | #### Examples 27 | 28 | ##### 29 | 30 | ```puppet 31 | include kmod 32 | ``` 33 | 34 | #### Parameters 35 | 36 | The following parameters are available in the `kmod` class: 37 | 38 | * [`list_of_aliases`](#-kmod--list_of_aliases) 39 | * [`list_of_blacklists`](#-kmod--list_of_blacklists) 40 | * [`list_of_installs`](#-kmod--list_of_installs) 41 | * [`list_of_loads`](#-kmod--list_of_loads) 42 | * [`list_of_options`](#-kmod--list_of_options) 43 | * [`owner`](#-kmod--owner) 44 | * [`group`](#-kmod--group) 45 | * [`directory_mode`](#-kmod--directory_mode) 46 | * [`file_mode`](#-kmod--file_mode) 47 | * [`exe_mode`](#-kmod--exe_mode) 48 | * [`modprobe_d`](#-kmod--modprobe_d) 49 | * [`modprobe_d_files`](#-kmod--modprobe_d_files) 50 | 51 | ##### `list_of_aliases` 52 | 53 | Data type: `Hash` 54 | 55 | Hash of [`kmod::alias`](#kmodalias) resources 56 | 57 | Default value: `{}` 58 | 59 | ##### `list_of_blacklists` 60 | 61 | Data type: `Hash` 62 | 63 | Hash of [`kmod::blacklist`](#kmodblacklist) resources 64 | 65 | Default value: `{}` 66 | 67 | ##### `list_of_installs` 68 | 69 | Data type: `Hash` 70 | 71 | Hash of [`kmod::install`](#kmodinstall) resources 72 | 73 | Default value: `{}` 74 | 75 | ##### `list_of_loads` 76 | 77 | Data type: `Hash` 78 | 79 | Hash of [`kmod::load`](#kmodload) resources 80 | 81 | Default value: `{}` 82 | 83 | ##### `list_of_options` 84 | 85 | Data type: `Hash` 86 | 87 | Hash of [`kmod::option`](#kmodoption) resources 88 | 89 | Default value: `{}` 90 | 91 | ##### `owner` 92 | 93 | Data type: `String[1]` 94 | 95 | Default owner for all files (set via Hiera to allow defaults on all defined types) 96 | 97 | Default value: `'root'` 98 | 99 | ##### `group` 100 | 101 | Data type: `String[1]` 102 | 103 | Default group for all files (set via Hiera to allow defaults on all defined types) 104 | 105 | Default value: `'root'` 106 | 107 | ##### `directory_mode` 108 | 109 | Data type: `Stdlib::Filemode` 110 | 111 | Default mode for all directories (set via Hiera to allow defaults on all defined types) 112 | 113 | Default value: `'0755'` 114 | 115 | ##### `file_mode` 116 | 117 | Data type: `Stdlib::Filemode` 118 | 119 | Default mode for all regular files (set via Hiera to allow defaults on all defined types) 120 | 121 | Default value: `'0644'` 122 | 123 | ##### `exe_mode` 124 | 125 | Data type: `Stdlib::Filemode` 126 | 127 | Default mode for all executable files (set via Hiera to allow defaults on all defined types) 128 | 129 | Default value: `'0755'` 130 | 131 | ##### `modprobe_d` 132 | 133 | Data type: `Stdlib::Unixpath` 134 | 135 | Location of `modprobe.d` directory 136 | 137 | Default value: `'/etc/modprobe.d'` 138 | 139 | ##### `modprobe_d_files` 140 | 141 | Data type: `Array[Stdlib::Unixpath]` 142 | 143 | Default files to create in `modprobe.d` directory 144 | 145 | Default value: 146 | 147 | ```puppet 148 | [ 149 | '/etc/modprobe.d/modprobe.conf', 150 | '/etc/modprobe.d/aliases.conf', 151 | '/etc/modprobe.d/blacklist.conf', 152 | ] 153 | ``` 154 | 155 | ## Defined types 156 | 157 | ### `kmod::alias` 158 | 159 | Manage kernel module aliases 160 | 161 | #### Examples 162 | 163 | ##### 164 | 165 | ```puppet 166 | kmod::alias { 'bond0': 167 | source => 'bonding', 168 | } 169 | ``` 170 | 171 | #### Parameters 172 | 173 | The following parameters are available in the `kmod::alias` defined type: 174 | 175 | * [`source`](#-kmod--alias--source) 176 | * [`ensure`](#-kmod--alias--ensure) 177 | * [`file`](#-kmod--alias--file) 178 | * [`aliasname`](#-kmod--alias--aliasname) 179 | 180 | ##### `source` 181 | 182 | Data type: `String[1]` 183 | 184 | Name of the module to alias 185 | 186 | ##### `ensure` 187 | 188 | Data type: `Enum['present', 'absent']` 189 | 190 | State of the alias 191 | 192 | Default value: `'present'` 193 | 194 | ##### `file` 195 | 196 | Data type: `Stdlib::Unixpath` 197 | 198 | File to manage 199 | 200 | Default value: `"/etc/modprobe.d/${name}.conf"` 201 | 202 | ##### `aliasname` 203 | 204 | Data type: `String[1]` 205 | 206 | Name of the alias (defaults to the resource title) 207 | 208 | Default value: `$name` 209 | 210 | ### `kmod::blacklist` 211 | 212 | Set a kernel module as blacklisted. 213 | 214 | #### Examples 215 | 216 | ##### 217 | 218 | ```puppet 219 | kmod::blacklist { 'pcspkr': } 220 | ``` 221 | 222 | #### Parameters 223 | 224 | The following parameters are available in the `kmod::blacklist` defined type: 225 | 226 | * [`ensure`](#-kmod--blacklist--ensure) 227 | * [`file`](#-kmod--blacklist--file) 228 | 229 | ##### `ensure` 230 | 231 | Data type: `Enum['present', 'absent']` 232 | 233 | State of the setting 234 | 235 | Default value: `'present'` 236 | 237 | ##### `file` 238 | 239 | Data type: `Stdlib::Unixpath` 240 | 241 | File to manage 242 | 243 | Default value: `'/etc/modprobe.d/blacklist.conf'` 244 | 245 | ### `kmod::install` 246 | 247 | Set a kernel module as installed 248 | 249 | #### Examples 250 | 251 | ##### 252 | 253 | ```puppet 254 | kmod::install { 'pcspkr': } 255 | ``` 256 | 257 | #### Parameters 258 | 259 | The following parameters are available in the `kmod::install` defined type: 260 | 261 | * [`ensure`](#-kmod--install--ensure) 262 | * [`command`](#-kmod--install--command) 263 | * [`file`](#-kmod--install--file) 264 | 265 | ##### `ensure` 266 | 267 | Data type: `Enum['present', 'absent']` 268 | 269 | State of the setting 270 | 271 | Default value: `'present'` 272 | 273 | ##### `command` 274 | 275 | Data type: `String[1]` 276 | 277 | Command associated with the kernel module 278 | 279 | Default value: `'/bin/true'` 280 | 281 | ##### `file` 282 | 283 | Data type: `Stdlib::Unixpath` 284 | 285 | File where the stanza is written 286 | 287 | Default value: `"/etc/modprobe.d/${name}.conf"` 288 | 289 | ### `kmod::load` 290 | 291 | Manage a kernel module in /etc/modules. 292 | 293 | #### Examples 294 | 295 | ##### 296 | 297 | ```puppet 298 | kmod::load { 'sha256': } 299 | ``` 300 | 301 | #### Parameters 302 | 303 | The following parameters are available in the `kmod::load` defined type: 304 | 305 | * [`ensure`](#-kmod--load--ensure) 306 | 307 | ##### `ensure` 308 | 309 | Data type: `Enum['present', 'absent']` 310 | 311 | State of the setting 312 | 313 | Default value: `'present'` 314 | 315 | ### `kmod::option` 316 | 317 | Manage kernel module options 318 | 319 | #### Examples 320 | 321 | ##### 322 | 323 | ```puppet 324 | kmod::option { 'bond0 mode': 325 | module => 'bond0', 326 | option => 'mode', 327 | value => '1', 328 | } 329 | ``` 330 | 331 | #### Parameters 332 | 333 | The following parameters are available in the `kmod::option` defined type: 334 | 335 | * [`option`](#-kmod--option--option) 336 | * [`value`](#-kmod--option--value) 337 | * [`module`](#-kmod--option--module) 338 | * [`ensure`](#-kmod--option--ensure) 339 | * [`file`](#-kmod--option--file) 340 | 341 | ##### `option` 342 | 343 | Data type: `String[1]` 344 | 345 | Option to manage 346 | 347 | ##### `value` 348 | 349 | Data type: `Scalar` 350 | 351 | Value of kernel module option 352 | 353 | ##### `module` 354 | 355 | Data type: `String[1]` 356 | 357 | Kernel module to manage 358 | 359 | Default value: `$name` 360 | 361 | ##### `ensure` 362 | 363 | Data type: `Enum['present', 'absent']` 364 | 365 | State of the option 366 | 367 | Default value: `'present'` 368 | 369 | ##### `file` 370 | 371 | Data type: `Stdlib::Unixpath` 372 | 373 | File to manage 374 | 375 | Default value: `"/etc/modprobe.d/${module}.conf"` 376 | 377 | ### `kmod::setting` 378 | 379 | Manage kernel module settings 380 | 381 | #### Examples 382 | 383 | ##### 384 | 385 | ```puppet 386 | kmod__setting { 'kmod::option bond0 mode': 387 | ensure => 'present', 388 | module => 'bond0', 389 | category => 'options', 390 | file => '/etc/modprobe.d/bond0.conf', 391 | option => 'mode', 392 | value => '1', 393 | } 394 | ``` 395 | 396 | #### Parameters 397 | 398 | The following parameters are available in the `kmod::setting` defined type: 399 | 400 | * [`file`](#-kmod--setting--file) 401 | * [`category`](#-kmod--setting--category) 402 | * [`option`](#-kmod--setting--option) 403 | * [`value`](#-kmod--setting--value) 404 | * [`module`](#-kmod--setting--module) 405 | * [`ensure`](#-kmod--setting--ensure) 406 | 407 | ##### `file` 408 | 409 | Data type: `Stdlib::Unixpath` 410 | 411 | File to manage 412 | 413 | ##### `category` 414 | 415 | Data type: `String[1]` 416 | 417 | Setting type 418 | 419 | ##### `option` 420 | 421 | Data type: `Optional[String]` 422 | 423 | Key to manage 424 | 425 | Default value: `undef` 426 | 427 | ##### `value` 428 | 429 | Data type: `Optional[Scalar]` 430 | 431 | Value to manage 432 | 433 | Default value: `undef` 434 | 435 | ##### `module` 436 | 437 | Data type: `String[1]` 438 | 439 | Module to manage 440 | 441 | Default value: `$name` 442 | 443 | ##### `ensure` 444 | 445 | Data type: `Enum['present', 'absent']` 446 | 447 | State of the setting 448 | 449 | Default value: `'present'` 450 | 451 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------