• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: コミット

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


コミットメタ情報

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

ログメッセージ

fix service control.

変更サマリ

差分

--- a/cookbooks/samba-grid/.rubocop.yml
+++ b/cookbooks/samba-grid/.rubocop.yml
@@ -24,6 +24,8 @@ Style/RescueModifier:
2424 Enabled: false
2525 Style/SpaceBeforeFirstArg:
2626 Enabled: false
27+Style/SpaceInsideBlockBraces:
28+ Enabled: false
2729 Style/TrailingCommaInLiteral:
2830 EnforcedStyleForMultiline: consistent_comma
2931 Style/WordArray:
--- /dev/null
+++ b/cookbooks/samba-grid/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/samba-grid/CHANGELOG.md
+++ b/cookbooks/samba-grid/CHANGELOG.md
@@ -1,5 +1,9 @@
11 # samba-grid CHANGELOG
22
3+0.1.3
4+-----
5+- fix service control.
6+
37 0.1.2
48 -----
59 - adds the Debian 9 (stretch) support.
--- /dev/null
+++ b/cookbooks/samba-grid/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/samba-grid/Rakefile
+++ b/cookbooks/samba-grid/Rakefile
@@ -3,12 +3,56 @@ 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'
649 task :'set-pipeline' do
750 sh [
8- "fly -t $CC_TARGET sp -p #{File.basename(Dir.pwd)}-cookbook -c concourse.yml",
9- '-l fly-vars.yml -l ~/sec/credentials-prod.yml',
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',
1053 ].join(' ')
1154 end
55+desc 'rake set-pipeline alias'
1256 task sp: 'set-pipeline'
1357
1458 namespace :style do
--- a/cookbooks/samba-grid/concourse.yml
+++ b/cookbooks/samba-grid/concourse.yml
@@ -1,13 +1,15 @@
11 ---
2-# $ fly -t $CC_TARGET sp -p samba-grid-cookbook -c concourse.yml -l fly-vars.yml -l ~/credentials.yml
32 resources:
43 - name: src-git
54 type: git
65 source:
7- uri: git://git.osdn.net/gitroot/metasearch/grid-chef-repo.git
6+ uri: ((git-id-osdn))@git.osdn.net:/gitroot/metasearch/grid-chef-repo.git
87 branch: master
98 paths:
109 - cookbooks/((cookbook-name))
10+ private_key: ((git-private-key))
11+ git_user: ((git-user-osdn))
12+ #check_every: 1h # default: 1m
1113 - name: chefdk-cache
1214 type: docker-image
1315 source:
@@ -18,18 +20,24 @@ resources:
1820 ca_certs:
1921 - domain: ((registry-mirror-domain)) # e.g. registry.docker.example.com:5000
2022 cert: ((docker-reg-ca-cert))
23+ check_every: 6h # default: 1m
2124
2225 jobs:
23-- name: build-cookbook
26+- name: test-cookbook
2427 plan:
25- - get: src-git
26- trigger: true
27- - get: chefdk-cache
28+ - aggregate:
29+ - get: src-git
30+ params:
31+ depth: 5
32+ trigger: true
33+ - get: chefdk-cache
2834 - task: ci-build
2935 image: chefdk-cache
36+ params:
37+ http_proxy: ((http-proxy)) # e.g. http://proxy.example.com:3128
38+ #HTTP_PROXY: ((http-proxy))
3039 config:
3140 platform: linux
32-
3341 #image_resource:
3442 # type: docker-image
3543 # source:
@@ -40,10 +48,8 @@ jobs:
4048 #ca_certs:
4149 #- domain: ((registry-mirror-domain))
4250 # cert: ((docker-reg-ca-cert))
43-
4451 inputs:
4552 - name: src-git
46-
4753 run:
4854 #dir: ./src-git/cookbooks/((cookbook-name))
4955 #path: rake
@@ -55,3 +61,41 @@ jobs:
5561 bundle config --local silence_root_warning 1
5662 bundle install
5763 rake
64+- name: publish-cookbook
65+ plan:
66+ - aggregate:
67+ - get: src-git
68+ params:
69+ depth: 5
70+ trigger: false
71+ passed: [test-cookbook]
72+ - get: chefdk-cache
73+ passed: [test-cookbook]
74+ - task: publish
75+ image: chefdk-cache
76+ params:
77+ http_proxy: ((http-proxy))
78+ chef_username: ((chef-username))
79+ chef_client_key: ((chef-client-key))
80+ config:
81+ platform: linux
82+ inputs:
83+ - name: src-git
84+ run:
85+ path: /bin/bash
86+ args:
87+ - -c
88+ - |
89+ echo '{"username":"((chef-username))","key":"/root/chef-client-key.pem"}' > /root/.stove
90+ echo "$chef_client_key" > /root/chef-client-key.pem
91+ cd ./src-git/cookbooks/((cookbook-name))
92+ bundle config --local silence_root_warning 1
93+ bundle install
94+ rake publish
95+ - put: src-git
96+ params:
97+ repository: src-git
98+ tag_prefix: ((cookbook-name))-
99+ tag: src-git/cookbooks/((cookbook-name))/version
100+ only_tag: true
101+ annotate: src-git/cookbooks/((cookbook-name))/version
--- /dev/null
+++ b/cookbooks/samba-grid/fly-vars.local.yml
@@ -0,0 +1,2 @@
1+---
2+cookbook-name: samba-grid
--- a/cookbooks/samba-grid/fly-vars.yml
+++ b/cookbooks/samba-grid/fly-vars.yml
@@ -1,3 +1,2 @@
11 ---
2-cookbook-name: samba-grid
3-chefdk-version: 0.17.17
2+chefdk-version: 1.6.11
--- a/cookbooks/samba-grid/metadata.rb
+++ b/cookbooks/samba-grid/metadata.rb
@@ -5,11 +5,12 @@ maintainer_email ''
55 license 'Apache 2.0'
66 description 'Installs/Configures Samba'
77 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
8-version '0.1.2'
8+version IO.read(File.join(File.dirname(__FILE__), 'version')).chomp
99 source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
1010 issues_url 'https://osdn.jp/projects/metasearch/ticket'
1111
12-%w( debian ubuntu ).each do |os|
12+chef_version '>= 12'
13+%w(debian ubuntu).each do |os|
1314 supports os
1415 end
1516
--- a/cookbooks/samba-grid/recipes/server.rb
+++ b/cookbooks/samba-grid/recipes/server.rb
@@ -2,7 +2,7 @@
22 # Cookbook Name:: samba-grid
33 # Recipe:: server
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.
@@ -44,13 +44,13 @@ services = [
4444 'smbd',
4545 ]
4646 services.push('samba-ad-dc') if platform == 'debian' && platform_version < '9.0'
47-#'samba-ad-dc', # masked on latest Ubuntu.
48-#'samba', # masked on latest Debian and Ubuntu.
47+# Note: systemd services by default
48+# 'samba-ad-dc', # masked on latest Ubuntu.
49+# 'samba', # masked on latest Debian and Ubuntu.
4950
5051 services.each {|srv|
5152 service srv do
5253 action [:enable]
53- #action [:enable, :start]
5454 supports status: true, restart: true, reload: false
5555 end
5656 }
@@ -62,8 +62,8 @@ template '/etc/samba/smb.conf' do
6262 owner 'root'
6363 group 'root'
6464 mode '0644'
65- notifies :reload, 'service[nmbd]'
66- notifies :reload, 'service[smbd]'
67- notifies :reload, 'service[samba-ad-dc]' if platform == 'debian' && platform_version < '9.0'
65+ notifies :restart, 'service[nmbd]'
66+ notifies :restart, 'service[smbd]'
67+ notifies :restart, 'service[samba-ad-dc]' if platform == 'debian' && platform_version < '9.0'
6868 #notifies :reload, 'service[samba]'
6969 end
--- /dev/null
+++ b/cookbooks/samba-grid/version
@@ -0,0 +1 @@
1+0.1.3
旧リポジトリブラウザで表示