从厨师开始,很难获得角色/环境设置。无法弄清楚我错过了什么。
Cookbooks: nginx_webserver
recipes: default.rb, config_test, config_dev
Roles:
webserver
Environment:
dev, qa
这是我的角色档案:
chef_type: role
default_attributes:
description: Nginx webserver
env_run_lists:
dev: recipe[nginx_webserver::config_dev]
qa: recipe[nginx_webserver::config_qa]
json_class: Chef::Role
name: webserver
override_attributes:
run_list: recipe[nginx_webserver]
这是我的环境列表
chef_type: environment
cookbook_versions:
nginx_webserver: = 0.1.2
default_attributes:
description: development environment
json_class: Chef::Environment
name: dev
override_attributes:
nginx:
site_dir: dev.mysite.com # This value changes between envs
这是我的node_list:
{
"name": "chef-node1",
"chef_environment": "dev",
"normal": {
"tags": [
]
},
"policy_name": null,
"policy_group": null,
"run_list": [
"role[webserver]"
]
}
我的厨师 - 客户输出/错误:
54.149.131.42 Recipe Compile Error
54.149.131.42
====================================================================
54.149.131.42
54.149.131.42 Chef::Exceptions::RecipeNotFound
54.149.131.42 --------------------------------
54.149.131.42 could not find recipe config_dev for cookbook
nginx_webserver
54.149.131.42
我不确定如何在Chef服务器上获取config_dev和config_qa配方。我已将两者都包括在我的default.rb配方中,但我仍然遇到此错误。我的目标是在其开发环境时调用confg_dev recipe,在其qa时调用config_qa。请指点
编辑:1
来自cookbook show命令的输出
name:nginx_webserver-0.1.2 供应商: 食谱: 校验和:23978bdef70ea9a852e27d9489acdda1 name:default.rb path:recipes / default.rb 特异性:默认 网址:https://s3-external-1.amazonaws.com:443/opscode-platform-production-data/organization-0ffe55465085b0ed5ec6cc4dc383888e/checksum-23978bdef70ea9a852e27d9489acdda1?AWSAccessKeyId=AKIAIQKPG2CTSTRVDO4Q&Expires=1477168767&Signature=8EUWtT1RJq1S6/N0nF00XV879fg%3D 资源: root_files: 校验和:d5324dd6a872900fd6ee12c9628d9595 name:README.md 路径:README.md 特异性:默认 网址:https://s3-external-1.amazonaws.com:443/opscode-platform-production-data/organization-0ffe55465085b0ed5ec6cc4dc383888e/checksum-d5324dd6a872900fd6ee12c9628d9595?AWSAccessKeyId=AKIAIQKPG2CTSTRVDO4Q&Expires=1477168767&Signature=KuzF07t3/Xnw3BA30PkcNbsnQf0%3D
校验和:d14d45c195dccbfe56b358b71d2a6a6b 姓名:chefignore 路径:chefignore 特异性:默认 网址:https://s3-external-1.amazonaws.com:443/opscode-platform-production-data/organization-0ffe55465085b0ed5ec6cc4dc383888e/checksum-d14d45c195dccbfe56b358b71d2a6a6b?AWSAccessKeyId=AKIAIQKPG2CTSTRVDO4Q&Expires=1477168767&Signature=8nlPR7LBWOQbn6C7CfCaNTieaqM%3D
校验和:6528f8499102744b7616913a6cb225de 名称:Berksfile 路径:Berksfile 特异性:默认 网址:https://s3-external-1.amazonaws.com:443/opscode-platform-production-data/organization-0ffe55465085b0ed5ec6cc4dc383888e/checksum-6528f8499102744b7616913a6cb225de?AWSAccessKeyId=AKIAIQKPG2CTSTRVDO4Q&Expires=1477168767&Signature=0KRkWnrxasYQFhKaM0Kdqh79ltk%3D
编辑 - 2:
食谱/ default.rb
include_recipe 'selinux::permissive'
include_recipe 'nginx_webserver::config_dev'
include_recipe 'nginx_webserver::config_qa'
将metadata.rb更新为= 0.1.3
knife cookbook upload nginx_webserver
Uploading nginx_webserver [0.1.3]
Uploaded 1 cookbook.
获得相同的错误。另外,我真的需要在default.rb中包含我的config_dev和config_qa吗?不应该根据env_run_lists自动提取这些食谱吗?
答案 0 :(得分:0)
您的环境使用的是没有配方的版本(假设您根据日志在0.1.3
上传了它们):
chef_type: environment
cookbook_versions:
nginx_webserver: = 0.1.2
请使用knife environment edit
,将0.1.3
放在那里并尝试再次聚合节点。