Tag Archives: knife

knife bash completion – with fixed environments autocomplete

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.

Posted in Server Administration, Tech Tips | Tagged , , | Leave a comment

chef knife setup

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

Posted in Tech Tips | Tagged , , , | Leave a comment

ec2 server create syntax (man page)

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

Posted in Linux, Server Admin, Server Administration, Tech Tips, Web Development | Tagged , , , , , , | Leave a comment