chef-recipe

chef ruby gem installer failing

六月ゝ 毕业季﹏ 提交于 2020-01-13 10:39:28
问题 I am trying to setup cassandra on an CentOS VM via chef and it fails with the error below. I have tried clearing out bundle caches to no avail. The recipe works on another machine but a key difference is that I ran other recipes on that machine beforehand so I suspect I am missing a chef dependency (which is why I haven't tried just fixing the packages directly). I am also terribly new to ruby so sorry if this is an obvious question. Machine config Chef: 11.4.0 ruby 1.9.3p286 (2012-10-12

How to use script resource to substitute variable value [duplicate]

倾然丶 夕夏残阳落幕 提交于 2020-01-06 19:34:25
问题 This question already has an answer here : How to substitute variable value in “docker run” command (1 answer) Closed 3 years ago . I am using chef script resource and trying to assign a fingerprint value as below script 'retrieve_ucp_master_fingerprint' do interpreter "bash" code <<-EOH export FINGERPRINT=D0:19:C5:80:42:66:56:AC:6F docker run --rm -i -v /var/run/docker.sock:/var/run/docker.sock --name ucp docker/ucp join --replica --fingerprint $FINGERPRINT EOH end However, chef is not at

How to lazily evaluate an arbitrary variable with Chef

不问归期 提交于 2019-12-30 03:04:08
问题 I'm writing a Chef recipe to install our application code and execute it. The recipe needs to be particular about the directory this code ends up in (for running templates, setting log forwarding etc.). Thus the directory itself pops up in a lot of places in different recipes. I am trying to fetch/define a variable so I can re-use it in my resource block with string interpolation. This is pretty straightforward: home = node['etc']['passwd'][node['nodejs']['user']]['dir'] With an example usage

CHEF commands help ,

泄露秘密 提交于 2019-12-25 16:34:27
问题 How can I write this command in chef ? /home/vagrant$ source ~/.rvm/scripts/rvm (->enter) I tried... execute "foo" do command "source ~/.rvm/scripts/rvm" action :run end in short, how can I write a simple command in chef? not installing something. thanks!!! 回答1: This isn't something Chef supports. source is a shell builtin, not a command, and it would have no effect on Ruby anyway has that isn't a Ruby script, it is a shell script. You can use a bash resource like this: bash 'do the needful'

CHEF commands help ,

不打扰是莪最后的温柔 提交于 2019-12-25 16:33:12
问题 How can I write this command in chef ? /home/vagrant$ source ~/.rvm/scripts/rvm (->enter) I tried... execute "foo" do command "source ~/.rvm/scripts/rvm" action :run end in short, how can I write a simple command in chef? not installing something. thanks!!! 回答1: This isn't something Chef supports. source is a shell builtin, not a command, and it would have no effect on Ruby anyway has that isn't a Ruby script, it is a shell script. You can use a bash resource like this: bash 'do the needful'

Where to Store Local Software Packages for Chef Recipe

爱⌒轻易说出口 提交于 2019-12-24 14:16:11
问题 I have a Ruby .deb package that I built from source using checkinstall. I'm using it with a Chef recipe to install Ruby on one of my nodes. Right now I'm storing it under files/default in my recipe, where one would normally store config files or templates to upload to the server. This works well enough but I wonder what the "right" way to solve this problem would be. Where do people store local binaries or packages when they want to install them with Chef this way? Should I create a server to

How do I use roles in test kitchen?

孤街醉人 提交于 2019-12-24 06:51:21
问题 I can't figure out how to run roles in a run list in test kitchen. I did a knife download roles to my chef repo ( C:\.chef\roles ). I also did a knife download cookbooks to c:\.chef\cookbooks Here is the .kitchen.yml for a cookbook I want to test which I plan to run with a particular role ( C:\.chef\cookbooks\mybook\.kitchen.yml ): --- driver: name: hyperv parent_vhd_folder: c:\HyperV\VHDs\ parent_vhd_name: 2012R2_Fresh_Gen1.vhdx vm_switch: NAT memory_startup_bytes: 2GB provisioner: name:

How do I use roles in test kitchen?

陌路散爱 提交于 2019-12-24 06:51:09
问题 I can't figure out how to run roles in a run list in test kitchen. I did a knife download roles to my chef repo ( C:\.chef\roles ). I also did a knife download cookbooks to c:\.chef\cookbooks Here is the .kitchen.yml for a cookbook I want to test which I plan to run with a particular role ( C:\.chef\cookbooks\mybook\.kitchen.yml ): --- driver: name: hyperv parent_vhd_folder: c:\HyperV\VHDs\ parent_vhd_name: 2012R2_Fresh_Gen1.vhdx vm_switch: NAT memory_startup_bytes: 2GB provisioner: name:

Chef - how to write a custom resource containing DSL for “execute”

↘锁芯ラ 提交于 2019-12-24 03:14:38
问题 I have written a chef definition that posts to our chat server. Since definitions are not recommended any more, how can I rewrite this as a resource? I'm particularly interested in how to use "event" ways to trigger the code. File chat\definitions\post.rb : define :chat_post do chat_url = 'https://chat.our.company/hooks/abcdef1234567890' message = params[:name] execute "echo" do command "curl -m 5 -i -X POST -d \"payload={"text": "#{message}"\" #{chat_url}" ignore_failure true end end Calling

how to make chef execute with a specific user and load its environment values

你。 提交于 2019-12-23 07:30:05
问题 Hi I am creating a WCS instance, for which i have to execute the create instance command using the wcs user (webadmin), its failing to connect to DB as its not able to get the required env variables. so i put some sample code to check I am using the below code bash "wcs-create-instance" do user "webadmin" group "webspher" code <<-EOH ###{node[:websphere][:wcs][:wcs_installLocation]}/bin/config_ant.sh -DinstanceName=#{node[:websphere][:wcs][:wcs_instance]} CreateInstance whoami > /tmp/whoami