草庐IT

idev-recipes

全部标签

ruby - 是否可以在不运行默认 Recipe 的情况下运行 Chef Recipe

我的nginxRecipe中有两个ChefRecipe。一个名为default.rb,另一个名为sites.rb。当我用运行网站Recipe时RUN_LIST=recipe[nginx::sites]bundleexeccapstagingchef:solo然后我的默认配方也会运行。我该如何防止这种情况发生? 最佳答案 删除行include_recipe"nginx"因为它包含默认配方(nginx::default) 关于ruby-是否可以在不运行默认Recipe的情况下运行ChefRe

ruby - Chef Recipe lwrp,使用 new_resource.updated_by_last_action(true) 的最简单方法

我正在为10号Chef编写LWRP。当该资源在其他配方中运行时,如果某些内容已更改,则应将其标记为“updated_by_last_action”。但如果一切都没有改变。updated_by_last_action应该是假的。例如,我有Chef文档http://docs.opscode.com/lwrp_custom_provider.html#updated-by-last-action.该示例将资源模板包装在一个变量中以测试它是否已更改,然后设置updated_by_last_action状态。所以我的代码应该是这样的f=filenew_resource.filenamedoxxx

ruby - 如何将值(value)从一种资源传递到 Chef Recipe 中的另一种资源?

我正在尝试更改一个资源中的属性,并想在另一个资源中使用更新后的值,但更新后的值没有反射(reflect)在另一个资源中。请帮助我代码node[:oracle][:asm][:disks].each_keydo|disk|Chef::Log.info("Iamin#{cookbook_name}::#{recipe_name}andcurrentdiskcount#{node[:oracle][:asm][:test]}")bash"beforeTest"docode我要更新的值是存储在node[:oracle][:asm][:test]的值 最佳答案

ruby - 创建/编辑 Vagrant base box 以预安装 Recipe

我的VM需要大约10分钟才能启动,因为它需要安装所有说明书。我正在寻找一种方法来编辑现有的(或创建一个新的)基本框,我可以在其中安装所有必需的说明书。因此,每次我启动VM时,说明书都已经安装好,我不必等待太久。这可能吗?如果是这样,有人能给我指出正确的方向吗?我目前使用的是Lucid32基础盒。 最佳答案 听起来你需要调整你的basebox,所以将你需要的所有东西都安装在一个vagrantbox中并将这个box导出为你的新basebox:vagranthalt;vagrantpackage;vagrantboxaddnew_base

ruby - Chef - 使用同一本 Recipe 中的 Recipe

我有Recipebase和Recipemyappbase有2个配方-my_java和java_with_custom_stuff在java_with_custom_stuff中,我想使用my_java的Recipe(相同的Recipe)。像include_recipe'my_java'bash'customstuff'do...end在myapp我做include_recipe"base::java_with_custom_stuff"但它提示找不到my_java有没有办法使用同一本Recipe中的Recipe? 最佳答案 incl

ruby - 如何在 ruby​​_block 中使用另一本 Chef Recipe 中的 Chef 助手库

AWSOpsworks:Chef11.10版,Berkshelf3.2.0版。我不知道如何在RecipeB的ruby_block中使用RecipeA中的帮助程序库。我找到了一个post讨论如何在ruby​​_block和another中包含一个方法讨论如何跨cooking书共享库,但我无法同时工作。cookbookA/libraries/helpers.rbmodulelibraryAmoduleHelpersdeflog(output)Chef::Log.info("#{cookbook_name}:#{recipe_name}:#output}")endendendcookbook

ruby - Chef Recipe 的执行顺序是什么

我正试图了解Chef,但我终其一生都找不到cooking书是如何运作的如果我有文件结构chef-repo├──cookbooks│  └──test│  ├──attributes│  │  ├──default.rb│  │  └──test.rb│  ├──files...│  ├──metadata.rb│  ├──recipes│  │  ├──default.rb│  │  └──test.rb│  └──templates...├──roles│  └──starter.rb└──Vagrantfile如何加载属性以及加载顺序?例如,它加载所有属性(default.rb和t

ruby - Chef 独奏 : Installing build-essential recipe before postgresql

我正在尝试使用chef-solo在我的服务器上安装postgresql。我通过自己进行引导并在脚本中手动包含build-esential包来完成这项工作。现在我想使用knife-solo来处理Bootstrap,但我在定义执行配方的顺序时遇到了问题。我想在postgresql之前安装build-essential包。这是我正在构建的服务器的json文件{"dbuser":"myuser","dbpass":"mypassword","postgresql":{"password":{"postgres":"mypassword"}},"passenger":{"version":"3.

ruby - gem 构建 "recipe for target ' stemmer.so' 失败”

当使用geminstalljekyll从gem安装Jekyll时,出现以下构建错误。我在Windows7上使用Cygwin,并在安装之前从源代码构建了posix-spawngem。Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingjekyll-1.1.2.gem:ERROR:Failedtobuildgemnativeextension./usr/bin/ruby.exeextconf.rbcreatingMakefilemakegcc-I.-I/usr/include/ruby-1.9.1/x86_

ruby - 让 Chef Recipe Recipe 只运行一次

所以我使用以下配方:include_recipe"build-essential"node_packages=value_for_platform(["debian","ubuntu"]=>{"default"=>["libssl-dev"]},["amazon","centos","fedora","centos"]=>{"default"=>["openssl-devel"]},"default"=>["libssl-dev"])node_packages.eachdo|node_package|packagenode_packagedoaction:installendendba