--- /dev/null
+#
+# Copyright 2016 whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#grid_chef_repo = 'git://git.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
+
+# for ver. 3.x
+#source 'https://berks-api.io.example.com:6280'
+source 'https://supermarket.chef.io'
+
+metadata
+
commons CHANGELOG
=================
-This file is used to list changes made in each version of the commons cookbook.
+0.3.1
+-----
+- add some recipes.
+-- apt
+-- ntpd
+-- yum-epel
0.1.0
-----
-- [your_name] - Initial release of commons
-
-- - -
-Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
+- Initial release of commons
-The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
- `Commons::PackageUtils::get_libbz2_pkg_name`
#### recipes
+- `commons::apt` -
- `commons::crond` - installs cron package and enables & starts the service.
- `commons::httpd` - installs httpd package and enables & starts the service.
+- `commons::ntpd` - installs ntpd package and enables & starts the service.
- `commons::platform_update` - updates all packages for platform.
+- `commons::yum-epel` -
License and Authors
-------------------
- Author:: whitestar at osdn.jp
```text
-Copyright 2013-2015, whitestar
+Copyright 2013-2016, whitestar
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
license 'Apache 2.0'
description 'Installs/Configures commons'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version '0.3.0'
+version '0.3.1'
+
+%w{ debian ubuntu centos redhat fedora }.each do |os|
+ supports os
+end
+
+# local cookbooks
+
+# external cookbooks
+depends 'apt'
+depends 'yum', '>= 3.0'
+depends 'yum-epel'
--- /dev/null
+#
+# Cookbook Name:: commons
+# Recipe:: apt
+#
+# Copyright 2016, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+if node[:platform_family] == 'debian' then
+ # "If a recipe is included more than once in a recipe, only the first
+ # inclusion will be processed and any subsequent inclusion will be ignored."
+ # from http://docs.opscode.com/essentials_cookbook_recipes_in_recipes.html
+ include_recipe 'apt::default'
+end
+
--- /dev/null
+#
+# Cookbook Name:: commons
+# Recipe:: ntpd
+#
+# Copyright 2016, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+pkg = 'ntp'
+resources(:package => pkg) rescue package pkg do
+ action :install
+end
+
+serv = value_for_platform_family(
+ 'debian' => 'ntp',
+ 'rhel' => 'ntpd'
+)
+
+resources(:service => serv) rescue service serv do
+ action [:enable, :start]
+ supports :status => true, :restart => true, :reload => false
+end
+
--- /dev/null
+#
+# Cookbook Name:: node_commons
+# Recipe:: yum-epel
+#
+# Copyright 2016, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+if node[:platform_family] == 'rhel' then
+ # "If a recipe is included more than once in a recipe, only the first
+ # inclusion will be processed and any subsequent inclusion will be ignored."
+ # from http://docs.opscode.com/essentials_cookbook_recipes_in_recipes.html
+ include_recipe 'yum-epel::default'
+end
+
--- /dev/null
+#
+# Cookbook Name:: commons
+# Recipe Spec:: apt_spec
+#
+# Copyright 2016, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require_relative '../spec_helper'
+
+describe 'commons::apt' do
+ let(:chef_run_on_debian) {
+ ChefSpec::SoloRunner.new(platform: 'debian', version: '7.6').
+ converge(described_recipe)
+ }
+
+ it 'includes apt::default recipe.' do
+ expect(chef_run_on_debian).to include_recipe('apt::default')
+ end
+
+ let(:chef_run_on_rhel) {
+ ChefSpec::SoloRunner.new(platform: 'centos', version: '7.0').
+ converge(described_recipe)
+ }
+
+ it 'does not include apt::default recipe.' do
+ expect(chef_run_on_rhel).to_not include_recipe('apt::default')
+ end
+end
+
--- /dev/null
+#
+# Cookbook Name:: commons
+# Recipe Spec:: ntpd_spec
+#
+# Copyright 2016, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require_relative '../spec_helper'
+
+describe 'commons::ntpd' do
+ let(:chef_run_on_debian) {
+ ChefSpec::SoloRunner.new(platform: 'debian', version: '7.6').
+ converge(described_recipe)
+ }
+
+ it 'installs ntp package.' do
+ expect(chef_run_on_debian).to install_package('ntp')
+ end
+
+ it 'enables ntp service.' do
+ expect(chef_run_on_debian).to enable_service('ntp')
+ expect(chef_run_on_debian).to start_service('ntp')
+ end
+
+ let(:chef_run_on_rhel) {
+ ChefSpec::SoloRunner.new(platform: 'centos', version: '7.0').
+ converge(described_recipe)
+ }
+
+ it 'installs ntp package.' do
+ expect(chef_run_on_rhel).to install_package('ntp')
+ end
+
+ it 'enables ntpd service.' do
+ expect(chef_run_on_rhel).to enable_service('ntpd')
+ expect(chef_run_on_rhel).to start_service('ntpd')
+ end
+end
+
--- /dev/null
+#
+# Cookbook Name:: commons
+# Recipe Spec:: yum-epel_spec
+#
+# Copyright 2016, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require_relative '../spec_helper'
+
+describe 'commons::yum-epel' do
+ let(:chef_run_on_debian) {
+ ChefSpec::SoloRunner.new(platform: 'debian', version: '7.6').
+ converge(described_recipe)
+ }
+
+ it 'does not include yum-epel recipe.' do
+ expect(chef_run_on_debian).to_not include_recipe('yum-epel::default')
+ end
+
+ let(:chef_run_on_rhel) {
+ ChefSpec::SoloRunner.new(platform: 'centos', version: '7.0').
+ converge(described_recipe)
+ }
+
+ it 'includes yum-epel recipe.' do
+ expect(chef_run_on_rhel).to include_recipe('yum-epel::default')
+ end
+end
+
--- /dev/null
+#
+# Cookbook Name:: commons
+# Recipe Spec:: spec_helper
+#
+# Copyright 2016, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Added by ChefSpec
+require 'chefspec'
+
+# Uncomment to use ChefSpec's Berkshelf extension
+require 'chefspec/berkshelf'
+
+ChefSpec::Coverage.start!
+
+RSpec.configure do |config|
+ # Specify the path for Chef Solo to find cookbooks
+ #config.cookbook_path = "#{File.dirname(__FILE__)}/../../cookbooks"
+
+ # Specify the path for Chef Solo to find roles
+ # config.role_path = '/var/roles'
+
+ # Specify the Chef log_level (default: :warn)
+ # config.log_level = :debug
+
+ # Specify the path to a local JSON file with Ohai data
+ # config.path = 'ohai.json'
+
+ # Specify the operating platform to mock Ohai data from
+ # config.platform = 'ubuntu'
+
+ # Specify the operating version to mock Ohai data from
+ # config.version = '12.04'
+end
+
# CHANGELOG for node_commons
-This file is used to list changes made in each version of node_commons.
+## 0.1.1:
+
+* Deprecated release.
## 0.1.0:
* Initial release of node_commons
-- - -
-Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
-
-The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
node_commons Cookbook
=====================
+**DEPRECATED**: All features were moved to the `commons` cookbook.
+
This cookbook contains common role recipes for each node.
Requirements
- Author:: whitestar at osdn.jp
```text
-Copyright 2013-2015, whitestar
+Copyright 2013-2016, whitestar
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
description 'APT management tools. this role does nothing in other platforms than Debian.'
run_list(
- 'recipe[node_commons::apt]'
+ 'recipe[commons::apt]'
)
#env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
run_list(
'role[apt]',
'role[security_update]',
- 'recipe[node_commons]',
+ 'recipe[commons::ntpd]',
)
#env_run_lists()
run_list(
'recipe[yum]', # for loading default attributes.
- 'recipe[node_commons::yum-epel]'
+ 'recipe[commons::yum-epel]'
)
#env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []