Clockwork

res_package(5)

NAME

res_package - Clockwork Resource Type for software packages

DESCRIPTION

The package resource allows administrators to specify what software should be installed (or not installed) on what hosts. Package management is performed through the local system's package manager; standalone installation scripts (i.e. .bin files) are not supported.

The following Linux package managers are currently supported:

YUM

For RPM-based platforms (RedHat, CentOS, SuSE, OEL, etc.)

APT

For DPKG-based platforms (Debian, Ubuntu, etc.)

ATTRIBUTES

name

The name of the software package, according to the local package manager. This may be different based on host architecture; conditional policy constructs should be used to get the correct name.

version

The (optional) version of the package to install. If not specified, and the package is not already installed, the latest available version will be used. The special value "any" forces this default behavior.

The special value "latest" is will cause Clockwork to keep the installed package at the latest version, upgrading as needed.

installed

Whether or not the package should be installed on the system. Valid values are "yes" and "no". Default value is "yes".

EXAMPLES

Installation of Packages

Ensure that the apache web server package, httpd, is installed and up-to-date:

package "httpd" { }

Even though the default behavior of the package resource is to install the software package, explicitly specifying this is considered good practice:

package "httpd" {
    installed: "yes"
}

Same as the above, but use the 2.2 version of Apache, not the latest available version:

package "httpd" {
    installed: "yes"
    version:   "2.2"
}

Removal of Packages

Removing packages is easy; just set installed to "no":

package "emacs" {
    installed: "no"
}

Platform Detection and Package Names

Not all distributions name their packages the same way. Using if constructs in the policy definition makes it easy to accommodate different naming schemes.

For this example, assume we want to install mypackage on CentOS and Ubuntu machines in your infrastructure. The Ubuntu package name is my-package-core, but the CentOS package name is mypackage.

(We also assume that there are no other platforms to worry about.)

package "mypackage" {

    # override the package name for Ubuntu
    if (lsb.distro.id is "Ubuntu") {
        name: "my-package-core"
    }

    installed: "yes"
}

The above resource definition works because the initial package name will be set to "mypackage", and then overidden if the agent is running on Ubuntu.

CAVEATS

1. Package Removal and Versioning

Version information (set by the version attribute) is ignored if the package is set to be removed.

DEPENDENCIES

None.

Note: Package dependency resolution (i.e. apache depends on the apr-util package) is handled solely by the package manager.

AUTHOR

Clockwork was designed and written by James Hunt.

The Clockwork website is licensed under the Creative Commons Attribution-NoDerivs 3.0 United States License