Questions tagged [knife]

Knife is a powerful command-line interface (CLI) that comes with Chef.

Knife is used by administrators to interact with the Chef Server API and the local Chef repository. It provides the capability to manipulate nodes, cookbooks, roles, databags, environments, etc., and can also be used to provision cloud resources and to bootstrap systems.

521 questions
6
votes
3 answers

How can I edit a chef attribute of an ec2 node using knife

I want to edit ec2 node's node_data using a knife node command. I can manually do it by using below command. knife node edit NODE_NAME It will generate a json which I need to edit. "name": "NODE-1", 3 "chef_environment": "test", 4 "normal":…
Mady
  • 5,016
  • 7
  • 35
  • 46
6
votes
2 answers

How to use Chef Knife without a private key?

I want to use Chef Knife from the commandline for some basic things like creating data bags and cookbooks. The problem is it keeps failing me and complains that private key is missing. ERROR: Your private key could not be loaded from …
picardo
  • 24,530
  • 33
  • 104
  • 151
6
votes
1 answer

Vagrant Box Breaking After Knife Cookbook Installs

I'm a Vagrant n00b who's having issues getting Vagrant and Chef's knife command to play nice together as I'm setting up a pretty simple CentOS LAMP box using chef-solo. Here's a quick rundown of ths issue: I've created a basic Vagrantfile using the…
Ethan Winn
  • 153
  • 1
  • 8
5
votes
2 answers

How do I view a recipe on a chef server?

knife search node '*:*' -a recipes gives me all the nodes and their recipes. knife node show NODE_ID -a recipes gives me recipes used by a specific node with NODE_ID. I need to fetch the contents of the recipes that these commands fetch. Even a…
ashokgadeking
  • 53
  • 1
  • 5
5
votes
3 answers

CHEF - Attempt to use relative path 'foo when current directory is outside the repository path

When I try and run knife upload roles or knife upload /roles it gives the following error cd ~/my-chef-repo knife upload roles -n -V INFO: Using configuration from /Users/sowen/.chef/knife.rb ERROR: Attempt to use relative path 'roles' when current…
spuder
  • 17,437
  • 19
  • 87
  • 153
5
votes
2 answers

Delete client with newline in name

Ok, so this started because I was trying to get auto-scaled nodes to self register with Chef. I had the following in my client.rb file: node_name "some_prefix-#{`hostname`}" the idea was that each node would have the same prefix but a hostname…
Tejay Cardon
  • 4,193
  • 2
  • 16
  • 31
5
votes
2 answers

Change ipaddress of a node on open source chef server

I have been experimenting with open source chef server. I configured a node on my server which had ip address 10.114.7.41. Now when I restarted the node machine and now the ip address of the machine has changed to 10.114.7.45. But the chef server…
Amar
  • 2,171
  • 1
  • 13
  • 16
5
votes
1 answer

chef - precedence of attributes set on node level

Maybe I missed something in the doc's, but after reading the order that attributes are used when defined in multiple places I don't understand where attributes set at the node level come into the equation In the 1 to 15 levels of where attributes…
Flo Woo
  • 949
  • 1
  • 12
  • 26
5
votes
3 answers

Use knife to create a new recipe in a cookbook

I've used knife solo to create a new folder and a cookbook with a default recipe using a custom template defined by .chef/knife.rb. My question is what command do I use for knife to create new recipes with that template instead of using…
John Wyatt
  • 69
  • 2
  • 6
5
votes
3 answers

How to set/change host name using Chef?

I have few nodes in running mode, I have to set hostname to those nodes. Is there any Cookbook, in that we can set attribute host_name and run that recipe on respective nodes?
Gaurav Borole
  • 796
  • 2
  • 13
  • 32
5
votes
7 answers

knife bootstrap command without prompting password

I am trying to write a bash script which contains the command for bootstrapping a Ubuntu client node using knife command. When I execute the script, the knife command was asking the sudo password of client node and once i type the password, it works…
HRM
  • 2,097
  • 6
  • 23
  • 37
5
votes
1 answer

How to skip unreachable nodes when using knife ssh

I'm trying to run a shell command on multiple nodes using knife ssh in a following way: knife ssh -V "role:web" --ssh-gateway ec2-user@aws_ssh_gateway \ --ssh-user ubuntu \ "sudo chef-client" It works fine when all my instances…
vlprans
  • 473
  • 6
  • 8
5
votes
1 answer

chef knife fails with key error after attempting to upload a cookbook

I set up a chef server, and after copying the admin.pem, and validator.pem files from the server to my workstation, and then configuring knife on the workstation using knife configure..., I create a new user which I can verify from the web ui, and,…
wkhatch
  • 2,664
  • 7
  • 36
  • 45
5
votes
1 answer

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

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…
henry.oswald
  • 5,304
  • 13
  • 51
  • 73
5
votes
1 answer

How do I load JSON attributes pass via knife through chef recipes?

I have a web server that basically accepts input for a knife ec2 create server command. In my knife command, I pass in -j '{"branch":"clone"}' From documentation I thought I would be able to do this in my recipes that are being loaded: @@branch =…
user1002563
  • 335
  • 1
  • 4
  • 17
1 2
3
34 35