chef

Passing variables from chef to powershell

纵然是瞬间 提交于 2019-12-02 08:06:01
问题 I am using the powershell_script cookbook. The powershell script that I would like to use takes command line inputs. Is there a way to pass variables from chef and pass them into the powershell script? input1 = "input1" input2 = "input2" powershell_script 'example' do code "...\example.ps1" end So if my example.ps1 took input1 and input2 as command line arguments how would I pass them into: code "...\example.ps1" 回答1: The code property on the powershell_script resource takes the literal

Opscode Chef Request entity too large registering a node

大城市里の小女人 提交于 2019-12-02 07:58:49
问题 I'm registering a node that search for other nodes attributes in the run list. The problem is when the node information is too big for put on the server via HTTP. Then chef-client prints a 'FATAL: Net::HTTPServerException: 413 "Request Entity Too Large"' message. The server is in Opscode Hosted Chef. Anyone can help me with this issue? Thanks!! 回答1: This has to do with the http server's upload size limit. I've heard of people having issues with this before on Hosted Chef, and I myself have

bash_profile is not taking effect with chef-run

梦想的初衷 提交于 2019-12-02 07:24:20
If I run the below recipe with chef, entries are getting added in ~/.bash_profile , but when I do echo $PATH or echo $JAVA_HOME , the command line returns blank values. What's going on there? ruby_block "set-env-java-home" do block do ENV["JAVA_HOME"] = node['java']['path'] ENV['PATH'] = "#{ENV['PATH']}:#{node['java']['path']}/bin" end not_if { $JAVA_HOME == "#{ENV['JAVA_HOME']}" && $PATH = "#{ENV['PATH']}:#{node['java']['path']}/bin" } end bash 'set-env-bashrc' do code <<-EOH echo -e "export JAVA_HOME=$JAVA_HOME" >> ~/.bash_profile echo -e "export PATH=$PATH" >> ~/.bash_profile source ~/.bash

bash_profile is not taking effect with chef-run

痞子三分冷 提交于 2019-12-02 06:52:34
问题 If I run the below recipe with chef, entries are getting added in ~/.bash_profile , but when I do echo $PATH or echo $JAVA_HOME , the command line returns blank values. What's going on there? ruby_block "set-env-java-home" do block do ENV["JAVA_HOME"] = node['java']['path'] ENV['PATH'] = "#{ENV['PATH']}:#{node['java']['path']}/bin" end not_if { $JAVA_HOME == "#{ENV['JAVA_HOME']}" && $PATH = "#{ENV['PATH']}:#{node['java']['path']}/bin" } end bash 'set-env-bashrc' do code <<-EOH echo -e "export

Add custom Chef push job to Windows whitelist

懵懂的女人 提交于 2019-12-02 06:32:01
I am trying to add a push job to the Windows whitelist for the pushy-client. When I do a search with knife it shows the custom job in the whitelist for the Windows node. When I try to run it, the job immediately fails and on the Windows side it says the command is NOT in the whitelist. I found this issue in GitHub: Windows push service can't load whitelist I was wondering if anyone has a workaround, suggestion on how to fix it, or knows where in the code this lives that I could monkey-patch. Just confirming I get the same issue after fully testing your scenario, I added a test command to the

Passing variables from chef to powershell

拜拜、爱过 提交于 2019-12-02 05:14:19
I am using the powershell_script cookbook. The powershell script that I would like to use takes command line inputs. Is there a way to pass variables from chef and pass them into the powershell script? input1 = "input1" input2 = "input2" powershell_script 'example' do code "...\example.ps1" end So if my example.ps1 took input1 and input2 as command line arguments how would I pass them into: code "...\example.ps1" The code property on the powershell_script resource takes the literal PowerShell code you want to run, not a path to it. Regardless, you would handle it via string interpolation. For

How run cookbook with dependencies in chef?

空扰寡人 提交于 2019-12-02 05:13:41
I have configured workstation up this step in get started (OS redhat 6.5). I have launched a node. I modified a cookbook like that: myCookbook/metadata.rb name 'myCookbook' maintainer 'YOUR_COMPANY_NAME' maintainer_email 'YOUR_EMAIL' license 'All rights reserved' description 'Installs/Configures myCookbook' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.0' depends 'maven' E.g. only depends 'maven' string was added after knife cookbook create myCookbook was executed. myCookbook/recipes/default.rb maven 'spring-context' do group_id 'org.springframework'

How to determine if any file in a directory has changed

喜欢而已 提交于 2019-12-02 04:34:18
Is there a way for Chef to determine if it has changed any file in a given directory? I'd like to restart a server process if any settings in a conf.d directory are updated. I'm sure it's possible to write a list of md5sums to a file on each chef-client run, and compare current to previous iterations. But that's a fair bit of code to address what seems to be a common scenario. Is there a better way? Chef provides a concept called notifications . This allows you to define that a change in one resource triggers execution of another resource. The mentioned restart of a service after the config

Installing Chef Server on Windows

牧云@^-^@ 提交于 2019-12-02 03:49:33
问题 I'm trying to get a Chef Server up and running on a Windows 2008 Server box. I'm following the process here: http://wiki.opscode.com/display/chef/Installing+Chef+Server+Manually I've just installed Gecode and the next step is a ruby command: gem install chef-server chef-server-api chef-server chef-solr However, running this command gives the following output suggesting that Gecode isn't installed. C:\Users\Administrator>gem install chef-server chef-server-api chef-server chef- solr

Chef: Undefined node attribute or method `<<' on `node' when trying to add

醉酒当歌 提交于 2019-12-02 03:22:54
In my attributes file for postgresql recipe I have: default['postgresql']['pg_hba'] = { :comment => '# IPv4 local connections', :type => 'host', :db => 'all', :user => 'all', :addr => '127.0.0.1/32', :method => 'md5' } I want to my recipe automatically add my servers to pg_hga config file like this: lambda { if Chef::Config[:solo] return (Array.new.push node) end search(:node, "recipes:my_server AND chef_environment:#{node.chef_environment} ") }.call.each do |server_node| node['postgresql']['pg_hba'] << { :comment => "# Enabling for #{server_node['ipaddress']}", :type => 'host', :db => 'all',