__ Issue the following commands and understand the output.__
shows common flags and all subcommands
knife --help
show contextual help for node subcommands
knife node --help
knife status --run-list
knife status "role:lb" --run-list
knife status "role:webserver" --run-list
knife node list
knife node show <supply an instance id for the for the lb instance>
knife node show <supply an instance id for the for the lb instance> --run-list
sudo gem install gem-man
gem man chef
Check to see if the new cookbook "webserver" is loaded.
knife cookbook list
Inspect the contents of the cookbook using "cookbook show" subcommands.
__ List your running instances and launch the web page using the following commands.__
knife status --run-list
knife status "recipe:webserver" --run-list
curl <the public IP of the webserver instance>
__ Search for a copy of the haproxy cookbook by issuing the following commands.__
knife cookbook site search haproxy
knife cookbook site show haproxy
__ Download a copy of the haproxy cookbook.__
knife cookbook site vendor -d haproxy
See ( http://wiki.opscode.com/display/chef/Chef+Repository#ChefRepository-cookbooks ) for an explanation of the vendor branch pattern used in this command.
__ Find the metadata.rb and list the supported OS's for this cookbook__
__ Upload cookbook __
knife cookbook upload haproxy
__ Create a LB role we will use tomorrow__
create a lb role
$EDITOR roles/lb.rb
name "lb"
description "load balancer"
override_attributes(
)
run_list(
"recipe[haproxy]"
)
__ Load the new lb.rb role up to the Chef server__
knife role from file lb.rb
__ Show the newly loaded role__
knife role show lb
knife ssh "*:*" "sudo chef-client" -x ubuntu -a ec2.public_hostname
uptime
knife ssh "*:*" "uptime" -x ubuntu -a ec2.public_hostname
__ Ask Aaron for a new ec2 instance, I'll give you the hostname __
save the RSA private key to ~/.ssh/aaron:
(copy key from skype)
cat > ~/.ssh/aaron
(right-click in PuTTY to paste) (hit enter) (Control-D to end)
knife bootstrap <new server> -i ~/.ssh/aaron --sudo -x ubuntu -r 'runlist'
__ Verify the status of the bootstrapped instance.__
knife status --run-list
__ Add a role to the new instances run_list.__
knife node run_list add NODENAME "role[lb]"
Use the node name displayed in the first field of the "knife status". Notice the default name of the bootstrapped node is not the instance id.