solo.rb
A solo.rb file is used to specify the configuration details for chef-solo.
- This file is loaded every time this executable is run
- The default location in which chef-solo expects to find this file is
/etc/chef/solo.rb; use the--configoption from the command line to change this location - This file isn’t created by default
- When a
solo.rbfile is present in this directory, the settings contained within that file will override the default configuration settings
Settings
This configuration file has the following settings:
add_formatterA 3rd-party formatter. (See nyan-cat for an example of a 3rd-party formatter.) Each formatter requires its own entry.
checksum_pathThe location in which checksum files are stored. These are used to validate individual cookbook files, such as recipes. The checksum itself is stored in the Chef Infra Server database and is then compared to a file in the checksum path that has a filename identical to the checksum.
cookbook_pathThe Chef Infra Client sub-directory for cookbooks. This value can be a string or an array of file system locations, processed in the specified order. The last cookbook is considered to override local modifications.
data_bag_pathThe location from which a data bag is loaded. Default value:
/var/chef/data_bags.environmentThe name of the environment.
environment_pathThe path to the environment. Default value:
/var/chef/environments.file_backup_pathThe location in which backup files are stored. If this value is empty, backup files are stored in the directory of the target file. Default value:
/var/chef/backup.file_cache_pathThe location in which cookbooks (and other transient data) files are stored when they’re synchronized. This value can also be used in recipes to download files with the remote_file resource.
json_attribsThe path to a file that contains JSON data.
lockfileThe location of the Chef Infra Client lock file. This value is typically platform-dependent, so should be a location defined by
file_cache_path. The default location of a lock file shouldn’t on an NF mount. Default value: a location defined byfile_cache_path.log_levelThe level of logging to be stored in a log file. Possible levels:
:auto(default),debug,info,warn,error, orfatal.log_locationThe location of the log file. Default value:
STDOUT.minimal_ohaiRun the Ohai plugins for name detection and resource/provider selection and no other Ohai plugins. Set to
trueduring integration testing to speed up test cycles.node_nameThe unique identifier of the node.
recipe_urlThe URL location from which a remote cookbook tar.gz is to be downloaded.
rest_timeoutThe time (in seconds) after which an HTTP REST request is to time out. Default value:
300.role_pathThe location in which role files are located. Default value:
/var/chef/roles.run_lock_timeoutThe amount of time (in seconds) to wait for a Chef Infra Client lock file to be deleted. A Chef Infra Client run won’t start when a lock file is present. If a lock file isn’t deleted before this time expires, the pending Chef Infra Client run will exit. Default value: not set (indefinite). Set to
0to cause a second Chef Infra Client to exit immediately.sandbox_pathThe location in which cookbook files are stored (temporarily) during upload.
soloRun Chef Infra Client in chef-solo mode. This setting determines if Chef Infra Client is to attempt to communicate with the Chef Infra Server. Default value:
false.syntax_check_cache_pathAll files in a cookbook must contain valid Ruby syntax. Use this setting to specify the location in which knife caches information about files that have been checked for valid Ruby syntax.
umaskThe file mode creation mask, or umask. Default value:
0022.verbose_loggingSet the log level. Options:
true,nil, andfalse. When this is set tofalse, notifications about individual resources being processed are suppressed (and are output at the:infologging level). Setting this tofalsecan be useful when a Chef Infra Client is run as a daemon. Default value:nil.
Examples
Using Chef Automate Data Collector
This example solo.rb file uses the data_collector settings to send data to an available Chef Automate system. Since Chef Automate generates a self-signed SSL certificate by default, you will need to add the certificate (located under /var/opt/delivery/nginx/ on the Chef Automate server) to your trusted_certs_dir directory, as seen in this example:
chef_server_url "https://localhost:8989"
log_location STDOUT
node_name "YOUR_NODES_FQDN"
trusted_certs_dir "/etc/chef/trusted_certs"
data_collector.server_url "https://YOUR_AUTOMATE_FQDN/data-collector/v0"
data_collector.mode :both
data_collector.token = "YOURTOKEN"
You can run it like this
chef-solo -c solo.rb
All Options
A sample solo.rb file that contains all possible settings (listed alphabetically):
add_formatter :nyan
add_formatter :foo
add_formatter :bar
checksum_path '/var/chef/checksums'
cookbook_path [
'/var/chef/cookbooks',
'/var/chef/site-cookbooks'
]
data_bag_path '/var/chef/data_bags'
environment 'production'
environment_path '/var/chef/environments'
file_backup_path '/var/chef/backup'
file_cache_path '/var/chef/cache'
json_attribs nil
lockfile nil
log_level :info
log_location STDOUT
node_name 'mynode.example.com'
recipe_url 'http://path/to/remote/cookbook'
rest_timeout 300
role_path '/var/chef/roles'
sandbox_path 'path_to_folder'
solo false
syntax_check_cache_path
umask 0022
verbose_logging nil