cookbook 'chef-client-cron', '~> 1.0.4'
The chef-client-cron cookbook has been deprecated
Author provided reason for deprecation:
The chef-client-cron cookbook has been deprecated and is no longer being maintained by its authors. Use of the chef-client-cron cookbook is no longer recommended.
You may find that the cron cookbook is a suitable alternative.
chef-client-cron (1) Versions 1.0.4 Follow2
Manages aspects of only chef-client
cookbook 'chef-client-cron', '~> 1.0.4', :supermarket
knife supermarket install chef-client-cron
knife supermarket download chef-client-cron
Description
This cookbook is used to configure a system as a Chef Client.
Requirements
Chef 0.9.12 or higher is required.
Platforms
The following platforms are supported by this cookbook, meaning that the recipes run on these platforms without error.
- Debian
- Ubuntu
- Red Hat
- CentOS
- Fedora
- ArchLinux
- FreeBSD
- Mac OS X
Opscode Cookbooks
Other cookbooks can be used with this cookbook but they are not explicitly required. The default settings in this cookbook do not require their use. The other cookbooks (on community.opsocde.com) are:
- bluepill
- daemontools
- runit
See USAGE below.
Attributes
-
node["chef_client"]["interval"]
- SetsChef::Config[:interval]
via command-line option for number of seconds between chef-client daemon runs. Default 1800. -
node["chef_client"]["splay"]
- SetsChef::Config[:splay]
via command-line option for a random amount of seconds to add to interval. Default 20. -
node["chef_client"]["log_dir"]
- Sets directory used inChef::Config[:log_location]
via command-line option to a location where chef-client should log output. Default "/var/log/chef". -
node["chef_client"]["conf_dir"]
- Sets directory used via command-line option to a location where chef-client search for the client config file . Default "/etc/chef". -
node["chef_client"]["bin"]
- Sets the full path to thechef-client
binary. Mainly used to set a specific path if multiple versions of chef-client exist on a system or the bin has been installed in a non-sane path. Default "/usr/bin/chef-client" -
node["chef_client"]["server_url"]
- SetsChef::Config[:chef_server_url]
in the config file to the Chef Server URI. Default "http://localhost:4000". See USAGE. -
node["chef_client"]["validation_client_name"]
- SetsChef::Config[:validation_client_name]
in the config file to the name of the validation client. Default "chef-validator". See USAGE. -
node["chef_client"]["init_style"]
- Sets up the client service based on the style of init system to use. Default is based on platform and falls back to "none". See USAGE. -
node["chef_client"]["run_path"]
- Directory location where chef-client should write the PID file. Default based on platform, falls back to "/var/run". -
node["chef_client"]["cache_path"]
- Directory location forChef::Config[:file_cache_path]
where chef-client will cache various files. Default is based on platform, falls back to "/var/chef/cache". -
node["chef_client"]["backup_path"]
- Directory location forChef::Config[:file_backup_path]
where chef-client will backup templates and cookbook files. Default is based on platform, falls back to "/var/chef/backup". - node["chef_client"]["cron"]["minute"] - The hour that chef-client will run as a cron task, only applicable if the you set "cron" as the "init_style"
- node["chef_client"]["cron"]["hour"] - The hour that chef-client will run as a cron task, only applicable if the you set "cron" as the "init_style"
Recipes
This section describes the recipes in the cookbook and how to use them in your environment.
config
Sets up the /etc/chef/client.rb
config file from a template and reloads the configuration for the current chef-client run.
service
Use this recipe on systems that should have a chef-client
daemon running, such as when Knife bootstrap was used to install Chef on a new system.
This recipe sets up the chef-client
service depending on the init_style
attribute (see above). The following init styles are supported:
- init - uses the init script included in the chef gem, supported on debian and redhat family distributions.
- upstart - uses the upstart job included in the chef gem, supported on ubuntu.
- arch - uses the init script included in this cookbook for ArchLinux, supported on arch.
- runit - sets up the service under runit, supported on ubuntu, debian and gentoo.
- bluepill - sets up the service under bluepill. As bluepill is a pure ruby process monitor, this should work on any platform.
- daemontools -sets up the service under daemontools, supported on debian, ubuntu and arch
- bsd - prints a message about how to update BSD systems to enable the chef-client service, supported on Free/OpenBSD and OSX.
default
Includes the chef-client::service
recipe by default.
delete_validation
Use this recipe to delete the validation certificate (default /etc/chef/validation.pem
) when using a chef-client
after the client has been validated and authorized to connect to the server.
Beware if using this on your Chef Server. First copy the validation.pem certificate file to another location, such as your knife configuration directory (~/.chef
) or Chef Repository.
USAGE
Create a base
role that will represent the base configuration for any system that includes managing aspects of the chef-client. Add recipes to the run list of the role, customize the attributes, and apply the role to nodes. For example, the following role (Ruby DSL) will set the init style to init
, delete the validation certificate (as the client would already be authenticated) and set up the chef-client as a service using the init style.
name "base"
description "Base role applied to all nodes"
override_attributes(
"chef_client" => {
"init_style" => "init"
}
)
run_list(
"recipe[chef-client::delete_validation]",
"recipe[chef-client::config]",
"recipe[chef-client::service]"
)
The chef-client::config
recipe is only required with init style init
(default setting for the attribute on debian/redhat family platforms, because the init script doesn't include the pid_file
option which is set in the config.
The default Chef Server will be http://localhost:4000
which is the Chef::Config[:chef_server_url]
default value. To use the config recipe with the Opscode Platform, for example, add the following to the override_attributes
override_attributes(
"chef_client" => {
"server_url" => "https://api.opscode.com/organizations/ORGNAME",
"validation_client_name" => "ORGNAME-validator"
}
)
Where ORGNAME is your Opscode Platform organization name. Be sure to add these attributes to the role if modifying per the section below.
You can also set all of the Chef::Config
http proxy related settings. By default Chef will not use a proxy.
override_attributes(
"chef_client" => {
"http_proxy" => "http://proxy.vmware.com:3128",
"https_proxy" => "http://proxy.vmware.com:3128",
"http_proxy_user" => "my_username",
"http_proxy_pass" => "Awe_some_Pass_Word!",
"no_proxy" => "*.vmware.com,10.*"
}
)
Alternate Init Styles
The alternate init styles available are:
- runit
- bluepill
- daemontools
For usage, see below.
Runit
To use runit, download the cookbook from the cookbook site.
knife cookbook site vendor runit -d
Change the init_style
to runit in the base role and add the runit recipe to the role's run list:
name "base"
description "Base role applied to all nodes"
override_attributes(
"chef_client" => {
"init_style" => "runit"
}
)
run_list(
"recipe[chef-client::delete_validation]",
"recipe[runit]",
"recipe[chef-client]"
)
The chef-client
recipe will create the chef-client service configured with runit. The runit run script will be located in /etc/sv/chef-client/run
. The output log will be in the runit service directory, /etc/sv/chef-client/log/main/current
.
Bluepill
To use bluepill, download the cookbook from the cookbook site.
knife cookbook site vendor bluepill -d
Change the init_style
to runit in the base role and add the bluepill recipe to the role's run list:
name "base"
description "Base role applied to all nodes"
override_attributes(
"chef_client" => {
"init_style" => "bluepill"
}
)
run_list(
"recipe[chef-client::delete_validation]",
"recipe[bluepill]",
"recipe[chef-client]"
)
The chef-client
recipe will create the chef-client service configured with bluepill. The bluepill "pill" will be located in /etc/bluepill/chef-client.pill
. The output log will be to client.log file in the node["chef_client"]["log_dir"]
location, /var/log/chef/client
by default.
Daemontools
To use daemontools, download the cookbook from the cookbook site.
knife cookbook site vendor daemontools -d
Change the init_style
to runit in the base role and add the daemontools recipe to the role's run list:
name "base"
description "Base role applied to all nodes"
override_attributes(
"chef_client" => {
"init_style" => "daemontools"
}
)
run_list(
"recipe[chef-client::delete_validation]",
"recipe[daemontools]",
"recipe[chef-client]"
)
The chef-client
recipe will create the chef-cilent service configured under daemontools. It uses the same sv run scripts as the runit recipe. The run script will be located in /etc/sv/chef-client/run
. The output log will be in the daemontools service directory, /etc/sv/chef-client/log/main/current
.
Templates
chef-client.pill.erb
Bluepill configuration for the chef-client service.
client.rb.erb
Configuration for the client, lands in directory specified by node["chef_client"]["conf_dir"]
(/etc/chef/client.rb
by default).
sv-chef-client-*run.erb
Runit and Daemontools run script for chef-client service and logs.
Logs will be located in the node["chef_client"]["log_dir"]
.
Changes/Roadmap
Future
- windows platform support
1.0.2:
- [CHEF-2491] init scripts should implement reload
1.0.0:
- [COOK-204] chef::client pid template doesn't match package expectations
- [COOK-491] service config/defaults should not be pulled from Chef gem
- [COOK-525] Tell bluepill to daemonize chef-client command
- [COOK-554] Typo in backup_path
- [COOK-609] chef-client cookbook fails if init_type is set to upstart and chef is installed from deb
- [COOK-635] Allow configuration of path to chef-client binary in init script
License and Author
Author:: Joshua Timberman (joshua@opscode.com)
Author:: Seth Chisamore (schisamo@opscode.com)
Author:: Bryan Berry (bryan.berry@gmail.com)
Copyright:: 2010-2011, Opscode, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
1.0.4 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.0.4 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.0.4 failed this metric
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/default.rb:20
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/service.rb:127
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/service.rb:139
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/service.rb:187
FC064: Ensure issues_url is set in metadata: chef-client-cron/metadata.rb:1
FC065: Ensure source_url is set in metadata: chef-client-cron/metadata.rb:1
FC066: Ensure chef_version is set in metadata: chef-client-cron/metadata.rb:1
FC069: Ensure standardized license defined in metadata: chef-client-cron/metadata.rb:1
FC104: Use the :run action in ruby_block instead of :create: chef-client-cron/recipes/config.rb:39
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
1.0.4 passed this metric
Testing File Metric
1.0.4 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.4 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.0.4 failed this metric
1.0.4 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.0.4 failed this metric
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/default.rb:20
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/service.rb:127
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/service.rb:139
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/service.rb:187
FC064: Ensure issues_url is set in metadata: chef-client-cron/metadata.rb:1
FC065: Ensure source_url is set in metadata: chef-client-cron/metadata.rb:1
FC066: Ensure chef_version is set in metadata: chef-client-cron/metadata.rb:1
FC069: Ensure standardized license defined in metadata: chef-client-cron/metadata.rb:1
FC104: Use the :run action in ruby_block instead of :create: chef-client-cron/recipes/config.rb:39
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
1.0.4 passed this metric
Testing File Metric
1.0.4 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.4 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.0.4 failed this metric
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/service.rb:127
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/service.rb:139
FC007: Ensure recipe dependencies are reflected in cookbook metadata: chef-client-cron/recipes/service.rb:187
FC064: Ensure issues_url is set in metadata: chef-client-cron/metadata.rb:1
FC065: Ensure source_url is set in metadata: chef-client-cron/metadata.rb:1
FC066: Ensure chef_version is set in metadata: chef-client-cron/metadata.rb:1
FC069: Ensure standardized license defined in metadata: chef-client-cron/metadata.rb:1
FC104: Use the :run action in ruby_block instead of :create: chef-client-cron/recipes/config.rb:39
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
1.0.4 passed this metric
Testing File Metric
1.0.4 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.4 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.0.4 failed this metric
1.0.4 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number