厨师 'include_recipe ' 是否可以附加食谱版本?
Is it possible with chef 'include_recipe ' to append cookbook version?
我知道当我们运行像
这样的食谱时我们可以包括版本
chef-client -o "recipe[mycookbook@0.1.1]"
如何在做include_recipe
时附加版本
include_recipe "apache2::mod_ssl"@version?
在 Chef Recipe DSL 中使用 include_recipe
是不可能的。您提供特定版本的选项正在使用:
- 角色或节点上的运行列表,例如
"recipe[mycookbook@0.1.1]"
固定食谱的环境,例如:
cookbook_versions({
"nginx" => "<= 1.1.0",
"apt" => "= 0.0.1"
})
- 食谱中的 metadata.rb 文件,例如
depends 'apt', '1.2.3'
.
既然您想从食谱中固定一个版本,为什么不在 metadata.rb
中声明它呢?这将对您正在使用的 include_recipe
语句产生直接影响,强制包含使用元数据中声明的版本。
在您的示例中,这将是:
depends 'mycookbook, '0.1.1'
或者使用 apache 示例,在您的 metadata.rb
文件中:
depends 'apache2', 'version'
然后在你的食谱中:
include_recipe "apache2::mod_ssl"
我知道当我们运行像
这样的食谱时我们可以包括版本 chef-client -o "recipe[mycookbook@0.1.1]"
如何在做include_recipe
时附加版本 include_recipe "apache2::mod_ssl"@version?
在 Chef Recipe DSL 中使用 include_recipe
是不可能的。您提供特定版本的选项正在使用:
- 角色或节点上的运行列表,例如
"recipe[mycookbook@0.1.1]"
固定食谱的环境,例如:
cookbook_versions({ "nginx" => "<= 1.1.0", "apt" => "= 0.0.1" })
- 食谱中的 metadata.rb 文件,例如
depends 'apt', '1.2.3'
.
既然您想从食谱中固定一个版本,为什么不在 metadata.rb
中声明它呢?这将对您正在使用的 include_recipe
语句产生直接影响,强制包含使用元数据中声明的版本。
在您的示例中,这将是:
depends 'mycookbook, '0.1.1'
或者使用 apache 示例,在您的 metadata.rb
文件中:
depends 'apache2', 'version'
然后在你的食谱中:
include_recipe "apache2::mod_ssl"