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_formatter
audit_mode
audit-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_whitelist
automatic
attributes, preventing non-whitelisted attributes from being saved.cache_path
checksum_path
chef_repo_path
chef_server_url
The URL for the Chef server. For example:
https://localhost/organizations/ORG_NAME
chef_zero.enabled
local_mode
to be set to true
. Default value: false
.chef_zero.port
10,20,30
or 10000-20000
. Default value: 8889-9999
.client_key
/etc/chef/client.pem
.client_registration_retries
5
.chef_gem_compile_time
Controls 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_path
cookbook_sync_threads
10
.data_bag_decrypt_minimum_version
0
, 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_url
data_collector_token
x-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_failure
false
.default_attribute_whitelist
default
attributes, preventing non-whitelisted attributes from being saved.diff_disabled
false
.diff_filesize_threshold
10000000
.diff_output_threshold
1000000
.disable_event_logger
false
, 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_reporting
enable_reporting_url_fatals
enable_selinux_file_permission_fixup
restorecon
command. Set this value to false
to prevent the chef-client from attempting this action.encrypted_data_bag_secret
environment
environment_path
/var/chef/environments
.exit_status
When 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_update
Apply 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_path
file_staging_uses_destdir
true
, temporary files are created in the directory in which files will reside. When false
, temporary files are created under ENV['TMP']
. Default value: true
.fips
true
to enable FIPS-validated security.ftp_proxy
ftp_proxy_pass
nil
.ftp_proxy_user
nil
.group
nil
.http_proxy
nil
.http_proxy_pass
nil
.http_proxy_user
nil
.http_retry_count
5
.http_retry_delay
5
.https_proxy
nil
.https_proxy_pass
nil
.https_proxy_user
nil
.interval
1800
.json_attribs
listen
false
to disable port binding and HTTP requests on localhost.local_key_generation
true
, the chef-client generates the key pair, and then sends the public key to the Chef server. Default value: true
.local_mode
lockfile
file_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_ohai
true
during integration testing to speed up test cycles.named_run_list
no_lazy_load
true
.no_proxy
nil
.node_name
client_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_whitelist
normal
attributes, preventing non-whitelisted attributes from being saved.override_attribute_whitelist
override
attributes, preventing non-whitelisted attributes from being saved.pid_file
/tmp/name-of-executable.pid
.policy_group
name
setting in a Policyfile.rb file. policy_name
must also be specified.policy_name
policy_group
must also be specified.rest_timeout
300
.role_path
/var/chef/roles
.run_lock_timeout
0
to cause a second chef-client to exit immediately.splay
splay
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_file
ssl_ca_path
ssl_client_cert
nil
.ssl_client_key
nil
.ssl_verify_mode
Set 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_path
umask
0022
.use_policyfile
false
.user
nil
.validation_client_name
validation_key
validation_client_name
for authentication. Default value: /etc/chef/validation.pem
.verbose_logging
true
, 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_cert
true
, 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
.whitelist
A 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_timeout
2 * (60 * 60)
.yum_lock_timeout
30
.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.d
c:/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.bak
The 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.directory
Ohai.disabled_plugins
An 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_path
Ohai.log_level
Ohai.log_location
Ohai.plugin_path
An 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.version
Note
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