• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: コミット

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


コミットメタ情報

リビジョンb94203905ea2e8a7c7c070932740dd7aa9d332db (tree)
日時2018-09-16 18:21:34
作者whitestar <whitestar@user...>
コミッターwhitestar

ログメッセージ

adds platform_utils::rc_local recipe.

変更サマリ

差分

--- /dev/null
+++ b/cookbooks/platform_utils/Berksfile
@@ -0,0 +1,19 @@
1+#
2+# Copyright 2018 whitestar
3+#
4+# Licensed under the Apache License, Version 2.0 (the "License");
5+# you may not use this file except in compliance with the License.
6+# You may obtain a copy of the License at
7+#
8+# http://www.apache.org/licenses/LICENSE-2.0
9+#
10+# Unless required by applicable law or agreed to in writing, software
11+# distributed under the License is distributed on an "AS IS" BASIS,
12+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+# See the License for the specific language governing permissions and
14+# limitations under the License.
15+#
16+
17+source 'https://supermarket.chef.io'
18+
19+metadata
--- a/cookbooks/platform_utils/CHANGELOG.md
+++ b/cookbooks/platform_utils/CHANGELOG.md
@@ -1,6 +1,10 @@
11 platform_utils CHANGELOG
22 ========================
33
4+0.6.0
5+-----
6+- adds the `platform_utils::rc_local` recipe.
7+
48 0.5.0
59 -----
610 - adds the `platform_utils::pip` recipe.
--- /dev/null
+++ b/cookbooks/platform_utils/Gemfile.lock
@@ -0,0 +1,22 @@
1+GEM
2+ remote: https://rubygems.org/
3+ specs:
4+ chef-api (0.8.0)
5+ logify (~> 0.1)
6+ mime-types
7+ logify (0.2.0)
8+ mime-types (3.2.2)
9+ mime-types-data (~> 3.2015)
10+ mime-types-data (3.2018.0812)
11+ stove (6.0.0)
12+ chef-api (~> 0.5)
13+ logify (~> 0.2)
14+
15+PLATFORMS
16+ ruby
17+
18+DEPENDENCIES
19+ stove
20+
21+BUNDLED WITH
22+ 1.16.0
--- a/cookbooks/platform_utils/README.md
+++ b/cookbooks/platform_utils/README.md
@@ -19,6 +19,7 @@ This cookbook provides platform utility recipes.
1919 - [platform_utils::ntpd (ver. 0.4.0 or later)](#platform_utilsntpd-ver-040-or-later)
2020 - [platform_utils::pip (ver. 0.5.0 or later)](#platform_utilspip-ver-050-or-later)
2121 - [platform_utils::platform_update](#platform_utilsplatform_update)
22+ - [platform_utils::rc_local (ver. 0.6.0 or later)](#platform_utilsrc_local-ver-060-or-later)
2223 - [platform_utils::subid](#platform_utilssubid)
2324 - [platform_utils::sudo](#platform_utilssudo)
2425 - [platform_utils::sysctl (ver. 0.4.3 or later)](#platform_utilssysctl-ver-043-or-later)
@@ -46,6 +47,7 @@ This cookbook provides platform utility recipes.
4647 |`['platform_utils']['platform_update']['timer']`|Symbol|update execution timing.|`:delayed`|
4748 |`['platform_utils']['platform_update']['apt-get']['command']`|String|apt-get upgrade/dist-upgrade command string.|`'apt-get upgrade -y'`|
4849 |`['platform_utils']['platform_update']['yum']['command']`|String|yum update command string.|`'yum update -y'`|
50+|`['platform_utils']['rc_local']`|Array|`/etc/rc.local` lines.|`[]`|
4951 |`['platform_utils']['subid']['users']`|Array|Subordinate user (=group) names.|`[]`|
5052 |`['platform_utils']['subid']['notifies']`|Array, Hash|Notifies by the subordinate user/group file update.|`[]`, See `attributes/default.rb`|
5153 |`['platform_utils']['sudo']['sudoers.d']`|Hash|sudoers file configurations.|`{}` See `attributes/default.rb`|
@@ -86,6 +88,10 @@ This recipe installs pip.
8688
8789 This recipe updates the platform.
8890
91+#### platform_utils::rc_local (ver. 0.6.0 or later)
92+
93+This recipe deploys the `/etc/rc.local`.
94+
8995 #### platform_utils::subid
9096
9197 This recipe sets up the `/etc/subuid` and the `/etc/subgid`.
@@ -107,7 +113,7 @@ This recipe sets up hosts.allow and hosts.deny.
107113 - Author:: whitestar at osdn.jp
108114
109115 ```text
110-Copyright 2016-2017, whitestar
116+Copyright 2016-2018, whitestar
111117
112118 Licensed under the Apache License, Version 2.0 (the "License");
113119 you may not use this file except in compliance with the License.
--- a/cookbooks/platform_utils/Rakefile
+++ b/cookbooks/platform_utils/Rakefile
@@ -3,6 +3,58 @@ require 'rubocop/rake_task'
33 require 'foodcritic'
44 require 'stove/rake_task'
55
6+tpl_cookbook = '00cookbook'
7+cookbook_name = File.basename(Dir.pwd)
8+
9+desc 'Initialize project'
10+task :init do
11+ next if cookbook_name == tpl_cookbook
12+
13+ [
14+ '.foodcritic',
15+ '.rubocop.yml',
16+ 'Berksfile',
17+ 'concourse.yml',
18+ 'fly-vars.yml',
19+ 'fly-vars.local.yml',
20+ 'Gemfile',
21+ 'Gemfile.lock',
22+ 'version',
23+ ].each {|conf|
24+ sh "cp ../#{tpl_cookbook}/#{conf} ./" unless File.exist?(conf)
25+ }
26+
27+ ruby [
28+ %(-pne '$_.gsub!(/^cookbook-name: .*$/, "cookbook-name: #{cookbook_name}")'),
29+ '-i fly-vars.local.yml',
30+ ].join(' ')
31+end
32+
33+desc 'Update project'
34+task :update do
35+ next if cookbook_name == tpl_cookbook
36+
37+ [
38+ 'Rakefile',
39+ 'concourse.yml',
40+ 'fly-vars.yml',
41+ 'Gemfile',
42+ 'Gemfile.lock',
43+ ].each {|conf|
44+ sh "cp ../#{tpl_cookbook}/#{conf} ./"
45+ }
46+end
47+
48+desc 'fly set-pipeline'
49+task :'set-pipeline' do
50+ sh [
51+ "fly -t $CC_TARGET sp -p #{cookbook_name}-cookbook -c concourse.yml",
52+ '-l fly-vars.yml -l fly-vars.local.yml -l ~/sec/credentials-prod.yml',
53+ ].join(' ')
54+end
55+desc 'rake set-pipeline alias'
56+task sp: 'set-pipeline'
57+
658 namespace :style do
759 desc 'Run Ruby style checks'
860 RuboCop::RakeTask.new(:ruby) do |t|
--- a/cookbooks/platform_utils/attributes/default.rb
+++ b/cookbooks/platform_utils/attributes/default.rb
@@ -24,6 +24,8 @@ default['platform_utils']['platform_update']['timer'] = :delayed
2424 default['platform_utils']['platform_update']['apt-get']['command'] = 'apt-get upgrade -y'
2525 default['platform_utils']['platform_update']['yum']['command'] = 'yum update -y'
2626
27+default['platform_utils']['rc_local'] = []
28+
2729 default['platform_utils']['subid']['users'] = []
2830 default['platform_utils']['subid']['notifies'] = [
2931 =begin
--- a/cookbooks/platform_utils/concourse.yml
+++ b/cookbooks/platform_utils/concourse.yml
@@ -1,5 +1,4 @@
11 ---
2-# $ fly -t $CC_TARGET sp -p platform_utils-cookbook -c concourse.yml -l fly-vars.yml -l ~/sec/credentials-prod.yml
32 resources:
43 - name: src-git
54 type: git
@@ -59,6 +58,7 @@ jobs:
5958 - -c
6059 - |
6160 cd ./src-git/cookbooks/((cookbook-name))
61+ bundle config --local silence_root_warning 1
6262 bundle install
6363 rake
6464 - name: publish-cookbook
@@ -89,6 +89,7 @@ jobs:
8989 echo '{"username":"((chef-username))","key":"/root/chef-client-key.pem"}' > /root/.stove
9090 echo "$chef_client_key" > /root/chef-client-key.pem
9191 cd ./src-git/cookbooks/((cookbook-name))
92+ bundle config --local silence_root_warning 1
9293 bundle install
9394 rake publish
9495 - put: src-git
--- /dev/null
+++ b/cookbooks/platform_utils/fly-vars.local.yml
@@ -0,0 +1,2 @@
1+---
2+cookbook-name: platform_utils
--- a/cookbooks/platform_utils/fly-vars.yml
+++ b/cookbooks/platform_utils/fly-vars.yml
@@ -1,3 +1,2 @@
11 ---
2-cookbook-name: platform_utils
32 chefdk-version: 1.6.11
--- /dev/null
+++ b/cookbooks/platform_utils/recipes/rc_local.rb
@@ -0,0 +1,29 @@
1+#
2+# Cookbook Name:: platform_utils
3+# Recipe:: rc_local
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+[
21+ 'rc.local',
22+].each {|conf|
23+ template "/etc/#{conf}" do
24+ source "etc/#{conf}"
25+ owner 'root'
26+ group 'root'
27+ mode '0755'
28+ end
29+}
--- /dev/null
+++ b/cookbooks/platform_utils/templates/default/etc/rc.local
@@ -0,0 +1,22 @@
1+#!/bin/sh -e
2+#
3+# rc.local
4+#
5+# This script is executed at the end of each multiuser runlevel.
6+# Make sure that the script will "exit 0" on success or any other
7+# value on error.
8+#
9+# In order to enable or disable this script just change the execution
10+# bits.
11+#
12+# By default this script does nothing.
13+
14+<%
15+node['platform_utils']['rc_local'].each {|line|
16+-%>
17+<%= line %>
18+<%
19+}
20+-%>
21+
22+exit 0
--- a/cookbooks/platform_utils/version
+++ b/cookbooks/platform_utils/version
@@ -1 +1 @@
1-0.5.0
1+0.6.0
旧リポジトリブラウザで表示