diff --git a/cookbooks/fb_dracut/README.md b/cookbooks/fb_dracut/README.md index ec76822..39407d7 100644 --- a/cookbooks/fb_dracut/README.md +++ b/cookbooks/fb_dracut/README.md @@ -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 @@ -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) diff --git a/cookbooks/fb_dracut/attributes/default.rb b/cookbooks/fb_dracut/attributes/default.rb index b15f2b2..ee610ec 100644 --- a/cookbooks/fb_dracut/attributes/default.rb +++ b/cookbooks/fb_dracut/attributes/default.rb @@ -29,6 +29,8 @@ end default['fb_dracut'] = { + 'disable' => false, + 'manage_packages' => true, 'conf' => { 'add_dracutmodules' => [], 'drivers' => [], @@ -43,5 +45,6 @@ 'lvmconf' => true, 'kernel_only' => nil, 'no_kernel' => nil, + 'early_microcode' => true, }, } diff --git a/cookbooks/fb_dracut/metadata.rb b/cookbooks/fb_dracut/metadata.rb index e84e406..3e2531a 100644 --- a/cookbooks/fb_dracut/metadata.rb +++ b/cookbooks/fb_dracut/metadata.rb @@ -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' diff --git a/cookbooks/fb_dracut/recipes/default.rb b/cookbooks/fb_dracut/recipes/default.rb index c0de515..dd2cee7 100644 --- a/cookbooks/fb_dracut/recipes/default.rb +++ b/cookbooks/fb_dracut/recipes/default.rb @@ -24,7 +24,8 @@ 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' @@ -32,13 +33,22 @@ 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 diff --git a/cookbooks/fb_dracut/recipes/packages.rb b/cookbooks/fb_dracut/recipes/packages.rb index 2b29fb5..b1dfd64 100644 --- a/cookbooks/fb_dracut/recipes/packages.rb +++ b/cookbooks/fb_dracut/recipes/packages.rb @@ -19,5 +19,8 @@ # package 'dracut' do + only_if do + node['fb_dracut']['manage_packages'] && !node['fb_dracut']['disable'] + end action :upgrade end