Here are capistrano extensions to be used with master-chef
- Add
master-cap
to your Gemfile - Load
master-cap
in your Capfile:require 'master-cap'
- Choose a topology driver and load it
**
on :load, :load_topology_directory
** Create a subdirectory namedtopology
, and add your toplogy YAML files into - Enjoy :)
Example of a topology file: integ.yml
:topology:
:app:
:hostname: my_app_server.mydomain.net
:type: linux_chef
:roles:
- app_server
:db:
:hostname: db_server.mydomain.net
:type: linux_chef
:roles:
- db_server
:redis:
:hostname: redise.mydomain.net
:type: linux_chef
:roles:
- redis_server
:cap_override:
:my_specific_cap_param: 'toto'
:default_role_list:
- base
cap integ show
cap app-integ show
cap integ_db_server show
cap integ check
: try to connect on each nodes with sshcap integ ssh_cmd -s cmd=uname
: execuname
command on each nodes
If you use only master-chef (no custom repo with Chef recipes), you have nothing to do.
If you use a custom repo, please add following lines before requiring master-cap
set :git_repos_manager_class, 'SimpleGitReposManager'
set :git_repos, [
{
:url => "http://github.com/kitchenware/master-chef.git",
:ref => "aa597911b6d394dff27338c825aa966105cb6607",
},
{
:url => "[email protected]:xxxx/yyyy.git",
:local_path => "../yyyy",
}
]
Note:
:ref
is used to lock master-chef version:local_path
is used to runchef:local
cap integ chef
: run chef on all serverscap app-integ chef:local
: run chef on app server, using local recipes. Usefull for debugging.cap app-integ chef:generate_local_json
: generate thelocal.json
file using current topology.cap app-integ chef:stack
: output last chef stack tracecap integ chef:stack
: purge all master-chef git repos caches
Copyright 2012 Bertrand Paquet
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.