Table of Contents
Enforce the absence of a package
Compatible with nodes running Rudder 4.0 or higher.
See package_state for documentation.
- name: Name of the package
- version: Version of the package or "any" for any version (defaults to "any")
- architecture: Architecture of the package, can be an architecture name or "default" (defaults to "default")
- provider: Package provider to use, can be "yum", "apt", "pkg" or "default" for system default package manager (defaults to "default")
package_absent_${name}_{kept, repaired, not_ok, reached}
Verify if a package is installed in any version
Compatible with nodes running Rudder 3.1 or higher.
This bundle will define a class
package_check_installed_${file_name}_{ok, reached, kept}
if the
package is installed, or
package_check_installed_${file_name}_{not_ok, reached, not_kept, failed}
if the package is not installed
- package_name: Name of the package to check
package_check_installed_${package_name}_{kept, repaired, not_ok, reached}
Install or update a package in its latest version available
Compatible with nodes running Rudder 3.1 or higher.
- package_name: Name of the package to install
package_install_${package_name}_{kept, repaired, not_ok, reached}
Install or update a package in a specific version
Compatible with nodes running Rudder 3.1 or higher.
- package_name: Name of the package to install
- package_version: Version of the package to install (can be "latest" to install it in its latest version)
package_install_${package_name}_{kept, repaired, not_ok, reached}
Install a package or verify if it is installed in a specific version, or higher or lower version than a version specified
Compatible with nodes running Rudder 3.1 or higher.
Example:
methods: "any" usebundle => package_install_version_cmp("postgresql", ">=", "9.1", "verify");
- package_name: Name of the package to install or verify
- version_comparator: Comparator between installed version and defined version, can be ==,⇐,>=,<,>,!=
- package_version: The version of the package to verify (can be "latest" for latest version)
- action: Action to perform, can be add, verify (defaults to verify)
package_install_${package_name}_{kept, repaired, not_ok, reached}
Install a package or verify if it is installed in a specific version, or higher or lower version than a version specified, optionally test update or not (Debian-, Red Hat- or SuSE-like systems only)
Compatible with nodes running Rudder 3.1 or higher.
Example:
methods: "any" usebundle => package_install_version_cmp_update("postgresql", ">=", "9.1", "verify", "false");
- package_name: Name of the package to install or verify
- version_comparator: Comparator between installed version and defined version, can be ==,⇐,>=,<,>,!=
- package_version: The version of the package to verify (can be "latest" for latest version)
- action: Action to perform, can be add, verify (defaults to verify)
- update_policy: While verifying packages, check against latest version ("true") or just installed ("false")
package_install_${package_name}_{kept, repaired, not_ok, reached}
Enforce the presence of a package
Compatible with nodes running Rudder 4.0 or higher.
See package_state for documentation.
- name: Name of the package, or path to a local package
- version: Version of the package, can be "latest" for latest version or "any" for any version (defaults to "any")
- architecture: Architecture of the package, can be an architecture name or "default" (defaults to "default")
- provider: Package provider to use, can be "yum", "apt", "pkg" or "default" for system default package manager (defaults to "default")
package_present_${name}_{kept, repaired, not_ok, reached}
Remove a package
Compatible with nodes running Rudder 3.1 or higher.
Example:
methods: "any" usebundle => package_remove("htop");
- package_name: Name of the package to remove
package_remove_${package_name}_{kept, repaired, not_ok, reached}
Enforce the state of a package
Compatible with nodes running Rudder 4.0 or higher.
These methods manage packages using a package manager on the system.
package_present
and package_absent
use a new package implementation,
different from package_install_*
, package_remove_*
and
package_verify_*
. It should be more reliable, and handle upgrades
better. It is compatible though, and you can call generic methods from
both implementations on the same host. The only drawback is that the
agent will have to maintain double caches for package lists, which may
cause a little unneeded overhead.
If you are using ncf inside Rudder, no specific setup is necessary.
If your are using ncf without Rudder, you need to call the
initialization
bundle before using package methods.
There is only one mandatory parameter, which is the package name to install. When it should be installed from a local package, you need to specify the full path to the package as name.
The version parameter allows specifying a version you want installed. It should be the complete versions string as used by the used package manager. This parameter allows two special values:
- any which is the default value, and is satisfied by any version of the given package
- latest which will ensure, at each run, that the package is at the latest available version.
The last parameter is the provider, which is documented in the next section.
You can use package_state_options to pass options to the underlying package manager (currently only with apt package manager).
This method supports several package managers. You can specify the package manager you want to use or let the method choose the default for the local system.
The package providers include a caching system for package information. The package lists (installed, available and available updates) are only updated when the cache expires, or when an operation is made by the agent on packages.
Note: The implementation of package operations is done in scripts
called modules, which you can find in
${sys.workdir}/modules/packages/
.
This package provider uses apt/dpkg to manage packages on the system. dpkg will be used for all local actions, and apt is only needed to manage update and installation from a repository.
This package provider uses yum/rpm to manage packages on the system. rpm will be used for all local actions, and yum is only needed to manage update and installation from a repository.
It is able to downgrade packages when specifying an older version.
This package provider uses zypper/rpm to manage packages on the system. rpm will be used for all local actions, and zypper is only needed to manage update and installation from a repository.
This package provider uses FreeBSD’s pkg to manage packages on the system.
# To install postgresql in version 9.1 for x86_64 atchitecture package_present("postgresql", "9.1", "x86_64", ""); # To ensure postgresql is always in the latest available version package_present("postgresql", "latest", "", ""); # To ensure installing postgresql in any version package_present("postgresql", "", "", ""); # To ensure installing postgresql in any version, forcing the yum provider package_present("postgresql", "", "", "yum"); # To ensure installing postgresql from a local package package_present("/tmp/postgresql-9.1-1.x86_64.rpm", "", "", ""); # To remove postgresql package_absent("postgresql", "", "", "");
See also : package_present, package_absent, package_state_options
- name: Name of the package, or path to a local package if state is present
- version: Version of the package, can be "latest" for latest version or "any" for any version (defaults to "any")
- architecture: Architecture of the package, can be an architecture name or "default" (defaults to "default")
- provider: Package provider to use, can be "yum", "apt", "zypper", "pkg" or "default" for system default package manager (defaults to "default")
- state: State of the package, can be "present" or "absent" (defaults to "present")
package_state_${name}_{kept, repaired, not_ok, reached}
Enforce the state of a package with options
Compatible with nodes running Rudder 4.0 or higher.
See package_state for documentation.
- name: Name of the package, or path to a local package if state is present
- version: Version of the package, can be "latest" for latest version or "any" for any version (defaults to "any")
- architecture: Architecture of the package, can be an architecture name or "default" (defaults to "default")
- provider: Package provider to use, can be "yum", "apt", "zypper", "pkg" or "default" for system default package manager (defaults to "default")
- state: State of the package, can be "present" or "absent" (defaults to "present")
- options: Options no pass to the package manager (defaults to empty)
package_state_options_${name}_{kept, repaired, not_ok, reached}
Verify if a package is installed in its latest version available
Compatible with nodes running Rudder 3.1 or higher.
- package_name: Name of the package to verify
package_install_${package_name}_{kept, repaired, not_ok, reached}
Verify if a package is installed in a specific version
Compatible with nodes running Rudder 3.1 or higher.
- package_name: Name of the package to verify
- package_version: Version of the package to verify (can be "latest" for latest version)
package_install_${package_name}_{kept, repaired, not_ok, reached}