如何在厨师中运行具有依赖性的食谱? [英] How run cookbook with dependencies in chef?

查看:139
本文介绍了如何在厨师中运行具有依赖性的食谱?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将工作站配置为此步骤在入门(OS redhat 6.5)。我已经启动了一个节点。我修改了这样的食谱:

I have configured workstation up this step in get started (OS redhat 6.5). I have launched a node. I modified a cookbook like that:

myCookbook / metadata.rb

name             'myCookbook'
maintainer       'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
license          'All rights reserved'
description      'Installs/Configures myCookbook'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version          '0.1.0'

depends 'maven'

例如只有取决于'maven'字符串是在刀具食谱创建myCookbook 被执行后添加的。

E.g. only depends 'maven' string was added after knife cookbook create myCookbook was executed.

myCookbook / recipes / default.rb

maven 'spring-context' do
  group_id 'org.springframework'
  version  '4.0.4.RELEASE'
  dest     '/root/chef-repo/'
  repositories ['http://repo.maven.apache.org/maven2/']
end

然后我运行:

knife cookbook upload myCookbook

现在我正在尝试:

knife bootstrap 192.168.1.37 --ssh-user root --ssh-password '123456' --sudo --use-sudo-password --node-name node-with-maven-run --run-list 'recipe[myCookbook]'

获取:

ERROR: Cookbook myCookbook depends on cookbooks which are not currently
ERROR: being uploaded and cannot be found on the server.
ERROR: The missing cookbook(s) are: 'maven' version '>= 0.0.0'

如何从mtCookbook安装所有cookbook到厨师服务器取决于?

How install all cookbook to chef server from that mtCookbook depends?

推荐答案

请看这里

或者只需输入刀cookbook upload --help 它会显示以下行(和其他行):

Or just type knife cookbook upload --help and it will show you the following line (along others):

- 包括 - 依赖项还上传cookbook依赖项

所以刀库菜单上传myCookbook --include-dependencies 是您的回答

您还需要在工作站上安装 maven 食谱, knife cookbook site安装maven 或在本地 cookbook_path中以任何其他方式获得名为 maven 的目录包含一个食谱,其中 metatada.rb 文件作为键名称与v alue maven

You'll need to have the maven cookbook on your workstation too, by knife cookbook site install maven or any other way to have a directory called maven in your local cookbook_path containing a cookbook where the metatada.rb file as a key name with value maven

这篇关于如何在厨师中运行具有依赖性的食谱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