Grid環境構築用のChefリポジトリです。
Revisión | aa66efbd549cbe710dd49fe3a71ba0c16ddc72b8 (tree) |
---|---|
Tiempo | 2017-01-29 17:31:46 |
Autor | whitestar <whitestar@gaea...> |
Commiter | whitestar |
adds the platform_utils::sysctl recipe.
@@ -1,10 +1,14 @@ | ||
1 | 1 | platform_utils CHANGELOG |
2 | 2 | ======================== |
3 | 3 | |
4 | +0.4.3 | |
5 | +----- | |
6 | +- adds the `platform_utils::sysctl` recipe. | |
7 | + | |
4 | 8 | 0.4.2 |
5 | 9 | ----- |
6 | -- adds the `PlatformUtils::kernel_modules` recipe. | |
7 | -- adds the `PlatformUtils::kernel_user_namespace` recipe. | |
10 | +- adds the `platform_utils::kernel_modules` recipe. | |
11 | +- adds the `platform_utils::kernel_user_namespace` recipe. | |
8 | 12 | |
9 | 13 | 0.4.1 |
10 | 14 | ----- |
@@ -6,21 +6,22 @@ This cookbook provides platform utility recipes. | ||
6 | 6 | ## Contents |
7 | 7 | |
8 | 8 | - [Requirements](#requirements) |
9 | - - [Platforms](#platforms) | |
10 | - - [Packages](#packages) | |
11 | - - [Cookbooks](#cookbooks) | |
9 | + - [Platforms](#platforms) | |
10 | + - [Packages](#packages) | |
11 | + - [Cookbooks](#cookbooks) | |
12 | 12 | - [Attributes](#attributes) |
13 | 13 | - [Usage](#usage) |
14 | - - [Recipes](#recipes) | |
15 | - - [platform_utils::default](#platform_utilsdefault) | |
16 | - - [platform_utils::crond (ver. 0.4.0 or later)](#platform_utilscrond-ver-040-or-later) | |
17 | - - [platform_utils::kernel_modules (ver. 0.4.2 or later)](#platform_utilskernel_modules-ver-042-or-later) | |
18 | - - [platform_utils::kernel_user_namespace (ver. 0.4.2 or later)](#platform_utilskernel_user_namespace-ver-042-or-later) | |
19 | - - [platform_utils::ntpd (ver. 0.4.0 or later)](#platform_utilsntpd-ver-040-or-later) | |
20 | - - [platform_utils::platform_update](#platform_utilsplatform_update) | |
21 | - - [platform_utils::subid](#platform_utilssubid) | |
22 | - - [platform_utils::sudo](#platform_utilssudo) | |
23 | - - [platform_utils::tcp_wrappers (ver. 0.4.0 or later)](#platform_utilstcp_wrappers-ver-040-or-later) | |
14 | + - [Recipes](#recipes) | |
15 | + - [platform_utils::default](#platform_utilsdefault) | |
16 | + - [platform_utils::crond (ver. 0.4.0 or later)](#platform_utilscrond-ver-040-or-later) | |
17 | + - [platform_utils::kernel_modules (ver. 0.4.2 or later)](#platform_utilskernel_modules-ver-042-or-later) | |
18 | + - [platform_utils::kernel_user_namespace (ver. 0.4.2 or later)](#platform_utilskernel_user_namespace-ver-042-or-later) | |
19 | + - [platform_utils::ntpd (ver. 0.4.0 or later)](#platform_utilsntpd-ver-040-or-later) | |
20 | + - [platform_utils::platform_update](#platform_utilsplatform_update) | |
21 | + - [platform_utils::subid](#platform_utilssubid) | |
22 | + - [platform_utils::sudo](#platform_utilssudo) | |
23 | + - [platform_utils::sysctl (ver. 0.4.3 or later)](#platform_utilssysctl-ver-043-or-later) | |
24 | + - [platform_utils::tcp_wrappers (ver. 0.4.0 or later)](#platform_utilstcp_wrappers-ver-040-or-later) | |
24 | 25 | - [License and Authors](#license-and-authors) |
25 | 26 | |
26 | 27 | ## Requirements |
@@ -48,6 +49,7 @@ This cookbook provides platform utility recipes. | ||
48 | 49 | |`['platform_utils']['subid']['notifies']`|Array, Hash|Notifies by the subordinate user/group file update.|`[]`, See `attributes/default.rb`| |
49 | 50 | |`['platform_utils']['sudo']['sudoers.d']`|Hash|sudoers file configurations.|`{}` See `attributes/default.rb`| |
50 | 51 | |`['platform_utils']['sudo']['group']['members']`|Array|Members appended to the `sudo` group.|`[]`| |
52 | +|`['platform_utils']['sysctl']['configs']`|Hash|sysctl configurations. (ver. 0.4.3 or later)|`{}`, See `attributes/default.rb`| | |
51 | 53 | |`['platform_utils']['tcp_wrappers']['host_allow']`|Array|Entries in `/etc/hosts.allow` (ver. 0.4.0 or later)|`[]`| |
52 | 54 | |`['platform_utils']['tcp_wrappers']['host_deny']`|Array|Entries in `/etc/hosts.deny` (ver. 0.4.0 or later)|`[]`| |
53 | 55 |
@@ -87,6 +89,10 @@ This recipe sets up the `/etc/subuid` and the `/etc/subgid`. | ||
87 | 89 | |
88 | 90 | This recipe sets up sudo. |
89 | 91 | |
92 | +#### platform_utils::sysctl (ver. 0.4.3 or later) | |
93 | + | |
94 | +This recipe sets up sysctl (Kernel parameters). | |
95 | + | |
90 | 96 | #### platform_utils::tcp_wrappers (ver. 0.4.0 or later) |
91 | 97 | |
92 | 98 | This recipe sets up hosts.allow and hosts.deny. |
@@ -64,5 +64,19 @@ default['platform_utils']['sudo']['sudoers.d'] = { | ||
64 | 64 | } |
65 | 65 | default['platform_utils']['sudo']['group']['members'] = [] |
66 | 66 | |
67 | +default['platform_utils']['sysctl']['configs'] = { | |
68 | +=begin | |
69 | + '80-by_chef' => { | |
70 | + 'action' => :create, | |
71 | + 'params' => { | |
72 | + 'key' => 'value', | |
73 | + }, | |
74 | + }, | |
75 | + '88-unwanted' => { | |
76 | + 'action' => :delete, | |
77 | + }, | |
78 | +=end | |
79 | +} | |
80 | + | |
67 | 81 | default['platform_utils']['tcp_wrappers']['hosts_allow'] = [] |
68 | 82 | default['platform_utils']['tcp_wrappers']['hosts_deny'] = [] |
@@ -5,7 +5,7 @@ maintainer_email '' | ||
5 | 5 | license 'Apache 2.0' |
6 | 6 | description 'Platform Utilities' |
7 | 7 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) |
8 | -version '0.4.2' | |
8 | +version '0.4.3' | |
9 | 9 | source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git' |
10 | 10 | issues_url 'https://osdn.jp/projects/metasearch/ticket' |
11 | 11 |
@@ -0,0 +1,44 @@ | ||
1 | +# | |
2 | +# Cookbook Name:: platform_utils | |
3 | +# Recipe:: sysctl | |
4 | +# | |
5 | +# Copyright 2017, 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 | +unless container_guest_node? | |
23 | + node['platform_utils']['sysctl']['configs'].each {|file_name, conf| | |
24 | + file_path = "/etc/sysctl.d/#{file_name}.conf" | |
25 | + exec_name = "sysctl_-p_#{file_path}" | |
26 | + | |
27 | + resources(execute: exec_name) rescue execute exec_name do | |
28 | + command "sysctl -p #{file_path}" | |
29 | + action :nothing | |
30 | + end | |
31 | + | |
32 | + resources(template: file_path) rescue template file_path do | |
33 | + source 'etc/sysctl.d/template.conf' | |
34 | + owner 'root' | |
35 | + group 'root' | |
36 | + mode '0644' | |
37 | + variables( | |
38 | + params: conf['params'] | |
39 | + ) | |
40 | + action conf['action'].to_sym | |
41 | + notifies :run, "execute[#{exec_name}]", :immediately if conf['action'].to_sym == :create | |
42 | + end | |
43 | + } | |
44 | +end |
@@ -0,0 +1,3 @@ | ||
1 | +<% @params.each {|key, value| %> | |
2 | +<%= key %>=<%= value %> | |
3 | +<% } -%> |