Hot answers tagged

16

I figured it out. my nodes did not have an fqdn. I had to specify -a ipaddress. the error message was not helpful. I figured it out by debugging knife ssh code. there is also a bug that it does not read the attribute from the knife config file. I'm going to open up a ticket about the issue and perhaps submit a patch. What I did to get past this was put the ...


14

To summarize the IRC session at https://github.com/chef/irc_log_archives/blob/master/chef/2013/2/23.log: Chef-server redirects api clients between its components (in this case erchef and bookshelf). These redirects are based on the FQDN of the chef-server. If the server doesn't have a valid FQDN at install time, this can result in redirects to https://...


9

I'm assuming that you are receiving this error while creating a new node and not when you try to set the security credentials in your knife.rb. To be precise, the error should come up when you initiate: knife ec2 server create -I <ami-id> The error ERROR: You did not provide a valid 'AWS SSH Key Id' value. is due to a missing SSH Keypair in your ...


9

My guess would be that your default security group is not allowing SSH traffic.


8

If you want to store the settings in the knife.rb file: knife[:aws_ssh_key_id] = 'pemfilename' pemfilename should be the pem file name without the .pem extension and it has to be located in: ~/.ssh/ Also, it has to be chmodded 600: (chmod 600 ~/.ssh/pemfile.pem) So if your pem file is ~/.ssh/mypem.pem you need to set: knife[:aws_ssh_key_id] = 'mypem' ...


8

1. Install chef-client Either use the https://www.chef.io/chef/install.sh script or download and install the correct chef-client package for your OS. 2. Create /etc/chef/client.rb Perhaps you can use one of your bootstrapped nodes as a reference. The important bit is that you have chef_server_url pointing at your Chef server. Example: /etc/chef/client....


6

If you use chef-solo, you don't get to use knife. Knife is API client for the chef-server, with some extra utility sugar (like knife rackspace server create you've mentioned). To configure server with chef-solo, you should copy your chef repo to the server, and run chef-solo there over ssh. There is no ready-made script or knife plugin that I know of that ...


6

There is a solution: knife search node "roles:$ROLE_NAME"


6

I just had the same problem and fixed it from this thread http://comments.gmane.org/gmane.comp.sysutils.chef.user/2718 either ssh into your potential client machine and remove the /etc/chef/client.pem or run this quicky ssh -t name@new.client.net "sudo rm /etc/chef/client.pem" Run knife bootstrap again and it should work. You may have registered this ...


5

You could write a simple bash script to do that like: #!/bin/sh for file in `ls cookbooks`;do [ -d $file ] && knife cookbook upload cookbooks/$file done for file in `ls data_bags | grep \.json$`;do knife data bag from file data_bags/$file done for file in `ls environments | grep \.rb$`;do knife environment from file environments/$file done for ...


5

A role on chef server and chef-solo are very different in how they are represented. In chef-server they're stored in a database, whereas chef-solo uses flat JSON or Ruby files. You'd have to ask opscode why it doesn't work for the chef-solo use case, but my guess is that its just much more involved to create and upload the roles to the database so they ...


5

Check out the knife-solo plugin, which can automatically install chef-solo on your remote server, upload your cookbooks onto it, and then run chef-solo. It basically automates what other folks who've answered this question have suggested doing.


5

Fixed it! So when you are using hosted chef you need to pass in a private key with the bootstrap and have the public key in your autherized_keys file.... install the ChefSDK SCP your starter kit from hosted Chef extract the starter kit to ~/chef-repo generate a new keypair: ssh-keygen add the public key to your autherized_keys file: $ cat id_rsa....


4

You can auto scale your EC2 instance. Check this post, but before doing it have read this discussion. I am currently using chef for configure my ec2 instaces and cloudformation for amazon resources set up. Recetly CloudFormation has integrated chef. I am using Cloud formation and chef both and it works well for me.


4

