Update your chef client with omnibus! This cookbook can install the omnibus chef package into your system if you are currently running via gem install, and it can keep your omnibus install up to date.
This cookbook is inspired by the omnibus_updater cookbook and essentially performs the same function but improves it in various areas:
- It uses idiomatic Ruby and is way less entangled with callbacks and notifications.
- It only performs web requests if absolutely necessary. The omnibus_updater cookbook will perform a web request on each execution and will fail if the Chef web servive is not reachable for any reason.
- It provides an LWRP for its core functionality, allowing easier and more flexible usage in other cookbooks.
The default recipe checks some preconditions and then just includes the
install
cookbook.
The install cookbook installs the Omnibus Chef client package. By default, it will install the latest available version of Chef which might not be what you actually want (you can set the exact version in an attribute, see below).
Also, by default, it will kill the current chef run directly after having updated the chef version. This is heavily recommended to ensure a clean state for the following cookbooks. During an update, internal chef libraries may change, move, or no longer exist. The currently running instance can encounter unexpected states because of this. To prevent this, the updater will attempt to kill the Chef instance so that it can be restarted in a normal state.
Please see the Attributes section below options to configure this behavior.
This optional recipe removes the chef gem if it is installed to the system ruby. This might be useful if Chef was installed as a system gem once and you are now migrating to an Omnibus based install.
All attributes are namespaced under node['omnibus_chef']
. The full
attribute name is thus e.g. node['omnibus_chef']['version']
.
You can override any of these attributes
Attribute | Default | Description |
---|---|---|
download_url |
nil |
When set to a full URL, we will use this to download the Omnibus
package. We will then ignore all the the version and platform settings.
The URL must provide the correct package for the current platform and
machine as well as the correct expected package format (e.g.
.deb on Debian/Ubuntu).
|
version |
"latest" |
Set the exact vesion to install or "latest" to install the
latest version available.
|
prerelease |
false |
If set to true , pre-release versions of chef-client might
also be installed if they match the version constraint.
|
machine |
the architecture for the Omnitruck API |
We try to set this automatically based on information from Ohai. If
required, you can override it to set the desired architecture, but it
should generally not be necessary to touch this.
|
platform |
the current platform for the Omnitruck API |
We try to set this automatically based on information from Ohai. If
required, you can override it to set the desired platform, but it should
generally not be necessary to touch this.
|
platform_version |
the current platform version for the Omnitruck API |
We try to set this automatically based on information from Ohai. If
required, you can override it to set the desired platform version,
but it should generally not be necessary to touch this.
|
use_https |
true |
Set to true to contact the Omnitruck API via https. This
ensures that all information with the API (including the download of the
package to be installed) is retreived via https.
|
prevent_downgrade |
false |
Set to true to prevent the installation of a lower version
than is currently installed.
|
when |
"immediately" |
This attribute determines when in a Chef run the package should be
updated.
|
kill_chef_on_upgrade |
true |
When updating immediately (i.e. if the when attribute is
set to "immediately" , this ensures that the the current
chef run is killed after an update to ensure a clean state for the
following cookbooks.
|
restart_chef_client_service |
false |
If set to true , the chef-client service is
restarted after an upgrade. If you use chef as a service, it is a good
idea to set this to true .
|
Copyright 2014 Holger Just
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 limitations under the License.