chef

How do you create pretty json in CHEF (ruby)

倾然丶 夕夏残阳落幕 提交于 2019-12-03 07:37:29
How would you make an erb template that has human readable json? The following code works, but it makes a flat json file default.rb default['foo']['bar'] = { :herp => 'true', :derp => 42 } recipe.rb template "foo.json" do source 'foo.json.erb' variables :settings => node['foo']['bar'].to_json action :create end foo.json.erb <%= @settings %> Similar SO questions Chef and ruby templates - how to loop though key value pairs? How can I "pretty" format my JSON output in Ruby on Rails? spuder As pointed out by this SO Answer .erb templates are great for HTML, and XML, but is not good for json.

What is the idiomatic way to install a Debian package using Chef?

≡放荡痞女 提交于 2019-12-03 06:48:00
问题 Below my code for installing vcider. I am learning chef but have not seen anything for installing a dpkg. I would like to use version in the script. The code below works. script "install_vcider" do interpreter "bash" user "root" cwd "/tmp" code <<-EOH wget https://my.vcider.com/m/downloads/vcider_2.0.1b_amd64.deb dpkg -i vcider__amd64.deb EOH end Even with the code above can I replace 2.0.1b with #{version}? attribute file -> default[:vcider][:version] 2.0.1b recipe file - > version = node[

Should rbenv be installed system-wide, or at a user level?

♀尐吖头ヾ 提交于 2019-12-03 06:09:17
I'm building a vagrant setup, and part of that is installing rbenv. I'm using librarian-chef to manage all my chef cookbooks, and it installs rbenv and ruby-build. However, when I tried to ssh into my Vagrant VM and type ruby -v I got the standard system-installed ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux] . Thinking that maybe rbenv was not installed, I tried running rbenv versions , but rbenv was in fact installed: vagrant@precise64:~$ rbenv versions * system (set by /opt/rbenv/version) So then I tried rbenv install [version] : vagrant@precise64:~$ rbenv install 1.9.3-p327 [...]

How to precompile assets with Chef?

≯℡__Kan透↙ 提交于 2019-12-03 06:02:45
问题 OpsWorks isn't precompiling assets on deploy. I found this recipe in this thread but I think it's not complete though, or missing something because I get an error about release_path not being found. precompile.rb: Chef::Log.info("Running deploy/before_migrate.rb...") Chef::Log.info("Symlinking #{release_path}/public/assets to #{new_resource.deploy_to}/shared/assets") link "#{release_path}/public/assets" do to "#{new_resource.deploy_to}/shared/assets" end rails_env = new_resource.environment[

chef deployment?

佐手、 提交于 2019-12-03 05:21:31
问题 I'm interested in switching from Capistrano to Chef, but am having a few issues putting all the pieces together. I've followed http://wiki.opscode.com/display/chef/Quick+Start and am able to start EC2 instances with knife . As far as code deployment, it looks as though I want to be doing what's in http://wiki.opscode.com/display/chef/Deploy+Resource, the only problem is, nowhere on that page does it mention in what directory/file the deploy /to/path code block should go. Another issue I'm

Replacing a template in a wrapper cookbook

旧巷老猫 提交于 2019-12-03 04:17:19
问题 I'm trying to write a wrapper cookbook for the chef graphite repo In the recipe carbon.rb, the following lines occur: template "#{node['graphite']['base_dir']}/conf/storage-schemas.conf" do owner node['apache']['user'] group node['apache']['group'] end where in templates/default/storage-schemas.conf there is a storage-schemas.conf file that is not to my liking. I can edit the file inline and achieve what I want, but it doesn't seem like a good chef practice if I want to be able to keep my

Specifying which cookbooks to run with Chef Solo

二次信任 提交于 2019-12-03 03:54:35
问题 I'm using chef-solo to test my cookbooks locally, but I want to be able to only run the cookbook(s) that I'm testing. Currently, it seems like chef-solo will run all cookbooks in the cookbooks directory specified in solo.rb. I've specified the run list in the json attributes file and specified the location of the json file in solo.rb, but that doesn't seem to help. It at least parses the attributes for all the other cookbooks, because I have one that doesn't work for my local configuration

Vagrant Install chef-client on top of base image

六眼飞鱼酱① 提交于 2019-12-03 03:41:50
问题 I'm trying to use Chef to install graphite server and I encountered errors saying that either chef-solo or chef-client was not found on the VM. I'm using Ubuntu 12.04.amd64 LTS, this is server version so it will not have chef-client installed. I know that 13 version will auto have chef-client installed but I can not use 13 version. I googled and saw some people suggest to ssh to the box and apt-get install chef-client. My question is: is there anyway that I can preinstall chef-client before

Chef client hanging on npm install at node-gyp rebuild

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm having a problem with running npm install from a chef recipe. When I run it from the command line, it finishes fine in under a minute with just a few warnings related to package.json no repository field (which should be harmless). But when I run it from chef, it hangs with the last line output back to the command line as this: * execute[npm-install-app] action run Which is this resource block in the recipe: execute "npm-install-app" do cwd "#{home}/#{prefix}#{app}" command "npm --registry #{priv['url']}:#{priv['port']}#{priv['path']}

Supervisor open file limit won't change when using Chef

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am modifying /etc/security/limits.conf on the machine, and then installing Supervisor in a Chef recipe. After the recipe run finishes, if I run cat /proc/<process id>/limits I see: Limit Soft Limit Hard Limit Units Max cpu time unlimited unlimited seconds Max open files 1024 4096 files If I log into the machine and run service supervisor restart , the max open files is then set correctly. However, if I run this command in the recipe (right after installing supervisor, at the very end of the recipe, anything) the limit does not