Salt can manage software packages via the pkg state module, packages can be set up to be installed, latest, removed and purged. Package management declarations are typically rather simple:
vim:
pkg.installed
Verify that the package is installed, and that it is the correct version (if specified).
Usage:
httpd:
pkg.installed:
- fromrepo: mycustomrepo
- skip_verify: True
- version: 2.0.6~ubuntu3
Multiple Package Installation Options: (not supported in Windows)
Usage:
mypkgs:
pkg.installed:
- pkgs:
- foo
- bar
- baz
Usage:
mypkgs:
pkg.installed:
- sources:
- foo: salt://rpms/foo.rpm
- bar: http://somesite.org/bar.rpm
- baz: ftp://someothersite.org/baz.rpm
- qux: /minion/path/to/qux.rpm
Verify that the named package is installed and the latest available package. If the package can be updated this state function will update the package. Generally it is better for the installed function to be used, as latest will update the package whenever a new package is available.
Multiple Package Installation Options:
(Not yet supported for: Windows, FreeBSD, OpenBSD, MacOS, and Solaris pkgutil)
Usage:
mypkgs:
pkg.latest:
- pkgs:
- foo
- bar
- baz
Verify that the package is purged, this will call the purge function in the salt pkg module for the platform.
Verify that the package is removed, this will remove the package via the remove function in the salt pkg module for the platform.