A client.rb file is used to specify the configuration details for the chef-client.
/etc/chef/client.rb; on Microsoft Windows machines, the default location for this file is C:\chef\client.rb; use the --config option from the command line to change this locationThis configuration file has the following settings:
add_formatteraudit_modeaudit-only to skip the converge phase of the chef-client run and only perform audits. Possible values: audit-only, disabled, and enabled. Default value: disabled.automatic_attribute_whitelistautomatic attributes, preventing non-whitelisted attributes from being saved.cache_pathchecksum_pathchef_repo_pathchef_server_urlThe URL for the Chef server. For example:
https://localhost/organizations/ORG_NAME
chef_zero.enabledlocal_mode to be set to true. Default value: false.chef_zero.port10,20,30 or 10000-20000. Default value: 8889-9999.client_key/etc/chef/client.pem.client_registration_retries5.chef_gem_compile_timeControls the phase during which a gem is installed on a node. Set to true to install a gem while the resource collection is being built (the “compile phase”). Set to false to install a gem while the chef-client is configuring the node (the “converge phase”). Recommended value: false.
Note
To suppress warnings for cookbooks authored prior to chef-client 12.1, use a respond_to? check to ensure backward compatibility. For example:
chef_gem 'aws-sdk' do compile_time false if respond_to?(:compile_time) end
cookbook_pathcookbook_sync_threads10.data_bag_decrypt_minimum_version0, 1, and 2. When all of the machines in an organization are running chef-client version 11.6 (or higher), it is recommended that this value be set to 2.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 operating in Chef Solo Mode or Chef Solo Legacy Mode. Default value: both.data_collector_raise_on_failurefalse.default_attribute_whitelistdefault attributes, preventing non-whitelisted attributes from being saved.diff_disabledfalse.diff_filesize_threshold10000000.diff_output_threshold1000000.disable_event_loggerfalse, events are sent to the Microsoft Windows “Application” event log at the start and end of a chef-client run, and also if a chef-client run fails. Set to true to disable event logging. Default value: true.enable_reportingenable_reporting_url_fatalsenable_selinux_file_permission_fixuprestorecon command. Set this value to false to prevent the chef-client from attempting this action.encrypted_data_bag_secretenvironmentenvironment_path/var/chef/environments.exit_statusWhen set to :enabled, chef-client will use stardardized exit codes for Chef 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 which preserves the old behavior of using non-standardized exit codes and skips the deprecation warnings. Default value: nil.
Note
The behavior with the default value consists of a warning on the use of deprecated and non-standard exit codes. In a future release of Chef client, using standardized exit codes will be the default behavior.
New in Chef Client 12.11.
file_atomic_updateApply atomic file updates to all resources. Set to true 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
Changing this setting to 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.ftp_proxyftp_proxy_passnil.ftp_proxy_usernil.groupnil.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, the chef-client generates the key pair, and then sends the public key to the Chef server. Default value: true.local_modelockfilefile_cache_path. The default location of a lock file should not on an NF mount. Default value: a location defined by file_cache_path.log_level:auto (default), :debug, :info, :warn, :error, or :fatal. Default value: :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_ohaitrue during integration testing to speed up test cycles.named_run_listno_lazy_loadtrue.no_proxynil.node_nameclient_name, which is the name used when authenticating to a Chef server. The default value is the FQDN of the chef-client, as detected by Ohai. In general, Chef recommends that you leave this setting blank and let Ohai assign the FQDN of the node as the node_name during each chef-client run.node_path/var/chef/node.normal_attribute_whitelistnormal attributes, preventing non-whitelisted attributes from being saved.override_attribute_whitelistoverride attributes, preventing non-whitelisted attributes from being saved.pid_file/tmp/name-of-executable.pid.policy_groupname setting in a Policyfile.rb file. policy_name must also be specified.policy_namepolicy_group must also be specified.rest_timeout300.role_path/var/chef/roles.run_lock_timeout0 to cause a second chef-client to exit immediately.splaysplay that is added to interval. Use splay to help balance the load on the Chef server by ensuring that many chef-client runs are not occuring at the same interval. Default value: nil.ssl_ca_filessl_ca_pathssl_client_certnil.ssl_client_keynil.ssl_verify_modeSet the verify mode for HTTPS requests.
:verify_none to do no validation of SSL certificates.:verify_peer to do validation of all SSL certificates, including the Chef server connections, S3 connections, and any HTTPS remote_file resource URLs used in the chef-client run. This is the recommended setting.Depending on how OpenSSL is configured, the ssl_ca_path may need to be specified. Default value: :verify_peer.
syntax_check_cache_pathumask0022.use_policyfilefalse.usernil.validation_client_namevalidation_keyvalidation_client_name for authentication. Default value: /etc/chef/validation.pem.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-client is run as a daemon. Default value: nil.verify_api_certtrue, the chef-client always verifies the SSL certificate. When false, the chef-client uses the value of ssl_verify_mode to determine if the SSL certificate requires verification. Default value: false.whitelistA Hash that contains the whitelist used by Chef push jobs. For example:
whitelist {
'job-name' => 'command',
'job-name' => 'command',
'chef-client' => 'chef-client'
} 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.
Warning
The whitelist setting is available only when using Chef push jobs, a tool that runs jobs against nodes in an organization.
windows_service.watchdog_timeout2 * (60 * 60).yum_lock_timeout30.If http_proxy, https_proxy, ftp_proxy, or no_proxy is set in the client.rb file, the chef-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'
will be set to:
ENV['http_proxy'] = 'http://myself:[email protected]:8080'
The chef-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.dc:/chef/config.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.directoryOhai.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 directory. For example, disabling a single plugin:
Ohai.disabled_plugins = [
:MyPlugin
]
or disabling multiple plugins: Ohai.disabled_plugins = [ :MyPlugin, :MyPlugin, :MyPlugin ]
and to disable multiple plugins, including Ohai 6 plugins:
Ohai.disabled_plugins = [
:MyPlugin,
:MyPlugin,
'my_ohai_6_plugin'
] When a plugin is disabled, the chef-client log file will contain entries similar to:
[2014-06-13T23:49:12+00:00] DEBUG: Skipping disabled plugin MyPlugin
Ohai.hints_pathOhai.log_levelOhai.log_locationOhai.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' ]
Ohai.versionNote
The Ohai executable ignores settings in the client.rb file when Ohai is run independently of the chef-client.
A sample client.rb file that contains the most simple way to connect to https://manage.chef.io:
log_level :info log_location STDOUT chef_server_url 'https://api.opscode.com/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-archive.chef.io/release/12-13/config_rb_client.html