chef

How to pass value from one resource to another resource in chef recipe?

妖精的绣舞 提交于 2019-12-04 04:10:26
问题 I am trying to change an attribute in one resource and want to use updated value in another resource but updated value is not getting reflected in another resources. please help me Code node[:oracle][:asm][:disks].each_key do |disk| Chef::Log.info("I am in #{cookbook_name}::#{recipe_name} and current disk count #{node[:oracle][:asm][:test]}") bash "beforeTest" do code <<-EOH echo #{node[:oracle][:asm][:test]} EOH end ruby_block "test current disk count" do block do node.set[:oracle][:asm][

Chef::Exceptions::ChecksumMismatch when installing nginx-1.7.8 from source

主宰稳场 提交于 2019-12-04 03:56:41
I get the following error when running vagrant up --provision to set up my development environment with vagrant... ==> default: [2014-12-08T20:33:51+00:00] ERROR: remote_file[http://nginx.org/download/nginx-1.7.8.tar.gz] (nginx::source line 58) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (0510af) does not match checksum on content (12f75e) My chef JSON has the following for nginx: "nginx": { "version": "1.7.8", "user": "deploy", "init_style": "init", "modules": [ "http_stub_status_module", "http_ssl_module", "http_gzip_static_module" ], "passenger": { "version": "4.0

Chef - create template with dynamic variable?

人走茶凉 提交于 2019-12-04 03:30:06
I'm having a bit of a challenge on a Chef recipe. I'm new to Chef, so please bear with me. Step 1: My chef recipe installs Ruby Passenger, then compiles the Passenger nginx module along with Nginx. # Install passenger and nginx module bash "Install Passenger" do code <<-EOF source /usr/local/rvm/scripts/rvm gem install passenger EOF user "root" not_if { `gem list`.lines.grep(/^passenger \(.*\)/).count > 0 } end # Install passenger # Note that we have to explicitly include the RVM script otherwise it won't setup the environment correctly bash "Install passenger nginx module and nginx from

Chef Knife Commands 404 Not Found

别等时光非礼了梦想. 提交于 2019-12-04 03:13:04
I'm trying to use chef, I followed all the steps provided by them to "Install and configure Chef server using your hardware" I've run the following commands from the workstation knife SSL check Output Connecting to host my_server:443 Successfully verified certificates from `my_server' However when I use the following command knife client list Output: ERROR: The object you are looking for could not be found What is going on? I found what is the root cause of my error, the chef_server_url must has the organization's name at the end of the URL. chef_server_url ' https://my_server:443

Chef server password reset

我只是一个虾纸丫 提交于 2019-12-04 02:07:23
I installed and run my own Chef server in my linux machine. When I access my chef server UI it ask me username and password. Unfortunately I forgot my password. I know my user name is admin . How can I recover my password? In the UI there is no forgot password option also. I changed the default password which is p@ssw0rd1 . But I forgot what I have changed. Is that password is stored in any location of my chef server or Is that anyway to reset my password? Thanks. Draco Ater I guess the only thing you can do now is to login into database itself and change the password there. The database

Vagrant requires attributes in roles.json that break existing Chef project

蓝咒 提交于 2019-12-03 22:44:28
I have an existing chef-solo project to which I am trying to add vagrant support. I typically use knife to cook these recipes on EC2 servers using Ubuntu 10.04 AMIs published by Canonical. Vagrant requires that I add chef_type and json_class attributes to my working roles/*.json files, like this: { "name": "memcached", "chef_type": "role", "json_class": "Chef::Role", "run_list": ["base", "memcached"] } If I don't add these to the role definition file, then I get this next error. Presumably these attributes tell chef to treat my JSON file like an instance of Chef::Role class. [default] [Thu, 26

How to recursively change the owner and group on a directory with Chef?

大兔子大兔子 提交于 2019-12-03 22:21:56
the resource_directory has only 2 actions available: create and delete I need to update the owner and group of a directory recursively. How do I do that? using a simple resource_execute ? execute "chown-data-www" do command "chown -R www-data:www-data /var/www/myfoler" user "root" action :run end Bill Warner You can set the default action to nothing then have resources that may screw things up notify the perm fixer: execute "chown-data-www" do command "chown -R www-data:www-data /var/www/myfoler" user "root" action :nothing end resource "that may screw up perms" do stuff "one two three"

knife bootstrap windows winrm from Mac OS X workstation fails

本秂侑毒 提交于 2019-12-03 21:06:13
Running the command knife bootstrap windows winrm ec2box.amazonaws.com -r 'role[web]' -x Administrator -P 'mypassword' from my Mac OS X workstation produces the output below. Running it from a Windows workstation, the command successfully runs. Is there an extra step I need to take to get my Mac OS X workstation to communicate via WinRM correctly? I'm using this on Amazon's Windows Server 2012 AMI. It printed #39 everywhere on my terminal, not an artifact of Stack Overflow. WARNING: Could not load IOV methods. Check your GSSAPI C library for an update WARNING: Could not load AEAD methods.

Access the registry of another user with Chef

蹲街弑〆低调 提交于 2019-12-03 20:31:34
问题 Is it possible to access the registry of another user with Chef? I have the chef-client running as System and I want to modify the registry of User1? Is there a way to do this? The registry_key resource provides a way to access HKEY_Users but I see no way to map the username to the SID. 回答1: This ended up being mildly convoluted and looking at it makes me cringe. But it seems to work! I wanted to modify another user's environment variables via the registry, as described in this Server Fault

How can I set the log output level for Chef on Amazon OpsWorks?

大憨熊 提交于 2019-12-03 20:19:39
My question is similar to: How can I display the output of a Opscode Chef bash command in my console? I want to be able to see console output for my running recipe. In particular, my recipe failed to start JBoss because JAVA_HOME was not being set. It took me an entire day to figure this out because the statement JAVA_HOME is undefined was not being printed to the Chef output. When running chef solo, debugging output can be turned on by appending -l debug to the command, as in: chef-solo -c solo.rb -j node.json -l debug However, when using Amazon OpsWorks, there is no such option: sudo