简体   繁体   English

Chef-Solo与Capistrano的集成

[英]Chef-solo integration with Capistrano

Is there an alternative to the capistrano-chef gem for chef-solo? 厨师独奏会不会有capistrano-chef宝石的替代品? Mostly, to avoid defining server information twice. 通常,避免两次定义服务器信息。

I found something fresh and hot on the topic: 我发现了有关该主题的新鲜话题:

Roundsman s夫

Gemfile: 宝石文件:

gem 'roundsman', :require => false

Capfile: 上限文件:

require 'roundsman/capistrano'

See readme for details. 有关详细信息,请参见自述文件。

I decided to write a ruby gem to parse the files in nodes/*.json and transform them to Capistrano-friendly addresses: 我决定编写一个ruby gem来解析nodes/*.json的文件,并将其转换为Capistrano友好的地址:

gem "Chef_Solo_Nodes" 宝石“ Chef_Solo_Nodes”

Then, in the cap deploy file: 然后,在cap部署文件中:

require "Chef_Solo_Nodes"
role :app, *Chef_Solo_IPs('app')
role :db, *Chef_Solo_IPs('db')

Which is equivalent to: 等效于:

role :app, "user@host:port", "xx.xx.xx.xx"
role :db, "xx.xx.xx.xx"

Each node/*.json file can optionally define attributes: 每个node/*.json文件都可以选择定义属性:

  • ipaddress IP地址
  • user (or login) 用户(或登录名)
  • port 港口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM