• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: 提交

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


Commit MetaInfo

修订版89e0deca5fe445d969a870840b22ca93f847037e (tree)
时间2018-10-08 22:35:33
作者whitestar <whitestar@user...>
Commiterwhitestar

Log Message

adds the platform_utils::wsl_conf recipe.

更改概述

差异

--- a/cookbooks/platform_utils/CHANGELOG.md
+++ b/cookbooks/platform_utils/CHANGELOG.md
@@ -1,6 +1,11 @@
11 platform_utils CHANGELOG
22 ========================
33
4+0.8.1
5+-----
6+- bug fix.
7+- adds the `platform_utils::wsl_conf` recipe.
8+
49 0.8.0
510 -----
611 - adds the `platform_utils::grub_default` recipe.
--- a/cookbooks/platform_utils/attributes/default.rb
+++ b/cookbooks/platform_utils/attributes/default.rb
@@ -111,3 +111,18 @@ default['platform_utils']['sysctl']['configs'] = {
111111
112112 default['platform_utils']['tcp_wrappers']['hosts_allow'] = []
113113 default['platform_utils']['tcp_wrappers']['hosts_deny'] = []
114+
115+default['platform_utils']['wsl_conf'] = {
116+=begin
117+ 'automount' => {
118+ 'enabled' => 'true',
119+ 'root' => '/mnt/',
120+ 'options' => '"metadata,umask=22,fmask=11"',
121+ 'mountFsTab' => 'true',
122+ },
123+ 'network' => {
124+ 'generateHosts' => 'true',
125+ 'generateResolvConf' => 'true',
126+ },
127+=end
128+}
--- a/cookbooks/platform_utils/libraries/virt_utils.rb
+++ b/cookbooks/platform_utils/libraries/virt_utils.rb
@@ -52,5 +52,9 @@ module PlatformUtils
5252 def container_guest_node?
5353 container_system? && guest_node?
5454 end
55+
56+ def wsl?
57+ node['os'] == 'linux' && node['os_version'].include?('Microsoft')
58+ end
5559 end
5660 end
--- a/cookbooks/platform_utils/recipes/grub_default.rb
+++ b/cookbooks/platform_utils/recipes/grub_default.rb
@@ -26,7 +26,7 @@ execute 'update-grub2' do
2626 user 'root'
2727 command 'update-grub2'
2828 action :nothing
29- only_if 'update-grub2 --version'
29+ only_if 'which update-grub2'
3030 end
3131
3232 dir = '/etc/default/grub.d'
--- a/cookbooks/platform_utils/recipes/kernel_user_namespace.rb
+++ b/cookbooks/platform_utils/recipes/kernel_user_namespace.rb
@@ -2,7 +2,7 @@
22 # Cookbook Name:: platform_utils
33 # Recipe:: kernel_user_namespace
44 #
5-# Copyright 2017, whitestar
5+# Copyright 2017-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,8 @@
1919
2020 ::Chef::Recipe.send(:include, PlatformUtils::VirtUtils)
2121
22+return if wsl?
23+
2224 reboot_msg = 'reboot_message'
2325 resources(log: reboot_msg) rescue log reboot_msg do
2426 message 'Please reboot this machine because of kernel boot option modified.'
--- a/cookbooks/platform_utils/recipes/ntpd.rb
+++ b/cookbooks/platform_utils/recipes/ntpd.rb
@@ -2,7 +2,7 @@
22 # Cookbook Name:: platform_utils
33 # Recipe:: ntpd
44 #
5-# Copyright 2017, whitestar
5+# Copyright 2017-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.
@@ -17,6 +17,10 @@
1717 # limitations under the License.
1818 #
1919
20+::Chef::Recipe.send(:include, PlatformUtils::VirtUtils)
21+
22+return if wsl?
23+
2024 pkg = 'ntp'
2125 resources(package: pkg) rescue package pkg do
2226 action :install
--- a/cookbooks/platform_utils/recipes/sysctl.rb
+++ b/cookbooks/platform_utils/recipes/sysctl.rb
@@ -2,7 +2,7 @@
22 # Cookbook Name:: platform_utils
33 # Recipe:: sysctl
44 #
5-# Copyright 2017, whitestar
5+# Copyright 2017-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,8 @@
1919
2020 ::Chef::Recipe.send(:include, PlatformUtils::VirtUtils)
2121
22+return if wsl?
23+
2224 unless container_guest_node?
2325 node['platform_utils']['sysctl']['configs'].each {|file_name, conf|
2426 file_path = "/etc/sysctl.d/#{file_name}.conf"
--- /dev/null
+++ b/cookbooks/platform_utils/recipes/wsl_conf.rb
@@ -0,0 +1,29 @@
1+#
2+# Cookbook Name:: platform_utils
3+# Recipe:: wsl_conf
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+::Chef::Recipe.send(:include, PlatformUtils::VirtUtils)
21+
22+return unless wsl?
23+
24+template '/etc/wsl.conf' do
25+ source 'etc/wsl.conf'
26+ owner 'root'
27+ group 'root'
28+ mode '0644'
29+end
--- /dev/null
+++ b/cookbooks/platform_utils/templates/default/etc/wsl.conf
@@ -0,0 +1,14 @@
1+# This file is generated by Chef
2+
3+<%
4+node['platform_utils']['wsl_conf'].each {|section, params|
5+-%>
6+[<%= section %>]
7+<%
8+ params.each {|key, value|
9+-%>
10+<%= key %> = <%= value %>
11+<%
12+ }
13+}
14+-%>
--- a/cookbooks/platform_utils/version
+++ b/cookbooks/platform_utils/version
@@ -1 +1 @@
1-0.8.0
1+0.8.1
Show on old repository browser