In addition to the default settings in a knife.rb file, there are other subcommand-specific settings that can be added. When a subcommand is run, knife will use:
A value passed via the command line will override a value in the knife.rb file; a value in a knife.rb file will override a default value.
Warning
Many optional settings should not be added to the knife.rb file. The reasons for not adding them can vary. For example, using --yes as a default in the knife.rb file will cause knife to always assume that “Y” is the response to any prompt, which may lead to undesirable outcomes. Other settings, such as --hide-healthy (used only with the knife status subcommand) or --bare-directories (used only with the knife list subcommand) probably aren’t used often enough (and in the same exact way) to justify adding them to the knife.rb file. In general, if the optional settings are not listed on the main knife.rb topic, then add settings only after careful consideration. Do not use optional settings in a production environment until after the setting’s performance has been validated in a safe testing environment.
The following list describes all of the optional settings that can be added to the configuration file:
knife[:admin]knife[:admin_client_key]
knife[:admin_client_name]
knife[:after]knife[:all]knife[:all_versions]knife[:attribute]knife[:attribute_from_cli]
knife[:authentication_protocol_version]
knife[:bare_directories]knife[:before]
knife[:bootstrap_curl_options]--bootstrap-install-command.knife[:bootstrap_install_command]--bootstrap-curl-options, --bootstrap-install-sh, or --bootstrap-wget-options.knife[:bootstrap_no_proxy]knife[:bootstrap_proxy]knife[:bootstrap_template]knife[:bootstrap_vault_file]knife[:bootstrap_vault_item]vault:item.knife[:bootstrap_vault_json]A JSON string that contains a list of vaults and items to be updated.
For example:
--bootstrap-vault-json '{ "vault1": ["item1", "item2"], "vault2": "item2" }' knife[:bootstrap_version]knife[:bootstrap_wget_options]--bootstrap-install-command.knife[:both]knife[:chef_node_name]
knife[:chef_repo_path]knife[:chef_server_url]
knife[:chef_zero_host]knife[:chef_zero_post]knife[:client_key]
knife[:color]
knife[:concurrency]knife[:config_file]knife[:cookbook_copyright]
knife[:cookbook_email]
knife[:cookbook_license]
knife[:cookbook_path]
knife[:delete_validators]
knife[:depends]knife[:description]knife[:diff]
knife[:diff_filter]A), deleted (D), modified (M), and/or have had their type changed (T). Any combination of filter characters may be used, including no filter characters. Use * to select all paths if a file matches other criteria in the comparison.knife[:disable_editing]knife[:distro]
knife[:download_directory]knife[:dry_run]knife[:editor]knife[:encrypt]
knife[:env_run_list]
knife[:environment]knife[:exec]knife[:file]knife[:filter_result]
knife[:first_boot_attributes]
knife[:flat]false to view ls-like output.knife[:force]knife[:format]
knife[:forward_agent]knife[:fqdn]knife[:freeze]--force option can override this setting.knife[:help]
knife[:hide_healthy]knife[:hints]knife[:host_key_verify]--no-host-key-verify to disable host key verification.knife[:id_only]
knife[:identity_file]knife[:initial]knife[:input]PUT or a POST request.knife[:latest]knife[:local]knife[:local_mode]
knife[:log_level]
knife[:log_location]
knife[:manual]knife[:max_arguments_per_command]
knife[:max_command_line]
knife[:method]DELETE, GET, POST, or PUT.knife[:mismatch]
knife[:name_only]knife[:name_status]Added, Deleted, Modified, or Type Changed.knife[:no_deps]knife[:node_name]The name of the node. This may be a username with permission to authenticate to the Chef server or it may be the name of the machine from which knife is run. For example:
node_name 'user_name'
or:
node_name 'machine_name'
knife[:null_separator]
knife[:on_error]
knife[:one_column]knife[:patterns]
knife[:platform]knife[:platform_version]knife[:pretty]--no-pretty to disable pretty-print output for JSON.knife[:print_after]knife[:proxy_auth]knife[:purge]knife[:query]
knife[:readme_format]md (markdown) and rdoc (Ruby docs).knife[:recurse]--recurse to delete directories recursively.knife[:recursive]
knife[:remote]
knife[:replace_all]
knife[:replace_first]
knife[:repo_mode]static, everything, or hosted_everything. Use static for just roles, environments, cookbooks, and data bags. By default, everything and hosted_everything are dynamically selected depending on the server type.knife[:repository]knife[:rows]
knife[:run_list]knife[:script_path]knife[:secret]knife[:secret_file]knife[:server_name]knife[:sort]
knife[:sort_reverse]knife[:ssh_attribute]knife[:ssh_gateway]knife[:ssh_password]knife[:ssh_password_ng]
knife[:ssh_port]knife[:ssh_user]knife[:start]
knife[:template_file]
knife[:trailing_slashes]
knife[:tree]knife[:use current_branch]knife[:use_sudo]knife[:use_sudo_password]
knife[:user] and/or knife[:user_home]
knife[:user_key]knife[:user_password]knife[:validation_client_name]
knife[:validation_key]
knife[:validator]
knife[:verbose_commands]
knife[:verbosity]
knife[:with_uri]
knife[:yes]The following sections show the optional settings for the knife.rb file, sorted by subcommand.
The following knife bootstrap settings can be added to the knife.rb file:
knife[:bootstrap_curl_options]--bootstrap-curl-options option.knife[:bootstrap_install_command]--bootstrap-install-command option.knife[:bootstrap_no_proxy]--bootstrap-no-proxy option.knife[:bootstrap_proxy]--bootstrap-proxy option.knife[:bootstrap_template]--bootstrap-template option.knife[:bootstrap_url]--bootstrap-url option.knife[:bootstrap_vault_item]--bootstrap-vault-item option.knife[:bootstrap_version]--bootstrap-version option.knife[:bootstrap_wget_options]--bootstrap-wget-options option.knife[:run_list]--run-list option.knife[:template_file]--bootstrap-template option.knife[:use_sudo]--sudo option.Note
The knife bootstrap subcommand relies on a number of SSH-related settings that are handled by the knife ssh subcommand.
The following knife client create settings can be added to the knife.rb file:
knife[:admin]--admin option.knife[:file]--file option.The following knife client reregister settings can be added to the knife.rb file:
knife[:file]--file option.The following knife configure settings can be added to the knife.rb file:
knife[:admin_client_name]knife[:config_file]--config option.knife[:disable_editing]--disable-editing option.knife[:file]--file option.knife[:initial]--initial option.knife[:repository]--repository option.knife[:user_home]--user option.knife[:user_password]--password option.knife[:yes]--yes option.The following knife cookbook bulk delete settings can be added to the knife.rb file:
knife[:purge]--purge option.knife[:yes]--yes option.The following knife cookbook create settings can be added to the knife.rb file:
knife[:readme_format]--readme-format option.The following knife cookbook delete settings can be added to the knife.rb file:
knife[:all]--all option.knife[:print_after]--print-after option.knife[:purge]--purge option.The following knife cookbook download settings can be added to the knife.rb file:
knife[:download_directory]--dir option.knife[:force]--force option.knife[:latest]--latest option.The following knife cookbook list settings can be added to the knife.rb file:
knife[:all]--all option.knife[:environment]--environment option.The following knife cookbook metadata settings can be added to the knife.rb file:
knife[:all]--all option.The following knife cookbook show settings can be added to the knife.rb file:
knife[:fqdn]--fqdn option.knife[:platform]--platform option.knife[:platform_version]--platform-version option.The following knife cookbook test settings can be added to the knife.rb file:
knife[:all]--all option.The following knife cookbook upload settings can be added to the knife.rb file:
knife[:all]--all option.knife[:depends]--include-dependencies option.knife[:environment]--environment option.knife[:force]--force option.knife[:freeze]--freeze option.The following knife cookbook site download settings can be added to the knife.rb file:
knife[:file]--file option.knife[:force]--force option.The following knife cookbook site install settings can be added to the knife.rb file:
knife[:cookbook_path]--cookbook-path option.knife[:file]--file option.knife[:no_deps]--skip-dependencies option.knife[:use_current_branch]--use-current-branch option.The following knife cookbook site share settings can be added to the knife.rb file:
knife[:cookbook_path]--cookbook-path option.The following knife data bag create settings can be added to the knife.rb file:
knife[:secret]--secret option.knife[:secret_file]--secret-file option.The following knife data bag edit settings can be added to the knife.rb file:
knife[:print_after]--print-after option.knife[:secret]--secret option.knife[:secret_file]--secret-file option.The following knife data bag from file settings can be added to the knife.rb file:
knife[:all]--all option.knife[:secret]--secret option.knife[:secret_file]--secret-file option.The following knife data bag show settings can be added to the knife.rb file:
knife[:secret]--secret option.knife[:secret_file]--secret-file option.The following knife delete settings can be added to the knife.rb file:
knife[:chef_repo_path]--chef-repo-path option.knife[:concurrency]--concurrency option.knife[:recurse]--recurse option.knife[:repo_mode]--repo-mode option.The following knife deps settings can be added to the knife.rb file:
knife[:chef_repo_path]--chef-repo-path option.knife[:concurrency]--concurrency option.knife[:recurse]--recurse option.knife[:remote]--remote option.knife[:repo_mode]--repo-mode option.knife[:tree]--tree option.The following knife diff settings can be added to the knife.rb file:
knife[:chef_repo_path]--chef-repo-path option.knife[:concurrency]--concurrency option.knife[:name_only]--name-only option.knife[:name_status]--name-status option.knife[:recurse]--recurse option.knife[:repo_mode]--repo-mode option.The following knife download settings can be added to the knife.rb file:
knife[:chef_repo_path]--chef-repo-path option.knife[:concurrency]--concurrency option.knife[:recurse]--recurse option.knife[:repo_mode]--repo-mode option.The following knife edit settings can be added to the knife.rb file:
knife[:chef_repo_path]--chef-repo-path option.knife[:concurrency]--concurrency option.knife[:disable_editing]--disable-editing option.knife[:editor]--editor option.knife[:local]--local option.knife[:repo_mode]--repo-mode option.The following knife environment create settings can be added to the knife.rb file:
knife[:description]--description option.The following knife environment from file settings can be added to the knife.rb file:
knife[:all]--all option.knife[:print_after]--print-after option.The following knife exec settings can be added to the knife.rb file:
knife[:exec]--exec option.knife[:script_path]--script-path option.The following knife list settings can be added to the knife.rb file:
knife[:bare_directories]-d option.knife[:chef_repo_path]--chef-repo-path option.knife[:concurrency]--concurrency option.knife[:recursive]-R option.knife[:repo_mode]--repo-mode option.The following knife node from file settings can be added to the knife.rb file:
knife[:print_after]--print-after option.The following knife node list settings can be added to the knife.rb file:
knife[:environment]--environment option.The following knife node run list add settings can be added to the knife.rb file:
knife[:after]--after option.knife[:run_list]The following knife node run list remove settings can be added to the knife.rb file:
knife[:run_list]The following knife raw settings can be added to the knife.rb file:
knife[:chef_repo_path]--chef-repo-path option.knife[:concurrency]--concurrency option.knife[:input]--input option.knife[:method]--method option.knife[:pretty]--[no-]pretty option.knife[:repo_mode]--repo-mode option.The following knife role create settings can be added to the knife.rb file:
knife[:description]--description option.The following knife role from file settings can be added to the knife.rb file:
knife[:print_after]--print-after option.The following knife role show settings can be added to the knife.rb file:
knife[:environment]--environment option.The following knife ssh settings can be added to the knife.rb file:
knife[:concurrency]--concurrency option.knife[:identity_file]--identity-file option.knife[:host_key_verify]--[no-]host-key-verify option.knife[:manual]--manual-list option.knife[:ssh_attribute]--attribute option.knife[:ssh_gateway]--ssh-gateway option.knife[:ssh_password]--ssh-password option.knife[:ssh_port]--ssh-port option.knife[:ssh_user]--ssh-user option.The following knife status settings can be added to the knife.rb file:
knife[:hide_healthy]--hide-healthy option.knife[:run_list]--run-list option.knife[:sort_reverse]--sort-reverse option.The following knife upload settings can be added to the knife.rb file:
knife[:chef_repo_path]--chef-repo-path option.knife[:concurrency]--concurrency option.knife[:recurse]--recurse option.knife[:repo_mode]--repo-mode option.The following knife user create settings can be added to the knife.rb file:
knife[:admin]--admin option.knife[:file]--file option.knife[:user_key]--user-key option.knife[:user_password]--password option.The following knife user reregister settings can be added to the knife.rb file:
knife[:file]--file option.The following knife delete settings can be added to the knife.rb file:
knife[:chef_repo_path]--chef-repo-path option.knife[:concurrency]--concurrency option.knife[:diff]--diff option.knife[:dry_run]--dry-run option.knife[:force]--force option.knife[:local]--local option.knife[:max_arguments_per_command]--max-args option.knife[:max_command_line]--max-chars option.knife[:null_separator]-0 option.knife[:patterns]--pattern option.knife[:replace_all]--replace option.knife[:replace_first]--replace-first option.knife[:repo_mode]--repo-mode option.knife[:verbose_commands]-t option.
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs-archive.chef.io/release/12-13/config_rb_knife_optional_settings.html