Chef: Why are resources in an “include_recipe” step being skipped?

ぐ巨炮叔叔 提交于 2019-12-02 17:33:01
Steve Bennett

It turns out this is a pretty normal (but under-documented) part of how Chef works: it compiles everything, and then starts running. Except some recipes (like Postgres) jump the queue to actually install at compile-time, using code like this:

  action :nothing
end.run_action(:run)

The solution is that anything that needs to run before Postgres also needs to do this. Fortunately, newer versions of Build-essentials allow this. You set attributes on a role as follows:

name "myapp"
run_list(
  "recipe[build-essential]",
  "recipe[myapp]"
)
default_attributes(
  "build_essential" => {
    "compiletime" => true
  }
)

if writing a cookbook, add the attribute to your attributes file:

node.default['build_essential']['compiletime'] = true

Thanks to Colin above.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!