platform_utils CHANGELOG
========================
+0.8.0
+-----
+- adds the `platform_utils::grub_default` recipe.
+
0.7.0
-----
- adds autopilot features.
- [Usage](#usage)
- [Recipes](#recipes)
- [platform_utils::default](#platform_utilsdefault)
+ - [platform_utils::grub_default](#platform_utilsgrub_default)
- [platform_utils::crond (ver. 0.4.0 or later)](#platform_utilscrond-ver-040-or-later)
- [platform_utils::kernel_modules (ver. 0.4.2 or later)](#platform_utilskernel_modules-ver-042-or-later)
- [platform_utils::kernel_user_namespace (ver. 0.4.2 or later)](#platform_utilskernel_user_namespace-ver-042-or-later)
|Key|Type|Description, example|Default|
|:--|:--|:--|:--|
+|`['platform_utils']['grub_default']`|Hash|GRUB2 configurations. This settings are expanded to the `/etc/default/grub.d/override.cfg`.|`{}`|
|`['platform_utils']['kernel_modules']['loaded_modules']`|Array|Loaded extra kernel module names.|`[]`|
|`['platform_utils']['mount']['autopilot']`|Hash|mount autopilot configurations.|See `attributes/default.rb`|
|`['platform_utils']['networking']['autopilot']`|Hash|networking autopilot configurations.|See `attributes/default.rb`|
This recipe does nothing.
+#### platform_utils::grub_default
+
+This recipe adds GRUB2 extra configurations.
+
#### platform_utils::crond (ver. 0.4.0 or later)
This recipe installs cron package and enables & starts the service.
'.foodcritic',
'.rubocop.yml',
'Berksfile',
+ 'chefignore',
'concourse.yml',
'fly-vars.yml',
'fly-vars.local.yml',
[
'Rakefile',
+ 'chefignore',
'concourse.yml',
'fly-vars.yml',
'Gemfile',
# Cookbook Name:: platform_utils
# Attributes:: default
#
-# Copyright 2016-2017, whitestar
+# Copyright 2016-2018, whitestar
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
default['platform_utils']['kernel_modules']['loaded_modules'] = []
+default['platform_utils']['grub_default'] = {
+ #'ENV_VAR_NAME' => 'value',
+ #'GRUB_TIMEOUT_STYLE' => 'menu',
+ #'GRUB_TIMEOUT' => '5',
+ #'GRUB_CMDLINE_LINUX_DEFAULT' => '""',
+}
+
default['platform_utils']['mount']['autopilot'] = {
# for delayed hotplug devices (e.g. usb)
'enabled' => false,
--- /dev/null
+# Put files/directories that should be ignored in this file.
+# Lines that start with '# ' are comments.
+
+Berksfile.lock
+
+# concourse
+concourse.yml
+fly-vars.yml
+fly-vars.local.yml
+
+# emacs
+*~
+
+.rubocop_todo.yml
+
+# vim
+*.sw[a-z]
+
+# subversion
+*/.svn/*
--- /dev/null
+#
+# Cookbook Name:: platform_utils
+# Recipe:: grub_default
+#
+# Copyright 2018, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+unless File.exist?('/boot/grub/grub.cfg')
+ Chef::Log.warn('recipe[platform_utils::grub_default] GRUB 2 is not installed yet.')
+ return
+end
+
+execute 'update-grub2' do
+ user 'root'
+ command 'update-grub2'
+ action :nothing
+ only_if 'update-grub2 --version'
+end
+
+dir = '/etc/default/grub.d'
+resources(directory: dir) rescue directory dir do
+ owner 'root'
+ group 'root'
+ mode '0755'
+end
+
+template '/etc/default/grub.d/override.cfg' do
+ source 'etc/default/grub.d/override.cfg'
+ owner 'root'
+ group 'root'
+ mode '0644'
+ notifies :run, 'execute[update-grub2]'
+end
--- /dev/null
+<%
+node['platform_utils']['grub_default'].each {|key, value|
+-%>
+<%= key %>=<%= value %>
+<%
+}
+-%>
\ No newline at end of file