• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: Commit

Grid環境構築用のChefリポジトリです。


Commit MetaInfo

Revision7818e08de0025268431dbc648963f4f7c7534494 (tree)
Time2018-09-29 20:01:22
Authorwhitestar <whitestar@user...>
Commiterwhitestar

Log Message

adds the platform_utils::grub_default recipe.

Change Summary

Incremental Difference

--- a/cookbooks/platform_utils/CHANGELOG.md
+++ b/cookbooks/platform_utils/CHANGELOG.md
@@ -1,6 +1,10 @@
11 platform_utils CHANGELOG
22 ========================
33
4+0.8.0
5+-----
6+- adds the `platform_utils::grub_default` recipe.
7+
48 0.7.0
59 -----
610 - adds autopilot features.
--- a/cookbooks/platform_utils/README.md
+++ b/cookbooks/platform_utils/README.md
@@ -13,6 +13,7 @@ This cookbook provides platform utility recipes.
1313 - [Usage](#usage)
1414 - [Recipes](#recipes)
1515 - [platform_utils::default](#platform_utilsdefault)
16+ - [platform_utils::grub_default](#platform_utilsgrub_default)
1617 - [platform_utils::crond (ver. 0.4.0 or later)](#platform_utilscrond-ver-040-or-later)
1718 - [platform_utils::kernel_modules (ver. 0.4.2 or later)](#platform_utilskernel_modules-ver-042-or-later)
1819 - [platform_utils::kernel_user_namespace (ver. 0.4.2 or later)](#platform_utilskernel_user_namespace-ver-042-or-later)
@@ -42,6 +43,7 @@ This cookbook provides platform utility recipes.
4243
4344 |Key|Type|Description, example|Default|
4445 |:--|:--|:--|:--|
46+|`['platform_utils']['grub_default']`|Hash|GRUB2 configurations. This settings are expanded to the `/etc/default/grub.d/override.cfg`.|`{}`|
4547 |`['platform_utils']['kernel_modules']['loaded_modules']`|Array|Loaded extra kernel module names.|`[]`|
4648 |`['platform_utils']['mount']['autopilot']`|Hash|mount autopilot configurations.|See `attributes/default.rb`|
4749 |`['platform_utils']['networking']['autopilot']`|Hash|networking autopilot configurations.|See `attributes/default.rb`|
@@ -67,6 +69,10 @@ This cookbook provides platform utility recipes.
6769
6870 This recipe does nothing.
6971
72+#### platform_utils::grub_default
73+
74+This recipe adds GRUB2 extra configurations.
75+
7076 #### platform_utils::crond (ver. 0.4.0 or later)
7177
7278 This recipe installs cron package and enables & starts the service.
--- a/cookbooks/platform_utils/Rakefile
+++ b/cookbooks/platform_utils/Rakefile
@@ -14,6 +14,7 @@ task :init do
1414 '.foodcritic',
1515 '.rubocop.yml',
1616 'Berksfile',
17+ 'chefignore',
1718 'concourse.yml',
1819 'fly-vars.yml',
1920 'fly-vars.local.yml',
@@ -36,6 +37,7 @@ task :update do
3637
3738 [
3839 'Rakefile',
40+ 'chefignore',
3941 'concourse.yml',
4042 'fly-vars.yml',
4143 'Gemfile',
--- a/cookbooks/platform_utils/attributes/default.rb
+++ b/cookbooks/platform_utils/attributes/default.rb
@@ -2,7 +2,7 @@
22 # Cookbook Name:: platform_utils
33 # Attributes:: default
44 #
5-# Copyright 2016-2017, whitestar
5+# Copyright 2016-2018, whitestar
66 #
77 # Licensed under the Apache License, Version 2.0 (the "License");
88 # you may not use this file except in compliance with the License.
@@ -19,6 +19,13 @@
1919
2020 default['platform_utils']['kernel_modules']['loaded_modules'] = []
2121
22+default['platform_utils']['grub_default'] = {
23+ #'ENV_VAR_NAME' => 'value',
24+ #'GRUB_TIMEOUT_STYLE' => 'menu',
25+ #'GRUB_TIMEOUT' => '5',
26+ #'GRUB_CMDLINE_LINUX_DEFAULT' => '""',
27+}
28+
2229 default['platform_utils']['mount']['autopilot'] = {
2330 # for delayed hotplug devices (e.g. usb)
2431 'enabled' => false,
--- /dev/null
+++ b/cookbooks/platform_utils/chefignore
@@ -0,0 +1,20 @@
1+# Put files/directories that should be ignored in this file.
2+# Lines that start with '# ' are comments.
3+
4+Berksfile.lock
5+
6+# concourse
7+concourse.yml
8+fly-vars.yml
9+fly-vars.local.yml
10+
11+# emacs
12+*~
13+
14+.rubocop_todo.yml
15+
16+# vim
17+*.sw[a-z]
18+
19+# subversion
20+*/.svn/*
--- /dev/null
+++ b/cookbooks/platform_utils/recipes/grub_default.rb
@@ -0,0 +1,45 @@
1+#
2+# Cookbook Name:: platform_utils
3+# Recipe:: grub_default
4+#
5+# Copyright 2018, whitestar
6+#
7+# Licensed under the Apache License, Version 2.0 (the "License");
8+# you may not use this file except in compliance with the License.
9+# You may obtain a copy of the License at
10+#
11+# http://www.apache.org/licenses/LICENSE-2.0
12+#
13+# Unless required by applicable law or agreed to in writing, software
14+# distributed under the License is distributed on an "AS IS" BASIS,
15+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+# See the License for the specific language governing permissions and
17+# limitations under the License.
18+#
19+
20+unless File.exist?('/boot/grub/grub.cfg')
21+ Chef::Log.warn('recipe[platform_utils::grub_default] GRUB 2 is not installed yet.')
22+ return
23+end
24+
25+execute 'update-grub2' do
26+ user 'root'
27+ command 'update-grub2'
28+ action :nothing
29+ only_if 'update-grub2 --version'
30+end
31+
32+dir = '/etc/default/grub.d'
33+resources(directory: dir) rescue directory dir do
34+ owner 'root'
35+ group 'root'
36+ mode '0755'
37+end
38+
39+template '/etc/default/grub.d/override.cfg' do
40+ source 'etc/default/grub.d/override.cfg'
41+ owner 'root'
42+ group 'root'
43+ mode '0644'
44+ notifies :run, 'execute[update-grub2]'
45+end
--- /dev/null
+++ b/cookbooks/platform_utils/templates/default/etc/default/grub.d/override.cfg
@@ -0,0 +1,7 @@
1+<%
2+node['platform_utils']['grub_default'].each {|key, value|
3+-%>
4+<%= key %>=<%= value %>
5+<%
6+}
7+-%>
\ No newline at end of file
--- a/cookbooks/platform_utils/version
+++ b/cookbooks/platform_utils/version
@@ -1 +1 @@
1-0.7.0
1+0.8.0
Show on old repository browser