Chef infra 将配方操作动态分组在一起
我有一组相关的操作,我想在动态资源中进行分组。大概是这样的:Chef infra 将配方操作动态分组在一起,chef-infra,cookbook,Chef Infra,Cookbook,我有一组相关的操作,我想在动态资源中进行分组。大概是这样的: # ... somewhere inside my_cookbook/recipes/foo.rb resource "Initialize git repo inside /etc" do not_if { File.exists?('/etc/.git') } package "git" execute "git init" do cwd '/etc' end template "/etc/
# ... somewhere inside my_cookbook/recipes/foo.rb
resource "Initialize git repo inside /etc" do
not_if { File.exists?('/etc/.git') }
package "git"
execute "git init" do
cwd '/etc'
end
template "/etc/.gitignore" do
# ...
end
bash "initial commit" do
# ...
end
end
基本上,我需要一种快速的方法来将一组操作组合在一起,包括:
卫兵不喜欢你
发送通知
在客户端运行日志上获取额外缩进
使这些块内的日志输出静音或仅更改级别
LWRP不够轻,因为我不想为一块只需要一次的代码创建两个文件集,即资源和提供者,而是表示我希望在我的食谱中使用的模式
我可以为此编写自己的助手,但我想知道是否已经有类似的东西可用。LWRP确实就是这样做的。您可以自己实现其中的一些部分,但格式化程序/日志将非常棘手。因此,似乎没有办法解决这个问题。对我来说,LWRP仍然不是那么轻。看起来像是我的食谱文件夹,在各个方向都有爆炸,包括深度