gpt4 book ai didi

attributes - Chef 包括 Recipe 覆盖属性

转载 作者:行者123 更新时间:2023-12-02 23:19:02 24 4
gpt4 key购买 nike

当您在另一个配方中包含一个配方时,如何覆盖属性。

看起来包含配方使用了默认属性,而不是之前在 run_list 中运行时配方的属性。

最佳答案

当您创建包装器说明书时,通常会覆盖属性。

假设您有 my_web_server Recipe ,其 my_web_server/recipes/default.rb 如下所示:

include_recipe "apache2"

并且您想覆盖 apache2 说明书中的 default_site_enabled 属性。那么您的文件 my_web_server/attributes/default.rb 应如下所示:

override['apache']['default_site_enabled'] = true

并且不要忘记在 my_web_server/metadata.rb 中指定依赖项,例如:

depends "apache2"

关于attributes - Chef 包括 Recipe 覆盖属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15205407/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com