我有两本烹饪书“用户”和“nginx”。第一本cookbook为系统创建用户和文件夹,第二本cookbook为已创建目录的配置安装nginx。
在kitchen.yml文件中,我添加了“users:default”来运行列表:
---
driver:
name: vagrant
provisioner:
name: chef_solo
platforms:
- name: ubuntu-14.04
suites:
- name: default
run_list:
- recipe[users::default]
- recipe[nginx::default]
并在nginx :: default recipe中添加了include_recipe:
include_recipe "users::default"
但是当我运行“kitchen converge”时,它不包括“users :: default”:
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 8 resources
Recipe: nginx::default
* apt_package[curl] action install
- install version 7.35.0-1ubuntu2.6 of package curl
* apt_package[git-core] action install
- install version 1:1.9.1-1ubuntu0.3 of package git-core
* apt_package[nginx] action install
有什么问题?为什么我不能在另一本食谱中运行“users :: default”食谱?
答案 0 :(得分:1)
include_recipe
只运行一次给定的食谱,因此不能直接在运行列表中运行include_recipe
。它应该仍然显示在输出中,粘贴你的users/recipes/default.rb
?
答案 1 :(得分:1)
当我在berksfile中使用路径时,它就解决了:
source 'https://supermarket.chef.io'
metadata
cookbook "users", path: "../../cookbooks/users"
cookbook "swap", path: "../../cookbooks/swap"
这意味着,在给定路径中使用用户cookbook,而不是使用source url