Tag Archives: chef
Steven Danna has written the best knife bash completion script that I’ve seen for use with managing chef servers and the chef software by opscode. Update: Steven has now made an update so this is working! There was always one little thing wrong with it though: knife environment edit (etc) would not autocomplete – it would give an error The error was: -bash: _chef_environments: command not found The solution is pretty simple – you just need to edit the script and transpose two letters that were a typo from the knife_completion.sh file: _chef_environemnts should actually be: _chef_environments The difference is hard to spot but it’s key. Two other scripts for knife completion (that I don’t like as much) are this one by avishai-ish-shalom and a spinoff by vindimy – I think they are slower and not as user friendly. If you use zsh instead of bash there is also a zsh knife plugin which is part of oh-my-zsh that seems pretty good.
Recently when using opscode’s chef server and knife I was getting the error message: ERROR: EOFError: end of file reached When trying to execute commands like knife client list I ended up finding out that the problem has to do with how the configuration for chef 11 has changed from chef 10. In your knife.rb file there is a line that gives you the default address / address of your cloud server – you will even see the default if you are running the interactive knife configuration tool (knife configure -i): Please enter the chef server URL: [http://chef.example.com:4000] The big changes for chef 11 are two hard to spot things for the new chef server / knife access url: https://chef.example.com Port 4000 goes away The server now runs on HTTPS / SSL (which implies port 443) Change this to use SSL / HTTPS and your ERROR: EOFError: end of file reached message will go away. I was getting that error when trying to access chef on port 5672 which is the port that RabbitMQ runs on.
For more info you can visit the knife configuration page on opscode % knife –help Usage: knife sub-command (options) -s, –server-url URL Chef Server URL -k, –key KEY API Client Key –[no-]color Use colored output, defaults to enabled -c, –config CONFIG The configuration file to use –defaults Accept default values for all questions -d, –disable-editing Do not open EDITOR, just accept the data as is -e, –editor EDITOR Set the editor to use for interactive commands -E, –environment ENVIRONMENT Set the Chef environment -F, –format FORMAT Which format to use for output -u, –user USER API Client Username –print-after Show the data after a destructive operation -V, –verbose More verbose output. Use twice for max verbosity -v, –version Show chef version -y, –yes Say yes to all prompts for confirmation -h, –help Show this message
This is the knife create syntax page. I was trying to launch an instance of Chef with the “knife create” command that chef’s knife provides. The documentation page gives this example for how to launch a web server on Amazon’s EC2 server, but without much explanation of the terms: knife ec2 server create -r “role[webserver]” -I ami-2d4aa444 –flavor m1.small -G www,default -x ubuntu -N server01 After doing some searching I just ended up digging into the code and found this information quite helpful, and so I am sharing it: -f FLAVOR ( or –flavor FLAVOR ) The flavor of server (m1.small, m1.medium, etc) default: m1.small -I IMAGE ( or –image IMAGE ) The AMI for the server -G X,Y,Z ( or –groups X,Y,Z ) The security groups for this server default: “default” -Z ZONE ( or –availability-zone ZONE ) The Availability Zone default: us-east-1b -N NAME ( or –node-name NAME ) The Chef node name for your new node -S KEY ( or –ssh-key KEY ) The AWS SSH key id -x USERNAME ( or –ssh-user USERNAME ) The ssh username default: root -P PASSWORD ( or –ssh-password PASSWORD ) The ssh password -i IDENTITY_FILE ( or –identity-file IDENTITY_FILE ) The SSH identity file used for authentication –prerelease Install the pre-release chef gems –bootstrap-version VERSION The version of Chef to install -d DISTRO ( or –distro DISTRO ) Bootstrap a distro using a template default: ubuntu10.04-gems –template-file TEMPLATE Full path to location of template to use –ebs-size SIZE The size of … Continue reading