Usage: knife sub-command (options)
-s, --server-url URL Chef Server URL
--chef-zero-host HOST Host to start chef-zero on
--chef-zero-port PORT Port to start chef-zero on
-k, --key KEY API Client Key
--[no-]color Use colored output, defaults to false on Windows, true otherwise
-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 (except for in searches, where this will be flagrantly ignored)
-F, --format FORMAT Which format to use for output
-z, --local-mode Point knife commands at local repository instead of server
-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
Available subcommands: (for details, knife SUB-COMMAND --help)
** BOOTSTRAP COMMANDS **
knife bootstrap FQDN (options)
** CLIENT COMMANDS **
knife client bulk delete REGEX (options)
knife client create CLIENT (options)
knife client delete CLIENT (options)
knife client edit CLIENT (options)
knife client list (options)
knife client reregister CLIENT (options)
knife client show CLIENT (options)
** CONFIGURE COMMANDS **
knife configure (options)
knife configure client DIRECTORY
** COOKBOOK COMMANDS **
knife cookbook bulk delete REGEX (options)
knife cookbook create COOKBOOK (options)
knife cookbook delete COOKBOOK VERSION (options)
knife cookbook download COOKBOOK [VERSION] (options)
knife cookbook list (options)
knife cookbook metadata COOKBOOK (options)
knife cookbook metadata from FILE (options)
knife cookbook show COOKBOOK [VERSION] [PART] [FILENAME] (options)
knife cookbook test [COOKBOOKS...] (options)
knife cookbook upload [COOKBOOKS...] (options)
** COOKBOOK SITE COMMANDS **
knife cookbook site download COOKBOOK [VERSION] (options)
knife cookbook site install COOKBOOK [VERSION] (options)
knife cookbook site list (options)
knife cookbook site search QUERY (options)
knife cookbook site share COOKBOOK CATEGORY (options)
knife cookbook site show COOKBOOK [VERSION] (options)
knife cookbook site unshare COOKBOOK
** DATA BAG COMMANDS **
knife data bag create BAG [ITEM] (options)
knife data bag delete BAG [ITEM] (options)
knife data bag edit BAG ITEM (options)
knife data bag from file BAG FILE|FOLDER [FILE|FOLDER..] (options)
knife data bag list (options)
knife data bag show BAG [ITEM] (options)
** ENVIRONMENT COMMANDS **
knife environment compare [ENVIRONMENT..] (options)
knife environment create ENVIRONMENT (options)
knife environment delete ENVIRONMENT (options)
knife environment edit ENVIRONMENT (options)
knife environment from file FILE [FILE..] (options)
knife environment list (options)
knife environment show ENVIRONMENT (options)
** EXEC COMMANDS **
knife exec [SCRIPT] (options)
** HELP COMMANDS **
knife help [list|TOPIC]
** INDEX COMMANDS **
knife index rebuild (options)
** KNIFE COMMANDS **
Usage: /usr/bin/knife (options)
** NODE COMMANDS **
knife node bulk delete REGEX (options)
knife node create NODE (options)
knife node delete NODE (options)
knife node edit NODE (options)
knife node environment set NODE ENVIRONMENT
knife node from file FILE (options)
knife node list (options)
knife node run_list add [NODE] [ENTRY[,ENTRY]] (options)
knife node run_list remove [NODE] [ENTRIES] (options)
knife node run_list set NODE ENTRIES (options)
knife node show NODE (options)
** PATH-BASED COMMANDS **
knife delete [PATTERN1 ... PATTERNn]
knife deps PATTERN1 [PATTERNn]
knife diff PATTERNS
knife download PATTERNS
knife edit [PATTERN1 ... PATTERNn]
knife list [-dfR1p] [PATTERN1 ... PATTERNn]
knife show [PATTERN1 ... PATTERNn]
knife upload PATTERNS
knife xargs [COMMAND]
** RAW COMMANDS **
knife raw REQUEST_PATH
** RECIPE COMMANDS **
knife recipe list [PATTERN]
** ROLE COMMANDS **
knife role bulk delete REGEX (options)
knife role create ROLE (options)
knife role delete ROLE (options)
knife role edit ROLE (options)
knife role from file FILE [FILE..] (options)
knife role list (options)
knife role show ROLE (options)
** SEARCH COMMANDS **
knife search INDEX QUERY (options)
** SERVE COMMANDS **
Usage: /usr/bin/knife (options)
** SSH COMMANDS **
knife ssh QUERY COMMAND (options)
** SSL COMMANDS **
knife ssl check [URL] (options)
knife ssl fetch [URL] (options)
** STATUS COMMANDS **
knife status QUERY (options)
** TAG COMMANDS **
knife tag create NODE TAG ...
knife tag delete NODE TAG ...
knife tag list NODE
** USER COMMANDS **
knife user create USER (options)
knife user delete USER (options)
knife user edit USER (options)
knife user list (options)
knife user reregister USER (options)
knife user show USER (options)
Last active
August 29, 2015 14:08
-
-
Save tkuchiki/be15cb8b20697ed13580 to your computer and use it in GitHub Desktop.
install chef-server and chef-client (chef-11.*)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -L https://www.opscode.com/chef/install.sh | bash | |
knife configure client -s https://CHEF_SERVER_IP /etc/chef | |
chmod 600 /etc/chef/validation.pem | |
scp CHEF_SERVER_HOST:/etc/chef-server/chef-validator.pem /etc/chef/validation.pem | |
scp CHEF_SERVER_HOST:/etc/chef-server/admin.pem /etc/chef/ | |
chef-client | |
cat <<'EOF' > /root/.chef/knife.rb | |
log_level :info | |
log_location STDOUT | |
node_name 'knife' | |
client_key '/root/.chef/knife.pem' | |
validation_client_name 'chef-validator' | |
validation_key '/etc/chef/validation.pem' | |
chef_server_url 'https://CHEF_SERVER_HOST:443' | |
syntax_check_cache_path '/root/.chef/syntax_check_cache' | |
EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install -y "https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-server-11.1.6-1.el6.x86_64.rpm" | |
chef-server-ctl reconfigure | |
curl -L https://www.opscode.com/chef/install.sh | bash | |
knife cookbook upload -a -o /path/to/cookbooks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See: https://docs.getchef.com/errors.html | |
[2014-11-05T18:12:29+09:00] INFO: HTTP Request Returned 401 Unauthorized: error | |
================================================================================ | |
Chef encountered an error attempting to load the node data for "FQDN" | |
================================================================================ | |
Authentication Error: | |
--------------------- | |
Failed to authenticate to the chef server (http 401). | |
Server Response: | |
---------------- | |
Failed to authenticate as 'FQDN'. Ensure that your node_name and client key are correct. | |
Relevant Config Settings: | |
------------------------- | |
chef_server_url "https://FQDN" | |
node_name "tkuchiki-zabbix" | |
client_key "/etc/chef/client.pem" | |
If these settings are correct, your client_key may be invalid, or | |
you may have a chef user with the same client name as this node. | |
[2014-11-05T18:12:29+09:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out | |
Chef Client failed. 0 resources updated in 1.708863221 seconds | |
[2014-11-05T18:12:29+09:00] ERROR: 401 "Unauthorized" | |
[2014-11-05T18:12:29+09:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) | |
knife client delete FQDN -y | |
knife node node FQDN -y | |
rm -f /etc/chef/client.pem | |
chef-client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# server | |
$ knife configure -i | |
# client | |
$ knife configure -i | |
Overwrite /root/.chef/knife.rb? (Y/N)y | |
Please enter the chef server URL: [https://example.com:443] https://CHEF_SERVER_HOST:443 | |
Please enter a name for the new user: [root] knife | |
Please enter the existing admin name: [admin] | |
Please enter the location of the existing admin's private key: [/etc/chef-server/admin.pem] /etc/chef/admin.pem | |
Please enter the validation clientname: [chef-validator] | |
Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem] /etc/chef/validation.pem | |
Please enter the path to a chef repository (or leave blank): | |
Creating initial API user... | |
Please enter a password for the new user: | |
Created user[knife] | |
Configuration file written to /root/.chef/knife.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment