jjzjj

ruby - 在 template.erb 中设置 chef vault 变量

我的Recipe中有一个保险库项目定义如下item=ChefVault::Item.load("user","password")如何在我的template.erb中调用它?我尝试了以下不起作用ROOTPASSWORD=我的保险库项目如下所示:$knifevaultshowuserpasswordid:passwordpass:xxxxxxxxxxusername:chefuser我通常在Recipe中做这样的事情ROOTPASSWORD#{item['pass']}但是我认为这不适用于模板。 最佳答案 有两种方法可以解决该问题,但

ruby - Chef 执行 block

我是Chef的新手。我有一个安装sendmail的方法,它会执行我的配置。我注意到Chef会在每次运行时重新启动服务。那是因为我正在运行调用session重新启动的execute。看起来像这样:execute"hashAccess"docommand"makemaphash/etc/mail/access只有当access文件更新时,我才需要调用它。template"/etc/mail/access"dosource"access.erb"mode"0644"notifies:run,"execute[hashAccess]"end当文件更新时,execute被调用两次。这两种资源都在

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-on-rails - 如果我使用的是 Heroku,是否可以使用 Chef?

我使用Heroku来部署我的Rails应用。但我想过学习Chef来自动设置开发基础设施,但我不确定。那么简单来说,我有什么理由要学习Chef吗? 最佳答案 如果您使用的是Heroku,则没有必要。您稍后可能会部署到您自己的服务器,因此请研究一下;在这种情况下,Chef可能是一个不错的选择,也可以看看Capistrano。 关于ruby-on-rails-如果我使用的是Heroku,是否可以使用Chef?,我们在StackOverflow上找到一个类似的问题:

ruby Chef 指令 : include_attribute vs. include_attributes

我在chef属性文件中看到了这段代码。include_recipe"deployment"include_attribute"postgresql"include_attribute"redis"include_attributes"uaa"include_attributes"service_lifecycle"有什么不同?include_attribute与include_attribute*S*我找不到任何关于include_attribute*S*的文档 最佳答案 include_attribute属性用于对收敛时加载属性文

ruby - 属性上的 Chef 错误 - 字符串不匹配

我似乎无法解决处理我的attributes/default.rb文件中类似命名属性的chef错误。我有两个属性:default['test']['webservice']['https']['keyManagerPwd']='password'......default['test']['webservice']['https']['keyManagerPwd']['type']='encrypted'请注意,直到最后一个括号(['type']),名称是相同的。我在模板和配方的模板block中引用这些属性。当我去运行它时,我收到这个错误:========================

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 - Chef 独奏示例

我们正在学习chef-solo,需要一个很好的例子来更好地理解。在网上搜索了很多,但想法很困惑。任何人都可以建议一些例子..以及如何运行它们..我们已经安装了chef-0.8.16gem但无法弄清楚如何使用它..我们正在使用windows平台..它紧急.. 最佳答案 Windows平台支持非常新(version0.8.14),因此它在Windows上配置资源的能力相当有限,直到下一个版本将为该平台添加新的资源提供程序。ChefSolo的一个很好的资源是它的pageontheWiki.您还可以从IRCchannel获得帮助和maili

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 的 ruby​​_block 中调用 Chef 资源?

我正在尝试调用ruby​​_block中的Chef资源。谁能告诉我这段代码有什么问题?file'/tmp/arockia/storage.txt'doendlines=`cat/tmp/arockia/storage.txt|wc-l`ruby_block'Checkforcontent'doblockdolines=`cat/tmp/arockia/storage.txt|wc-l`ifInteger(lines)==0r=Chef::Resource::Execute.new('Get-Disk-Storage',run_context)r.command'df-kh>>/tmp/