knife

How to add knife.rb into environment variables

烂漫一生 提交于 2019-12-11 07:35:35
问题 I am getting error when i am trying to run knife command knife client list WARNING: No knife configuration file found ERROR: ArgumentError: Cannot sign the request without a client name, check that :node_name is assigned If i run knife command from repository directory then it's work. How i can include path of my knife.rb file into environment variables so that i can run knife commands from any location? 回答1: Put your knife config file in ~/.chef/knife.rb instead. That is used as the default

Chef node - check if recipe will run on it, looking inside roles as well

南笙酒味 提交于 2019-12-10 14:59:55
问题 I want to find out if a specific recipe will be run on a node from inside a different recipe. I can node.recipe?(recipe_name) method, however some of my recipies are managed by roles and recipe? does not seem to look into the roles run list. Is there an easy way to find out if my recipie[redis] is going to be run on the current node? 回答1: You're looking for the recipes method. Note the trailing s ! So: node.recipes.include?(recipe_name) Also note that there is a similar pair of methods for

How do I install the knife-ec2 plugin?

扶醉桌前 提交于 2019-12-10 13:11:33
问题 OSX, 10.9.2: $ ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13] $ knife -v Chef: 11.10.4 When I run: $ knife ec2 server list I get: FATAL: Cannot find sub command for: 'ec2 server list' The ec2 commands were moved to plugins in Chef 0.10 You can install the plugin with `(sudo) gem install knife-ec2 I have the gem installed: sudo gem install knife-ec2 runs without error. And gem list shows that it is installed: $ sudo gem list|grep knife-ec2 knife-ec2 (0.8.0) The

Is there a way to use “knife search node” or “knife show node” that will tell you the cookbook/recipe version being used?

这一生的挚爱 提交于 2019-12-10 11:55:26
问题 knife node show my_chef_node will give you information like the recipes, roles, etc. but ideally what I want is to be able to see the version of those cookbook recipes as well. knife search node 'recipes:my_cookbook\:\:default' returns nodes but knife search node 'recipes:my_cookbook\:\:default@0.3.1' does not. 回答1: Unless you constrain the runlist it will be calculated at runtime. Determining this just by looking at the cookbook versions loaded into the server is very hard. How does one

Chef Knife Commands 404 Not Found

不打扰是莪最后的温柔 提交于 2019-12-09 16:15:57
问题 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? 回答1: I found what is the root cause of my error, the chef_server_url

Which special characters need escaping in a solr query?

僤鯓⒐⒋嵵緔 提交于 2019-12-09 14:25:34
问题 Update: I think this question has to do with solr syntax in general, and not Chef in particular. So while I ran into this working with Chef, I presume that anyone working with Solr will also experience this... I'm working on an application that communicates with the Chef server's search API to find particular nodes. Based on this http://docs.opscode.com/essentials_search.html#special-characters, it seems that a number of special characters need to be escaped. Note: I'm only concerned with

How to query cookbook versions on a node?

老子叫甜甜 提交于 2019-12-09 08:04:04
问题 Usage case: The DevOps team launched a node sometime ago, and my team would like to know what's the version(s) of one/several cookbook(s) being used in the run_list. Our DevOps team is firefighting so we'd like to find a way to be self-sufficient. Commands Tried: knife cookbook show COOKBOOK give all possible versions, but does not specify which one being used. knife node show NODE shows all cookbooks, but there's no version info attached. Question: Is there a command (something similar to

invoking knife in a ruby class

a 夏天 提交于 2019-12-09 07:01:56
问题 I'd like to create a nice wrapper class around knife to allow a program to run knife commands in a readable manner. I'm currently trying to use the knife.rb file in the chef gem as a guide to some success. However, I'm having an issue turning off the editor. If I run the following code: require 'chef/knife' knife = Chef::Knife.new knife.run(['client', 'create', 'new-client'], '--disable-editing') it results in the following error: NoMethodError: undefined method `merge!' for "--disable

knife bootstrap windows winrm from Mac OS X workstation fails

谁说胖子不能爱 提交于 2019-12-05 05:19:18
问题 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

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