The client.rb file specifies how Chef Infra Client is configured on a node and has the following characteristics:
C:\chef\client.rb. On all other systems the default location for this file is /etc/chef/client.rb.--config option from the command line to override the default location of the configuration file.This configuration file has the following settings:
add_formatterallowed_automatic_attributesdefault attributes, preventing non-allowed attributes from being saved.allowed_default_attributesdefault attributes, preventing non-allowed attributes from being saved.allowed_normal_attributesnormal attributes, preventing non-allowed attributes from being saved.allowed_override_attributesoverride attributes, preventing non-allowed attributes from being saved.authentication_protocol_versionknife[:authentication_protocol_version] = '1.3'
Note
automatic_attribute_blacklistautomatic attributes, preventing blocked attributes from being saved. Deprecated. EOL Chef Infra Client 18 (April 2022): Use blocked_automatic_attributes.automatic_attribute_whitelistautomatic attributes, preventing non-allowed attributes from being saved. Deprecated. EOL Chef Infra Client 18 (April 2022): Use allowed_automatic_attributes.blocked_automatic_attributesautomatic attributes, preventing blocked attributes from being saved.blocked_default_attributesdefault attributes, preventing block attributes from being saved.blocked_normal_attributesautomatic attributes, preventing non-allowed attributes from being saved.blocked_override_attributesoverride attributes, preventing blocked attributes from being saved.cache_pathchecksum_pathchef_guidchef_licenseaccept or accept-no-persist, which persists the license acceptance to disk. If passed to versions where the license is not required this configuration option is a no-op.chef_repo_pathchef_server_urlhttps://localhost/organizations/ORG_NAME
chef_zero.enabledlocal_mode to be set to true. Default value: true if running in local-mode, otherwise false.chef_zero.port10,20,30 or 10000-20000. Default value: 8889-9999.clear_gem_sourcesclear_sources property on the gem_package and chef_gem resources. Default value: false.client_forktrue. Set to false to disable running Chef Infra Client in fork node. Note
false up to Chef Client 13.11.3 to gather the standard return code offered by exit_status true. Later versions run as expected without changes to the configuration file. client_key/etc/chef/client.pem.client_registration_retries5.client_d_dircookbook_pathcookbook_sync_threads10.data_bag_decrypt_minimum_version1, 2, and 3. It is recommended to use the default value of 3 for additional encrypted data bag security.data_bag_path/var/chef/data_bags.data_collector.server_urldata_collector.tokenx-data-collector-token which the server can choose to accept or reject.data_collector.mode:solo, :client, or :both. The :solo value is used for Chef Infra Client operating in Chef Solo Mode or Chef Solo Legacy Mode. Default value: both.data_collector.raise_on_failurefalse.default_attribute_blacklistdefault attributes, preventing block attributes from being saved. Deprecated. EOL Chef Infra Client 18 (April 2022): Use blocked_default_attributes.default_attribute_whitelistdefault attributes, preventing non-allowed attributes from being saved. Deprecated. EOL Chef Infra Client 18 (April 2022): Use allowed_default_attributes.diff_disabledfalse.diff_filesize_threshold10000000.diff_output_threshold1000000.disable_event_loggerfalse to send events to the Microsoft Windows “Application” event log at the start and end of a Chef Infra Client run, and also if a Chef Infra Client run fails. Use log_location to set the destination of your Chef Infra Client logs to the Windows event log. Set to true to disable event logging. Default value: false.enable_reportingenable_reporting_url_fatalsenable_selinux_file_permission_fixuprestorecon command. Set to false to prevent Chef Infra Client from attempting this action.encrypted_data_bag_secretenforce_default_pathsenforce_path_sanityenforce_default_paths.environmentenvironment_path/var/chef/environments.exit_status:enabled, Chef Infra Client will use standardized exit codes for the Chef Infra Client run status, and any non-standard exit codes will be converted to 1 or GENERIC_FAILURE. This setting can also be set to :disabled to use the pre-Chef Infra Client 13 exit code behavior. Default value: nil.file_atomic_updatetrue for global atomic file updates. Set to false for global non-atomic file updates. (Use the atomic_update setting on a per-resource basis to override this setting.) Default value: true. Warning
false may cause file corruption, data loss, or instability. Use the atomic_update property on the cookbook_file, file, remote_file, and template resources to tune this behavior at the recipe level. file_backup_path/var/chef/backup.file_cache_pathfile_staging_uses_destdirtrue, temporary files are created in the directory in which files will reside. When false, temporary files are created under ENV['TMP']. Default value: true.fipstrue to enable FIPS-validated security.force_formatterforce_loggerftp_proxyftp_proxy_passnil.ftp_proxy_usernil.groupnil.gem_installer_bundler_optionsnil. For example gem_installer_bundler_options = [
"--local", "--clean"
]
or
gem_installer_bundler_options = "--local"
http_proxynil.http_proxy_passnil.http_proxy_usernil.http_retry_count5.http_retry_delay5.https_proxynil.https_proxy_passnil.https_proxy_usernil.interval1800.json_attribslistenfalse to disable port binding and HTTP requests on localhost.local_key_generationtrue, Chef Infra Client generates the key pair, and then sends the public key to the Chef Infra Server. Default value: true.local_modelockfilefile_cache_path. The default location of a lock file should not be on an NFS mount. Default value: a location defined by file_cache_path.log_level:auto (default), :trace, :debug, :info, :warn, :error, or :fatal. The :auto level will use :warn when a terminal is available or :info when a terminal is not available.log_location/path/to/log_location, STDOUT, STDERR, :win_evt (Windows Event Logger), or :syslog (writes to the syslog daemon facility with the originator set as chef-client). The application log will specify the source as Chef. Default value: STDOUT.minimal_ohaicloud or packages. Setting this to true may break cookbooks that assume all Ohai data will be present.named_run_listno_lazy_loadtrue.no_proxynil.node_nameclient_name, which is the name used when authenticating to a Chef Infra Server. By default, Chef Infra Client will use the system’s FQDN as the node name. In general, Chef recommends that you leave this setting blank and let the client assign the FQDN of the node as the node_name during each Chef Infra Client run.node_path/var/chef/node.normal_attribute_blacklistnormal attributes, preventing blocked attributes from being saved. Deprecated. EOL Chef Infra Client 18 (April 2022): Use blocked_normal_attributes.override_attribute_blacklistoverride attributes, preventing blocked attributes from being saved. Deprecated. EOL Chef Infra Client 18 (April 2022): Use blocked_override_attributes.normal_attribute_whitelistnormal attributes, preventing non-allowed attributes from being saved. Deprecated. EOL Chef Infra Client 18 (April 2022): Use allowed_normal_attributes.override_normal_attributesoverride attributes, preventing non-allowed attributes from being saved.override_attribute_whitelistoverride attributes, preventing non-allowed attributes from being saved. Deprecated. EOL Chef Infra Client 18 (April 2022): Use allowed_override_attributes.pid_file/tmp/name-of-executable.pid.policy_grouppolicy_name must also be specified.policy_group_pathpolicy_namename setting in a Policyfile.rb file. policy_group must also be specified.policy_pathrecipe_urlrest_timeout300.role_path/var/chef/roles.rubygems_urlhttps://www.rubygems.org. If a source is specified in either gem_package of chef_gem resources it will be added to the values provided here.run_lock_timeout0 to cause a second Chef Infra Client to exit immediately.script_pathskip_gem_metadata_installationskip_gem_metadata_installation is set to true, cookbook gem installation will be skipped. Default value: false
splaysplay that is added to interval. Use splay to help balance the load on the Chef Infra Server by ensuring that many Chef Infra Client runs are not occurring at the same interval. Default value: nil.stream_execute_outputexecute resources even if the live_stream property isn’t set to true. Default value: false
show_download_progressremote_file download. Default value: false
download_progress_intervalshow_download_progress is set to true this is the interval in seconds to write out download progress. Default value: 10
ssl_ca_filessl_ca_pathssl_client_certnil.ssl_client_keynil.ssl_verify_mode:verify_none for no validation of SSL certificates.:verify_peer for validation of all SSL certificates, including the Chef Infra Server connections, S3 connections, and any HTTPS remote_file resource URLs used in Chef Infra Client runs. This is the recommended setting.Depending on how OpenSSL is configured, the ssl_ca_path may nee to be specified. Default value: :verify_peer.
trusted_certs_dirtrusted_certs directory in your chef configuration directory.umask0022.use_policyfilefalse.usernil.validation_client_namevalidation_keyvalidation_client_name for authentication. Default value: /etc/chef/validation.pem. This is only used by the legacy validator based bootstrapping.verbose_loggingtrue, nil, and false. When this is set to false, notifications about individual resources being processed are suppressed (and are output at the :info logging level). Setting this to false can be useful when a Chef Infra Client is run as a daemon. Default value: nil.verify_api_certtrue, Chef Infra Client always verifies the SSL certificate. When false, Chef Infra Client uses the value of ssl_verify_mode to determine if the SSL certificate requires verification. Default value: false. A job entry may also be 'job-name' => {:lock => true}, which will check the lockfile setting in the client.rb file before starting the job.If http_proxy, https_proxy, ftp_proxy, or no_proxy is set in the client.rb file but not set in the ENV, Chef Infra Client will configure the ENV variable based on these (and related) settings. For example:
http_proxy 'http://proxy.example.org:8080'
http_proxy_user 'myself'
http_proxy_pass 'Password1'
Or an alternative way to define the proxy (if the previous version does not work):
http_proxy 'http://myself:[email protected]:8080'
will be set to:
ENV['http_proxy'] = 'http://myself:[email protected]:8080'
Chef Infra Client supports reading multiple configuration files by putting them inside a .d configuration directory. For example: /etc/chef/client.d. All files that end in .rb in the .d directory are loaded; other non-.rb files are ignored.
.d directories may exist in any location where the client.rb, config.rb, or solo.rb files are present, such as:
/etc/chef/client.d/etc/chef/config.d~/chef/solo.d(There is no support for a knife.d directory; use config.d instead.)
For example, when using knife, the following configuration files would be loaded:
~/.chef/config.rb~/.chef/config.d/company_settings.rb~/.chef/config.d/ec2_configuration.rb~/.chef/config.d/old_settings.rb.bakThe old_settings.rb.bak file is ignored because it’s not a configuration file. The config.rb, company_settings.rb, and ec2_configuration files are merged together as if they are a single configuration file.
Note
If multiple configuration files exists in a .d directory, ensure that the same setting has the same value in all files.
Ohai configuration settings can be added to the client.rb file.
ohai.directoryThe directory in which Ohai plugins are located.
ohai.disabled_pluginsAn array of Ohai plugins to be disabled on a node. The list of plugins included in Ohai can be found in the ohai/lib/ohai/plugins source. For example, disabling a single plugin:
ohai.disabled_plugins = [
:MyPlugin
]
or disabling multiple plugins:
ohai.disabled_plugins = [
:MyPlugin,
:MyPlugin2,
:MyPlugin3
]
When a plugin is disabled, the Chef Infra Client log file will contain entries similar to:
[2014-06-13T23:49:12+00:00] DEBUG: Skipping disabled plugin MyPlugin
ohai.hints_pathThe path to the file that contains hints for Ohai.
ohai.log_levelThe level of logging to be stored in a log file.
ohai.log_locationThe location of the log file.
ohai.plugin_pathAn array of paths at which Ohai plugins are located. Default value: [<CHEF_GEM_PATH>/ohai-9.9.9/lib/ohai/plugins]. When custom Ohai plugins are added, the paths must be added to the array. For example, a single plugin:
ohai.plugin_path << '/etc/chef/ohai_plugins'
and for multiple plugins:
ohai.plugin_path += [
'/etc/chef/ohai_plugins',
'/path/to/other/plugins'
]
Note
The Ohai executable ignores settings in the client.rb file when Ohai is run independently of Chef Infra Client.
A sample client.rb file that contains the most simple way to connect to Hosted Chef
chef_server_url 'https://api.chef.io/organizations/<orgname>'
validation_client_name '<orgname>-validator'
validation_key '/etc/chef/validator.pem'
client_key '/etc/chef/client.pem'
© 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.chef.io/config_rb_client/