Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync fb_dracut with upstream #253

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions cookbooks/fb_dracut/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ Attributes
* node['fb_dracut']['conf']['lvmconf']
* node['fb_dracut']['conf']['kernel_only']
* node['fb_dracut']['conf']['no_kernel']
* node['fb_dracut']['manage_packages']
* node['fb_dracut']['disable']

Usage
-----
By default `fb_dracut` will manage the dracut package; to disable this set
`node['fb_dracut']['manage_packages']` to `false`.

You can add any valid `dracut.conf` entry under `node['fb_dracut']['conf']`
If an attribute is set to `nil` or an empty list, the `dracut.conf` entry
for that attribute will not be written out. In this case the system
Expand Down Expand Up @@ -93,3 +98,11 @@ The following are pre-initialized for you as noted:
* `node['fb_dracut']['conf']['no_kernel']`
Do not install kernel drivers and firmware files. (true|false|nil)
(default=nil)

* `node['fb_dracut']['conf']['early_microcode']`
Include CPU microcode for early loading by the kernel. (true|false|nil)
(default=true)

* `node['fb_dracut']['disable']`
Disable all actions in this cookbook. (true|false|nil)
(default=false)
3 changes: 3 additions & 0 deletions cookbooks/fb_dracut/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
end

default['fb_dracut'] = {
'disable' => false,
'manage_packages' => true,
'conf' => {
'add_dracutmodules' => [],
'drivers' => [],
Expand All @@ -43,5 +45,6 @@
'lvmconf' => true,
'kernel_only' => nil,
'no_kernel' => nil,
'early_microcode' => true,
},
}
1 change: 0 additions & 1 deletion cookbooks/fb_dracut/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
license 'Apache-2.0'
description 'Installs/Configures dracut'
source_url 'https://github.com/facebook/chef-cookbooks/'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
supports 'centos'
depends 'fb_helpers'
14 changes: 12 additions & 2 deletions cookbooks/fb_dracut/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,31 @@

include_recipe 'fb_dracut::packages'

template '/etc/dracut.conf' do
template '/etc/dracut.conf.d/ZZ-chef.conf' do
not_if { node['fb_dracut']['disable'] }
source 'dracut.conf.erb'
owner 'root'
group 'root'
mode '0644'
notifies :run, 'execute[rebuild all initramfs]'
end

file '/etc/dracut.conf' do
not_if { node['fb_dracut']['disable'] }
action :delete
notifies :run, 'execute[rebuild all initramfs]'
end

execute 'rebuild all initramfs' do
not_if { node.container? }
not_if { node.container? || node.quiescent? || node['fb_dracut']['disable'] }
command 'dracut --force'
action :nothing
if node.systemd?
subscribes :run, 'package[systemd packages]'
subscribes :run, 'template[/etc/systemd/system.conf]'
subscribes :run, 'template[/etc/sysctl.conf]'
subscribes :run, 'package[e2fsprogs]'
subscribes :run, 'template[/etc/e2fsck.conf]'
subscribes :run, 'template[/etc/modprobe.d/fb_modprobe.conf]'
end
end
3 changes: 3 additions & 0 deletions cookbooks/fb_dracut/recipes/packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
#

package 'dracut' do
only_if do
node['fb_dracut']['manage_packages'] && !node['fb_dracut']['disable']
end
action :upgrade
end