Does knife status not work? $ knife status 24 minutes ago, server-063.vm.example.com, server-063.vm.example.com, 192.168.1.188, ubuntu 10.04. 4 minutes ago, server-061.vm.example.com, server-061.vm.example.com, 192.168.1.184, ubuntu 10.04. 3 minutes ago, server-062.vm.example.com, server-062.vm.example.com, 192.168.1.39, ubuntu 10.04.


4

Also, if -a ipaddress doesn't work, try -a cloud.public_ipv4 I was shown this solution after figuring out that knife ssh was trying to use internal IP addresses for my nodes and it took some asking in the chef IRC channel (#chef on irc.freenode.net) before someone named retr0h showed me this.


4

The listing of attribute values is available via: knife search node "name:NODENAME" -F json It's in the automatic attributes, eg.: "ipaddress": "11.1.111.111", (More on attribute types like automatic.) You just have to know that the output without -F json is not giving you useful attribute names for your scripting.


4

Make sure you are using ruby 1.9, then install knife-essentials $ gem install knife-essentials Then add the following to ~/.chef/knife.rb repo_mode 'everything' versioned_cookbooks true chef_repo_path 'PATH/TO/chef-repo' Then you can download/upload your entire server, or just parts of it. Downloading will put a lot of .json files in your chef-repo, ...


3

You should set the attributes you want on the node object(s) on the Chef Server. You can do this through a variety of methods. Add the attributes to the role you've applied to the nodes - this probably the best for systems that are all in a single role. Modify the node(s) directly, with knife node edit, or script it with knife exec. Set the attributes in ...


3

You should take a look at knife-solo


3

Unless you've specified a custom bootstrap template this is what bootstrap is trying to run. At the very least it expects both bash and either wget or curl to be installed, and findable via PATH. It's been awhile since I've used FreeBSD, but I remember that none of those things were included in a default install last time I did one. I've recently said some ...


3

Knife bootstrap, and knife ssh both access directly, but both can take a flag for a jump box. I believe -G is the one. Of course, that jump box would need to be accessible from your workstation


2

Before each chef-solo run, the cookbooks should be present on that target machine, either by transferring it (via ftp/scp) or pointing the cookbook_path to a network share . If you want the cookbooks to be automatically downloaded, you would need to run a Chef Server. Whether you want to run your own chef server, or use a hosted one from OpsCode is up to ...


2

It is very subjective to the package being cookbook'd. The fine folks at EngineYard, in their chef repo have a Rakefile which a task that creates a cookbook with a default layout. And it wouldn't make sense for a data bag either as - it is a plain json. Finally, Environments is a Chef-Server only feature, which will not work if you use chef-solo.


2

This worked for me http://wiki.opscode.com/display/chef/Common+Errors#CommonErrors-401Unauthorized(usingvalidatorAPIclient) You need to delete validation.pem and restart chef-server, since it's broken by default in current ubuntu chef-server package.


2

I wrote a small knife plugin called sync-all described below that accomplishes this as well: https://github.com/cdoughty77/knife-sync-all


2

I don't think it's valid to use -e nano option knife data bag from file (though the command-line help implies otherwise), but it should just be ignored. That error means that knife can't find the json file you have specified. When you say that the item was in the proper location, where exactly was it? Note that knife will be looking relative to your ...


2

Take a look at http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html Something like: wget http:// 169.254.169.254 /latest/meta-data/public-hostname or change the last part to public-ipv4


2

As rhetonik mentioned above - you need to specify keypair name to be used for a new server. One option is to pass it directly using -S switch to knife ec2 command, the other option is to add something like that to your knife.rb configuration file: knife[:aws_ssh_key_id] = "myawshosts"


2

The chef-client program need to run, successfully, before any information will be shown by knife-node. The run list and environment can be set via knife-edit, but the other fields are populated by data returned by ohai, and this only happens when chef-client runs.


Only top voted, non community-wiki answers of a minimum length are eligible