Grid環境構築用のChefリポジトリです。
修订版 | 89e0deca5fe445d969a870840b22ca93f847037e (tree) |
---|---|
时间 | 2018-10-08 22:35:33 |
作者 | whitestar <whitestar@user...> |
Commiter | whitestar |
adds the platform_utils::wsl_conf recipe.
@@ -1,6 +1,11 @@ | ||
1 | 1 | platform_utils CHANGELOG |
2 | 2 | ======================== |
3 | 3 | |
4 | +0.8.1 | |
5 | +----- | |
6 | +- bug fix. | |
7 | +- adds the `platform_utils::wsl_conf` recipe. | |
8 | + | |
4 | 9 | 0.8.0 |
5 | 10 | ----- |
6 | 11 | - adds the `platform_utils::grub_default` recipe. |
@@ -111,3 +111,18 @@ default['platform_utils']['sysctl']['configs'] = { | ||
111 | 111 | |
112 | 112 | default['platform_utils']['tcp_wrappers']['hosts_allow'] = [] |
113 | 113 | 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 | +} |
@@ -52,5 +52,9 @@ module PlatformUtils | ||
52 | 52 | def container_guest_node? |
53 | 53 | container_system? && guest_node? |
54 | 54 | end |
55 | + | |
56 | + def wsl? | |
57 | + node['os'] == 'linux' && node['os_version'].include?('Microsoft') | |
58 | + end | |
55 | 59 | end |
56 | 60 | end |
@@ -26,7 +26,7 @@ execute 'update-grub2' do | ||
26 | 26 | user 'root' |
27 | 27 | command 'update-grub2' |
28 | 28 | action :nothing |
29 | - only_if 'update-grub2 --version' | |
29 | + only_if 'which update-grub2' | |
30 | 30 | end |
31 | 31 | |
32 | 32 | dir = '/etc/default/grub.d' |
@@ -2,7 +2,7 @@ | ||
2 | 2 | # Cookbook Name:: platform_utils |
3 | 3 | # Recipe:: kernel_user_namespace |
4 | 4 | # |
5 | -# Copyright 2017, whitestar | |
5 | +# Copyright 2017-2018, whitestar | |
6 | 6 | # |
7 | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
8 | 8 | # you may not use this file except in compliance with the License. |
@@ -19,6 +19,8 @@ | ||
19 | 19 | |
20 | 20 | ::Chef::Recipe.send(:include, PlatformUtils::VirtUtils) |
21 | 21 | |
22 | +return if wsl? | |
23 | + | |
22 | 24 | reboot_msg = 'reboot_message' |
23 | 25 | resources(log: reboot_msg) rescue log reboot_msg do |
24 | 26 | message 'Please reboot this machine because of kernel boot option modified.' |
@@ -2,7 +2,7 @@ | ||
2 | 2 | # Cookbook Name:: platform_utils |
3 | 3 | # Recipe:: ntpd |
4 | 4 | # |
5 | -# Copyright 2017, whitestar | |
5 | +# Copyright 2017-2018, whitestar | |
6 | 6 | # |
7 | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
8 | 8 | # you may not use this file except in compliance with the License. |
@@ -17,6 +17,10 @@ | ||
17 | 17 | # limitations under the License. |
18 | 18 | # |
19 | 19 | |
20 | +::Chef::Recipe.send(:include, PlatformUtils::VirtUtils) | |
21 | + | |
22 | +return if wsl? | |
23 | + | |
20 | 24 | pkg = 'ntp' |
21 | 25 | resources(package: pkg) rescue package pkg do |
22 | 26 | action :install |
@@ -2,7 +2,7 @@ | ||
2 | 2 | # Cookbook Name:: platform_utils |
3 | 3 | # Recipe:: sysctl |
4 | 4 | # |
5 | -# Copyright 2017, whitestar | |
5 | +# Copyright 2017-2018, whitestar | |
6 | 6 | # |
7 | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
8 | 8 | # you may not use this file except in compliance with the License. |
@@ -19,6 +19,8 @@ | ||
19 | 19 | |
20 | 20 | ::Chef::Recipe.send(:include, PlatformUtils::VirtUtils) |
21 | 21 | |
22 | +return if wsl? | |
23 | + | |
22 | 24 | unless container_guest_node? |
23 | 25 | node['platform_utils']['sysctl']['configs'].each {|file_name, conf| |
24 | 26 | file_path = "/etc/sysctl.d/#{file_name}.conf" |
@@ -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 |
@@ -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 | +-%> |
@@ -1 +1 @@ | ||
1 | -0.8.0 | |
1 | +0.8.1 |