neulab/tldr huggingface dataset:
name   Irrelevant, not used (recommended: pcs_properties__resource_op_defaults_to_{{op_default}})
op_default name of the operation default resource property
value  value of the operation default resource property
salt.states.pcs.resource_present(name, resource_id, resource_type, resource_options=None, cibname=None) Ensure that a resource is created
name   Irrelevant, not used (recommended: {{formulaname}}__resource_present_{{resource_id}})
salt.states.pcs.stonith_present(name, stonith_id, stonith_device_type, stonith_device_options=None, cibname=None) Ensure that a fencing resource is created
name   Irrelevant, not used (recommended: pcs_stonith__created_{{stonith_id}})
salt.states.pdbedit Manage accounts in Samba's passdb using pdbedit
depends pdbedit
wash: pdbedit.absent
kaylee: pdbedit.managed: - password: A70C708517B5DD0EDB67714FE25336EB - password_hashed: True - drive: 'X:' - homedir: '\\serenity\mechanic\profile'
salt.states.pdbedit.absent(name) Ensure user account is absent
name   string username
salt.states.pdbedit.managed(name, **kwargs) Manage user account
salt.states.pdbedit.present(name, **kwargs) Alias for pdbedit.managed
salt.states.pecl Installation of PHP Extensions Using pecl These states manage the installed pecl extensions. Note that php-pear must be installed for these states to be available, so pecl states should include a requisite to a pkg.installed state for the package which provides pecl (php-pear in most cases). Example:
php-pear: pkg.installed
mongo: pecl.installed: - require: - pkg: php-pear
salt.states.pecl.installed(name, version=None, defaults=False, force=False, preferred_state='stable') New in version 0.17.0.
Make sure that a pecl extension is installed.
name   The pecl extension name to install
version The pecl extension version to install. This option may be ignored to install the latest stable version.
preferred_state The pecl extension state to install
salt.states.pecl.removed(name) Make sure that a pecl extension is not installed.
name   The pecl extension name to uninstall
salt.states.pip_state Installation of Python Packages Using pip These states manage system installed python packages. Note that pip must be installed for these states to be available, so pip states should include a requisite to a pkg.installed state for the package which provides pip (python-pip in most cases). Example:
python-pip: pkg.installed
virtualenvwrapper: pip.installed: - require: - pkg: python-pip
salt.states.pip_state.installed(name, pkgs=None, pip_bin=None, requirements=None, bin_env=None, use_wheel=False, no_use_wheel=False, log=None, proxy=None, timeout=None, repo=None, editable=None, find_links=None, index_url=None, extra_index_url=None, no_index=False, mirrors=None, build=None, target=None, download=None, download_cache=None, source=None, upgrade=False, force_reinstall=False, ignore_installed=False, exists_action=None, no_deps=False, no_install=False, no_download=False, install_options=None, global_options=None, user=None, cwd=None, pre_releases=False, cert=None, allow_all_external=False, allow_external=None, allow_unverified=None, process_dependency_links=False, env_vars=None, use_vt=False, trusted_host=None, no_cache_dir=False, cache_dir=None, no_binary=None, extra_args=None, **kwargs) Make sure the package is installed
name   The name of the python package to install. You can also specify version numbers here using the standard operators ==, >=, <=. If requirements is given, this parameter will be ignored.
django: pip.installed: - name: django >= 1.6, <= 1.7 - require: - pkg: python-pip
This will install the latest Django version greater than 1.6 but less than 1.7.
requirements Path to a pip requirements file. If the path begins with salt:// the file will be transferred from the master file server.
use_wheel False Prefer wheel archives (requires pip>=1.4)
no_use_wheel False Force to not use wheel archives (requires pip>=1.4)
no_binary Force to not use binary packages (requires pip >= 7.0.0) Accepts either :all: to disable all binary packages, :none: to empty the set, or a list of one or more packages
django: pip.installed: - no_binary: ':all:'
flask: pip.installed: - no_binary: - itsdangerous - click
proxy  Specify a proxy in the form user:passwd@proxy.server:port. Note that the user:password@ is optional and required only if you are behind an authenticated proxy.  If you provide user@proxy.server:port then you will be prompted for a password.
editable install something editable (i.e. git+https://github.com/worldcompany/djangoembed.git#egg=djangoembed)
find_links URL to look for packages at
download_cache Cache downloaded packages in download_cache dir
no_cache_dir: Disable the cache.
cwd    Current working directory to run pip from
bin_env None Absolute path to a virtual environment directory or absolute path to a pip executable. The example below assumes a virtual environment has been created at /foo/.virtualenvs/bar.
env_vars Add or modify environment variables. Useful for tweaking build steps, such as specifying INCLUDE or LIBRARY paths in Makefiles, build scripts or compiler calls.  This must be in the form of a dictionary or a mapping.
django: pip.installed: - name: django_app - env_vars: CUSTOM_PATH: /opt/django_app VERBOSE: True
django: pip.installed: - name: django >= 1.6, <= 1.7 - bin_env: /foo/.virtualenvs/bar - require: - pkg: python-pip
django: pip.installed: - name: django >= 1.6, <= 1.7 - bin_env: /foo/.virtualenvs/bar/bin/pip - require: - pkg: python-pip
The following arguments are deprecated, do not use.
pip_bin None Deprecated, use bin_env
Changed in version 0.17.0: use_wheel option added.
install_options Extra arguments to be supplied to the setup.py install command. If you are using an option with a directory path, be sure to use absolute path.
django: pip.installed: - name: django - install_options: - --prefix=/blah - require: - pkg: python-pip
As of Salt 0.17.0 the pip state needs an importable pip module.  This usually means having the system's pip package installed or running Salt from an active virtualenv.
The reason for this requirement is because pip already does a pretty good job parsing its own requirements. It makes no sense for Salt to do pip requirements parsing and validation before passing them to the pip library. It's functionality duplication and it's more error prone.
Please set reload_modules: True to have the salt minion import this module after installation.
pyopenssl: pip.installed: - name: pyOpenSSL - reload_modules: True - exists_action: i
pandas: pip.installed: - name: pandas - extra_args: - --latest-pip-kwarg: param - --latest-pip-arg
salt.states.pip_state.pip_has_exceptions_mod(ver) True when the pip version has the pip.exceptions module
salt.states.pip_state.pip_has_internal_exceptions_mod(ver) True when the pip version has the pip._internal.exceptions module
salt.states.pip_state.purge_pip() Purge pip and its sub-modules
salt.states.pip_state.removed(name, requirements=None, bin_env=None, log=None, proxy=None, timeout=None, user=None, cwd=None, use_vt=False) Make sure that a package is not installed.
bin_env None the pip executable or virtualenenv to use
salt.states.pip_state.uptodate(name, bin_env=None, user=None, cwd=None, use_vt=False) New in version 2015.5.0.
Verify that the system is completely up to date.
name   The name has no functional value and is only used as a tracking reference
bin_env the pip executable or virtualenenv to use
salt.states.pkg Installation of packages using OS package managers such as yum or apt-get NOTE: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, systemd-run(1) is now used to isolate commands which modify installed packages from the salt-minion daemon's control group. This is done to keep systemd from killing the package manager commands spawned by Salt, when Salt updates itself (see KillMode in the systemd.kill(5) manpage for more information). If desired, usage of systemd-run(1) can be suppressed by setting a config option called systemd.use_scope, with a value of False (no quotes).
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:
A more involved example involves pulling from a custom repository.
base: pkgrepo.managed: - name: ppa:wolfnet/logstash - dist: precise - file: /etc/apt/sources.list.d/logstash.list - keyid: 28B04E4A - keyserver: keyserver.ubuntu.com
logstash: pkg.installed: - fromrepo: ppa:wolfnet/logstash
Multiple packages can also be installed with the use of the pkgs state module
dotdeb.repo: pkgrepo.managed: - name: deb http://packages.dotdeb.org wheezy-php55 all - dist: wheezy-php55 - file: /etc/apt/sources.list.d/dotbeb.list - keyid: 89DF5277 - keyserver: keys.gnupg.net - refresh_db: true
php.packages: pkg.installed: - fromrepo: wheezy-php55 - pkgs: - php5-fpm - php5-cli - php5-curl
WARNING: Package names are currently case-sensitive. If the minion is using a package manager which is not case-sensitive (such as pkgng), then this state will fail if the proper case is not used. This will be addressed in a future release of Salt.
salt.states.pkg.downloaded(name, version=None, pkgs=None, fromrepo=None, ignore_epoch=None, **kwargs) New in version 2017.7.0.
Ensure that the package is downloaded, and that it is the correct version (if specified).
NOTE: Any argument which is either a) not explicitly defined for this state, or b) not a global state argument like saltenv, or reload_modules, will be passed through to the call to pkg.install to download the package(s). For example, you can include a disablerepo argument on platforms that use yum/dnf to disable that repo:
mypkg: pkg.downloaded: - disablerepo: base,updates
To see what is supported, check this page to find the documentation for your platform's pkg module, then look at the documentation for the install function.
Any argument that is passed through to the install function, which is not defined for that function, will be silently ignored.
Currently supported for the following pkg providers: yumpkg, zypper and zypper
• name (str) -- The name of the package to be downloaded. This parameter is ignored if either "pkgs" is used. Additionally, please note that this option can only be used to download packages from a software repository.
• version (str) --
Download a specific version of a package.
IMPORTANT: As of version 2015.8.7, for distros which use yum/dnf, packages which have a version with a nonzero epoch (that is, versions which start with a number followed by a colon must have the epoch included when specifying the version number. For example:
vim-enhanced: pkg.downloaded: - version: 2:7.4.160-1.el7
An ignore_epoch argument has been added to which causes the epoch to be disregarded when the state checks to see if the desired version was installed.
You can install a specific version when using the pkgs argument by including the version after the package:
common_packages: pkg.downloaded: - pkgs: - unzip - dos2unix - salt-minion: 2015.8.5-1.el6
• resolve_capabilities (bool) --
Turn on resolving capabilities. This allow one to name "provides" or alias names for packages.
zsh: pkg.downloaded: - version: 5.0.5-4.63 - fromrepo: "myrepository"
salt.states.pkg.group_installed(name, skip=None, include=None, **kwargs) New in version 2015.8.0.
Changed in version 2016.11.0: Added support in pacman
Ensure that an entire package group is installed. This state is currently only supported for the yum and pacman package managers.
skip   Packages that would normally be installed by the package group ("default" packages), which should not be installed.
Load Balancer: pkg.group_installed: - skip: - piranha
include Packages which are included in a group, which would not normally be installed by a yum groupinstall ("optional" packages). Note that this will not enforce group membership; if you include packages which are not members of the specified groups, they will still be installed.
Load Balancer: pkg.group_installed: - include: - haproxy
Changed in version 2016.3.0: This option can no longer be passed as a comma-separated list, it must now be passed as a list (as shown in the above example).
NOTE: Because this is essentially a wrapper around pkg.install, any argument which can be passed to pkg.install may also be included here, and it will be passed on to the call to pkg.install.
salt.states.pkg.installed(name, version=None, refresh=None, fromrepo=None, skip_verify=False, skip_suggestions=False, pkgs=None, sources=None, allow_updates=False, pkg_verify=False, normalize=True, ignore_epoch=None, reinstall=False, update_holds=False, **kwargs) Ensure that the package is installed, and that it is the correct version (if specified).
NOTE: Any argument which is either a) not explicitly defined for this state, or b) not a global state argument like saltenv, or reload_modules, will be passed through to the call to pkg.install to install the package(s). For example, you can include a disablerepo argument on platforms that use yum/dnf to disable that repo:
mypkg: pkg.installed: - disablerepo: base,updates
• name (str) -- The name of the package to be installed. This parameter is ignored if either "pkgs" or "sources" is used. Additionally, please note that this option can only be used to install packages from a software repository.  To install a package file manually, use the "sources" option detailed below.
Install a specific version of a package. This option is ignored if "sources" is used. Currently, this option is supported for the following pkg providers: apt, ebuild, pacman, pkgin, win_pkg, yumpkg, and zypper. The version number includes the release designation where applicable, to allow Salt to target a specific release of a given version. When in doubt, using the pkg.latest_version function for an uninstalled package will tell you the version available.
# salt myminion pkg.latest_version vim-enhanced myminion: 2:7.4.160-1.el7
IMPORTANT: As of version 2015.8.7, for distros which use yum/dnf, packages which have a version with a nonzero epoch (that is, versions which start with a number followed by a colon like in the pkg.latest_version output above) must have the epoch included when specifying the version number. For example:
vim-enhanced: pkg.installed: - version: 2:7.4.160-1.el7
In version 2015.8.9, an ignore_epoch argument has been added to pkg.installed, pkg.removed, and pkg.purged states, which causes the epoch to be disregarded when the state checks to see if the desired version was installed.
Also, while this function is not yet implemented for all pkg frontends, pkg.list_repo_pkgs will show all versions available in the various repositories for a given package, irrespective of whether or not it is installed.
# salt myminion pkg.list_repo_pkgs bash myminion: ---------- bash: - 4.2.46-21.el7_3 - 4.2.46-20.el7_2
This function was first added for pkg.list_repo_pkgs in 2014.1.0, and was expanded to Debian/Ubuntu and Arch Linux-based distros in the 2017.7.0 release.
The version strings returned by either of these functions can be used as version specifiers in pkg states.
common_packages: pkg.installed: - pkgs: - unzip - dos2unix - salt-minion: 2015.8.5-1.el6
If the version given is the string latest, the latest available package version will be installed à la pkg.latest.
WILDCARD VERSIONS
As of the 2017.7.0 release, this state now supports wildcards in package versions for SUSE SLES/Leap/Tumbleweed, Debian/Ubuntu, RHEL/CentOS, Arch Linux, and their derivatives. Using wildcards can be useful for packages where the release name is built into the version in some way, such as for RHEL/CentOS which typically has version numbers like 1.2.34-5.el7. An example of the usage for this would be:
mypkg: pkg.installed: - version: '1.2.34*'
Keep in mind that using wildcard versions will result in a slower state run since Salt must gather the available versions of the specified packages and figure out which of them match the specified wildcard expression.
• refresh (bool) --
This parameter controls whether or not the package repo database is updated prior to installing the requested package(s).
If True, the package database will be refreshed (apt-get update or equivalent, depending on platform) before installing.
If False, the package database will not be refreshed before installing.
If unset, then Salt treats package database refreshes differently depending on whether or not a pkg state has been executed already during the current Salt run. Once a refresh has been performed in a pkg state, for the remainder of that Salt run no other refreshes will be performed for pkg states which do not explicitly set refresh to True. This prevents needless additional refreshes from slowing down the Salt run.
• cache_valid_time (str) --
This parameter sets the value in seconds after which the cache is marked as invalid, and a cache update is necessary. This overwrites the refresh parameter's default behavior.
httpd: pkg.installed: - fromrepo: mycustomrepo - skip_verify: True - skip_suggestions: True - version: 2.0.6~ubuntu3 - refresh: True - cache_valid_time: 300 - allow_updates: True - hold: False
In this case, a refresh will not take place for 5 minutes since the last apt-get update was executed on the system.
NOTE: This parameter is available only on Debian based distributions and has no effect on the rest.
• fromrepo (str) --
Specify a repository from which to install
NOTE: Distros which use APT (Debian, Ubuntu, etc.) do not have a concept of repositories, in the same way as YUM-based distros do. When a source is added, it is assigned to a given release. Consider the following source configuration:
deb http://ppa.launchpad.net/saltstack/salt/ubuntu precise main
The packages provided by this source would be made available via the precise release, therefore fromrepo would need to be set to precise for Salt to install the package from this source.
Having multiple sources in the same release may result in the default install candidate being newer than what is desired. If this is the case, the desired version must be specified using the version parameter.
If the pkgs parameter is being used to install multiple packages in the same state, then instead of using version, use the method of version specification described in the Multiple Package Installation Options section below.
Running the shell command apt-cache policy pkgname on a minion can help elucidate the APT configuration and aid in properly configuring states:
root@saltmaster:~# salt ubuntu01 cmd.run 'apt-cache policy ffmpeg' ubuntu01: ffmpeg: Installed: (none) Candidate: 7:0.10.11-1~precise1 Version table: 7:0.10.11-1~precise1 0 500 http://ppa.launchpad.net/jon-severinsson/ffmpeg/ubuntu/ precise/main amd64 Packages 4:0.8.10-0ubuntu0.12.04.1 0 500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages 4:0.8.1-0ubuntu1 0 500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
The release is located directly after the source's URL. The actual release name is the part before the slash, so to install version 4:0.8.10-0ubuntu0.12.04.1 either precise-updates or precise-security could be used for the fromrepo value.
• skip_verify (bool) -- Skip the GPG verification check for the package to be installed
• skip_suggestions (bool) --
Force strict package naming. Disables lookup of package alternatives.
New in version 2014.1.1.
• allow_updates (bool) --
Allow the package to be updated outside Salt's control (e.g. auto updates on Windows). This means a package on the Minion can have a newer version than the latest available in the repository without enforcing a re-installation of the package.
httpd: pkg.installed: - fromrepo: mycustomrepo - skip_verify: True - skip_suggestions: True - version: 2.0.6~ubuntu3 - refresh: True - allow_updates: True - hold: False
• pkg_verify (bool) --
For requested packages that are already installed and would not be targeted for upgrade or downgrade, use pkg.verify to determine if any of the files installed by the package have been altered. If files have been altered, the reinstall option of pkg.install is used to force a reinstall. Types to ignore can be passed to pkg.verify. Additionally, verify_options can be used to modify further the behavior of pkg.verify. See examples below.  Currently, this option is supported for the following pkg providers: yumpkg.
httpd: pkg.installed: - version: 2.2.15-30.el6.centos - pkg_verify: True
mypkgs: pkg.installed: - pkgs: - foo - bar: 1.2.3-4 - baz - pkg_verify: - ignore_types: - config - doc
mypkgs: pkg.installed: - pkgs: - foo - bar: 1.2.3-4 - baz - pkg_verify: - ignore_types: - config - doc - verify_options: - nodeps - nofiledigest
• ignore_types (list) --
List of types to ignore when verifying the package
• verify_options (list) --
List of additional options to pass when verifying the package. These options will be added to the rpm -V command, prepended with -- (for example, when nodeps is passed in this option, rpm -V will be run with --nodeps).
• normalize (bool) --
Normalize the package name by removing the architecture, if the architecture of the package is different from the architecture of the operating system. The ability to disable this behavior is useful for poorly-created packages which include the architecture as an actual part of the name, such as kernel modules which match a specific kernel version.
gpfs.gplbin-2.6.32-279.31.1.el6.x86_64: pkg.installed: - normalize: False
• ignore_epoch (bool) --
If this option is not explicitly set, and there is no epoch in the desired package version, the epoch will be implicitly ignored. Set this argument to True to explicitly ignore the epoch, and False to strictly enforce it.
Changed in version 3001: In prior releases, the default behavior was to strictly enforce epochs unless this argument was set to True.
MULTIPLE PACKAGE INSTALLATION OPTIONS: (not supported in pkgng)
mypkgs: pkg.installed: - pkgs: - foo - bar - baz - hold: True
NOTE: For apt, ebuild, pacman, winrepo, yumpkg, and zypper, version numbers can be specified in the pkgs argument. For example:
mypkgs: pkg.installed: - pkgs: - foo - bar: 1.2.3-4 - baz
Additionally, ebuild, pacman, zypper, yum/dnf, and apt support the <, <=, >=, and > operators for more control over what versions will be installed. For example:
mypkgs: pkg.installed: - pkgs: - foo - bar: '>=1.2.3-4' - baz
NOTE: When using comparison operators, the expression must be enclosed in quotes to avoid a YAML render error.
With ebuild is also possible to specify a use flag list and/or if the given packages should be in package.accept_keywords file and/or the overlay from which you want the package to be installed. For example:
mypkgs: pkg.installed: - pkgs: - foo: '~' - bar: '~>=1.2:slot::overlay[use,-otheruse]' - baz
• sources (list) --
A list of packages to install, along with the source URI or local path from which to install each package. In the example below, foo, bar, baz, etc. refer to the name of the package, as it would appear in the output of the pkg.version or pkg.list_pkgs salt CLI commands.
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
PLATFORM-SPECIFIC ARGUMENTS
These are specific to each OS. If it does not apply to the execution module for your OS, it is ignored.
• hold (bool) --
Force the package to be held at the current installed version.
Supported on YUM/DNF & APT based systems.
Supported on Zypper-based systems.
• update_holds (bool) --
If True, and this function would update the package version, any packages which are being held will be temporarily unheld so that they can be updated. Otherwise, if this function attempts to update a held package, the held package(s) will be skipped and the state will fail.  By default, this parameter is set to False.
• names (list) --
A list of packages to install from a software repository. Each package will be installed individually by the package manager.
WARNING: Unlike pkgs, the names parameter cannot specify a version.  In addition, it makes a separate call to the package management frontend to install each package, whereas pkgs makes just a single call. It is therefore recommended to use pkgs instead of names to install multiple packages, both for the additional features and the performance improvement that it brings.
• install_recommends (bool) --
Whether to install the packages marked as recommended. Default is True. Currently only works with APT-based systems.
httpd: pkg.installed: - install_recommends: False
• only_upgrade (bool) --
Only upgrade the packages, if they are already installed. Default is False. Currently only works with APT-based systems.
httpd: pkg.installed: - only_upgrade: True
NOTE: If this parameter is set to True and the package is not already installed, the state will fail.
• report_reboot_exit_codes (bool) --
If the installer exits with a recognized exit code indicating that a reboot is required, the module function win_system.set_reboot_required_witnessed
will be called, preserving the knowledge of this event for the remainder of the current boot session. For the time being, 3010 is the only recognized exit code, but this is subject to future refinement.  The value of this param defaults to True. This parameter has no effect on non-Windows systems.
ms vcpp installed: pkg.installed: - name: ms-vcpp - version: 10.0.40219 - report_reboot_exit_codes: False
Returns A dictionary containing the state of the software installation
NOTE: The pkg.installed state supports the usage of reload_modules. This functionality allows you to force Salt to reload all modules. In many cases, Salt is clever enough to transparently reload the modules.  For example, if you install a package, Salt reloads modules because some other module or state might require the package which was installed.  However, there are some edge cases where this may not be the case, which is what reload_modules is meant to resolve.
You should only use reload_modules if your pkg.installed does some sort of installation where if you do not reload the modules future items in your state which rely on the software being installed will fail. Please see the Reloading Modules documentation for more information.
SEE ALSO: unless and onlyif
If running pkg commands together with aggregate isn't an option, you can use the creates, unless, or onlyif syntax to skip a full package run. This can be helpful in large environments with multiple states that include requisites for packages to be installed.
# Using creates for a simple single-factor check install_nginx: pkg.installed: - name: nginx - creates: - /etc/nginx/nginx.conf
# Using file.file_exists for a single-factor check install_nginx: pkg.installed: - name: nginx - unless: - fun: file.file_exists args: - /etc/nginx/nginx.conf
# Using unless with a shell test install_nginx: pkg.installed: - name: nginx - unless: test -f /etc/nginx/nginx.conf
# Using file.search for a two-factor check install_nginx: pkg.installed: - name: nginx - unless: - fun: file.search args: - /etc/nginx/nginx.conf - 'user www-data;'
The above examples use different methods to reasonably ensure that a package has already been installed. First, with checking for a file that would be created with the package. Second, by checking for specific text within a file that would be created or managed by salt.  With these requisists satisfied, creates/unless will return True and the pkg.installed state will be skipped.
# Example of state run without unless used salt 'saltdev' state.apply nginx saltdev: ---------- ID: install_nginx Function: pkg.installed Name: nginx Result: True Comment: All specified packages are already installed Started: 20:11:56.388331 Duration: 4290.0 ms Changes:
# Example of state run using unless requisite salt 'saltdev' state.apply nginx saltdev: ---------- ID: install_nginx Function: pkg.installed Name: nginx Result: True Comment: unless condition is true Started: 20:10:50.659215 Duration: 1530.0 ms Changes:
The result is a reduction of almost 3 seconds. In larger environments, small reductions in waiting time can add up.
Unless Requisite
salt.states.pkg.latest(name, refresh=None, fromrepo=None, skip_verify=False, pkgs=None, watch_flags=True, **kwargs) Ensure 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.
mypkg: pkg.latest: - disablerepo: base,updates
name   The name of the package to maintain at the latest available version.  This parameter is ignored if "pkgs" is used.
fromrepo Specify a repository from which to install
skip_verify Skip the GPG verification check for the package to be installed
refresh This parameter controls whether or not the package repo database is updated prior to checking for the latest available version of the requested packages.
If True, the package database will be refreshed (apt-get update or equivalent, depending on platform) before checking for the latest available version of the requested packages.
If False, the package database will not be refreshed before checking.
httpd: pkg.latest: - refresh: True - cache_valid_time: 300
(Not yet supported for: FreeBSD, OpenBSD, MacOS, and Solaris pkgutil)
pkgs   A list of packages to maintain at the latest available version.
mypkgs: pkg.latest: - pkgs: - foo - bar - baz
install_recommends Whether to install the packages marked as recommended. Default is True. Currently only works with APT-based systems.
httpd: pkg.latest: - install_recommends: False
only_upgrade Only upgrade the packages, if they are already installed. Default is False. Currently only works with APT-based systems.
httpd: pkg.latest: - only_upgrade: True
report_reboot_exit_codes If the installer exits with a recognized exit code indicating that a reboot is required, the module function win_system.set_reboot_required_witnessed
will be called, preserving the knowledge of this event for the remainder of the current boot session. For the time being, 3010 is the only recognized exit code, but this is subject to future refinement. The value of this param defaults to True. This parameter has no effect on non-Windows systems.
ms vcpp installed: pkg.latest: - name: ms-vcpp - report_reboot_exit_codes: False
salt.states.pkg.mod_aggregate(low, chunks, running) The mod_aggregate function which looks up all packages in the available low chunks and merges them into a single pkgs ref in the present low data
salt.states.pkg.mod_beacon(name, **kwargs) Create a beacon to monitor a package or packages based on a beacon state argument.
salt.states.pkg.mod_watch(name, **kwargs) Install/reinstall a package based on a watch requisite
salt.states.pkg.patch_downloaded(name, advisory_ids=None, **kwargs) New in version 2017.7.0.
Ensure that packages related to certain advisory ids are downloaded.
Currently supported for the following pkg providers: yumpkg and zypper
preparing-to-fix-issues: pkg.patch_downloaded: - advisory_ids: - SUSE-SLE-SERVER-12-SP2-2017-185 - SUSE-SLE-SERVER-12-SP2-2017-150 - SUSE-SLE-SERVER-12-SP2-2017-120
salt.states.pkg.patch_installed(name, advisory_ids=None, downloadonly=None, **kwargs) New in version 2017.7.0.
Ensure that packages related to certain advisory ids are installed.
NOTE: Any argument which is either a) not explicitly defined for this state, or b) not a global state argument like saltenv, or reload_modules, will be passed through to the call to pkg.install to install the patch(es).
issue-foo-fixed: pkg.patch_installed: - advisory_ids: - SUSE-SLE-SERVER-12-SP2-2017-185 - SUSE-SLE-SERVER-12-SP2-2017-150 - SUSE-SLE-SERVER-12-SP2-2017-120
salt.states.pkg.purged(name, version=None, pkgs=None, normalize=True, ignore_epoch=None, **kwargs) Verify that a package is not installed, calling pkg.purge if necessary to purge the package. All configuration files are also removed.
name   The name of the package to be purged.
version The version of the package that should be removed. Don't do anything if the package is installed with an unmatching version.
IMPORTANT: As of version 2015.8.7, for distros which use yum/dnf, packages which have a version with a nonzero epoch (that is, versions which start with a number followed by a colon like in the example above) must have the epoch included when specifying the version number.  For example:
vim-enhanced: pkg.purged: - version: 2:7.4.160-1.el7
In version 2015.8.9, an ignore_epoch argument has been added to pkg.installed, pkg.removed, and pkg.purged states, which causes the epoch to be disregarded when the state checks to see if the desired version was installed. If ignore_epoch was not set to True, and instead of 2:7.4.160-1.el7 a version of 7.4.160-1.el7 were used, this state would report success since the actual installed version includes the epoch, and the specified version would not match.
ignore_epoch None If this option is not explicitly set, and there is no epoch in the desired package version, the epoch will be implicitly ignored. Set this argument to True to explicitly ignore the epoch, and False to strictly enforce it.
pkgs   A list of packages to purge. Must be passed as a python list. The name parameter will be ignored if this option is passed. It accepts version numbers as well.
salt.states.pkg.removed(name, version=None, pkgs=None, normalize=True, ignore_epoch=None, **kwargs) Verify that a package is not installed, calling pkg.remove if necessary to remove the package.
name   The name of the package to be removed.
vim-enhanced: pkg.removed: - version: 2:7.4.160-1.el7
pkgs   A list of packages to remove. Must be passed as a python list. The name parameter will be ignored if this option is passed. It accepts version numbers as well.
salt.states.pkg.uptodate(name, refresh=False, pkgs=None, **kwargs) New in version 2014.7.0.
Changed in version 2018.3.0: Added support for the pkgin provider.
refresh refresh the package database before checking for new upgrades
pkgs   list of packages to upgrade
This parameter sets the value in seconds after which cache marked as invalid, and cache update is necessary. This overwrite refresh parameter default behavior.
In this case cache_valid_time is set, refresh will not take place for amount in seconds since last apt-get update executed on the system.
NOTE: This parameter available only on Debian based distributions, and have no effect on the rest.
kwargs Any keyword arguments to pass through to pkg.upgrade.
salt.states.pkgbuild The pkgbuild state is the front of Salt package building backend. It automatically builds DEB and RPM packages from specified sources
salt_2015.5.2: pkgbuild.built: - runas: thatch - results: - salt-2015.5.2-2.el7.centos.noarch.rpm - salt-api-2015.5.2-2.el7.centos.noarch.rpm - salt-cloud-2015.5.2-2.el7.centos.noarch.rpm - salt-master-2015.5.2-2.el7.centos.noarch.rpm - salt-minion-2015.5.2-2.el7.centos.noarch.rpm - salt-ssh-2015.5.2-2.el7.centos.noarch.rpm - salt-syndic-2015.5.2-2.el7.centos.noarch.rpm - dest_dir: /tmp/pkg - spec: salt://pkg/salt/spec/salt.spec - template: jinja - deps: - salt://pkg/salt/sources/required_dependency.rpm - tgt: epel-7-x86_64 - sources: - salt://pkg/salt/sources/logrotate.salt - salt://pkg/salt/sources/README.fedora - salt://pkg/salt/sources/salt-2015.5.2.tar.gz - salt://pkg/salt/sources/salt-2015.5.2-tests.patch - salt://pkg/salt/sources/salt-api - salt://pkg/salt/sources/salt-api.service - salt://pkg/salt/sources/salt-master - salt://pkg/salt/sources/salt-master.service - salt://pkg/salt/sources/salt-minion - salt://pkg/salt/sources/salt-minion.service - salt://pkg/salt/sources/saltpkg.sls - salt://pkg/salt/sources/salt-syndic - salt://pkg/salt/sources/salt-syndic.service - salt://pkg/salt/sources/SaltTesting-2015.5.8.tar.gz /tmp/pkg: pkgbuild.repo
salt.states.pkgbuild.built(name, runas, dest_dir, spec, sources, tgt, template=None, deps=None, env=None, results=None, force=False, saltenv='base', log_dir='/var/log/salt/pkgbuild') Ensure that the named package is built and exists in the named directory
name   The name to track the build, the name value is otherwise unused
tgt    The target platform to run the build on
template Run the spec file through a templating engine
Changed in version 2015.8.2: This argument is now optional, allowing for no templating engine to be used if none is desired.
deps   Packages required to ensure that the named package is built can be hosted on either the salt master server or on an HTTP or FTP server.  Both HTTPS and HTTP are supported as well as downloading directly from Amazon S3 compatible URLs with both pre-configured and automatic IAM credentials
env    A dictionary of environment variables to be set prior to execution.  Example:
- env: DEB_BUILD_OPTIONS: 'nocheck'
results The names of the expected rpms that will be built
force  False If True, packages will be built even if they already exist in the dest_dir. This is useful when building a package for continuous or nightly package builds.
log_dir /var/log/salt/rpmbuild Root directory for log files created from the build. Logs will be organized by package name, version, OS release, and CPU architecture under this directory.
salt.states.pkgbuild.repo(name, keyid=None, env=None, use_passphrase=False, gnupghome='/etc/salt/gpgkeys', runas='builder', timeout=15.0) Make a package repository and optionally sign it and packages present
The name is directory to turn into a repo. This state is best used with onchanges linked to your package building states.
name   The directory to find packages that will be in the repository
A dictionary of environment variables to be utilized in creating the repository. Example:
- env: OPTIONS: 'ask-passphrase'
Use of OPTIONS on some platforms, for example: ask-passphrase, will require gpg-agent or similar to cache passphrases.
Location where GPG related files are stored, used with 'keyid'
runas  builder New in version 2016.3.0.
salt.states.pkgng Manage package remote repo using FreeBSD pkgng Salt can manage the URL pkgng pulls packages from.  ATM the state and module are small so use cases are typically rather simple:
pkgng_clients: pkgng.update_packaging_site: - name: "http://192.168.0.2"
salt.states.pkgng.update_packaging_site(name)
salt.states.pkgrepo Management of APT/DNF/YUM/Zypper package repos States for managing software package repositories on Linux distros. Supported package managers are APT, DNF, YUM and Zypper. Here is some example SLS:
base: pkgrepo.managed: - humanname: CentOS-$releasever - Base - mirrorlist: http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os - comments: - 'http://mirror.centos.org/centos/$releasever/os/$basearch/' - gpgcheck: 1 - gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
base: pkgrepo.managed: - humanname: Logstash PPA - name: deb http://ppa.launchpad.net/wolfnet/logstash/ubuntu precise main - dist: precise - file: /etc/apt/sources.list.d/logstash.list - keyid: 28B04E4A - keyserver: keyserver.ubuntu.com - require_in: - pkg: logstash
pkg.latest: - name: logstash - refresh: True
base: pkgrepo.managed: - humanname: deb-multimedia - name: deb http://www.deb-multimedia.org stable main - file: /etc/apt/sources.list.d/deb-multimedia.list - key_url: salt://deb-multimedia/files/marillat.pub
base: pkgrepo.managed: - humanname: Google Chrome - name: deb http://dl.google.com/linux/chrome/deb/ stable main - dist: stable - file: /etc/apt/sources.list.d/chrome-browser.list - require_in: - pkg: google-chrome-stable - gpgcheck: 1 - key_url: https://dl-ssl.google.com/linux/linux_signing_key.pub
base: pkgrepo.managed: - ppa: wolfnet/logstash pkg.latest: - name: logstash - refresh: True
NOTE: On Ubuntu systems, the python-software-properties package should be installed for better support of PPA repositories. To check if this package is installed, run dpkg -l python-software-properties.
On Ubuntu & Debian systems, the python-apt package is required to be installed. To check if this package is installed, run dpkg -l python-apt.  python-apt will need to be manually installed if it is not present.
hello-copr: pkgrepo.managed: - copr: mymindstorm/hello pkg.installed: - name: hello
salt.states.pkgrepo.absent(name, **kwargs) This function deletes the specified repo on the system, if it exists. It is essentially a wrapper around pkg.del_repo.
name   The name of the package repo, as it would be referred to when running the regular package manager commands.
FEDORA/REDHAT-SPECIFIC OPTIONS
copr   Use community packages outside of the main package repository.
hello-copr: pkgrepo.absent: - copr: mymindstorm/hello
UBUNTU-SPECIFIC OPTIONS
ppa    On Ubuntu, you can take advantage of Personal Package Archives on Launchpad simply by specifying the user and archive name.
logstash-ppa: pkgrepo.absent: - ppa: wolfnet/logstash
ppa_auth For Ubuntu PPAs there can be private PPAs that require authentication to access. For these PPAs the username/password can be specified.  This is required for matching if the name format uses the ppa: specifier and is private (requires username/password to access, which is encoded in the URI).
logstash-ppa: pkgrepo.absent: - ppa: wolfnet/logstash - ppa_auth: username:password
keyid  If passed, then the GPG key corresponding to the passed KeyID will also be removed.
keyid_ppa False If set to True, the GPG key's ID will be looked up from ppa.launchpad.net and removed, and the keyid argument will be ignored.
NOTE: This option will be disregarded unless the ppa argument is present.
salt.states.pkgrepo.managed(name, ppa=None, copr=None, **kwargs) This state manages software package repositories. Currently, yum, apt, and zypper repositories are supported.
YUM/DNF/ZYPPER-BASED SYSTEMS
NOTE: One of baseurl or mirrorlist below is required. Additionally, note that this state is not presently capable of managing more than one repo in a single repo file, so each instance of this state will manage a single repo file containing the configuration for a single repo.
name   This value will be used in two ways: Firstly, it will be the repo ID, as seen in the entry in square brackets (e.g. [foo]) for a given repo. Secondly, it will be the name of the file as stored in /etc/yum.repos.d (e.g. /etc/yum.repos.d/foo.conf).
enabled True Whether the repo is enabled or not. Can be specified as True/False or 1/0.
disabled False Included to reduce confusion due to APT's use of the disabled argument. If this is passed for a YUM/DNF/Zypper-based distro, then the reverse will be passed as enabled. For example passing disabled=True will assume enabled=False.
copr   Fedora and RedHat based distributions only. Use community packages outside of the main package repository.
humanname This is used as the name value in the repo file in /etc/yum.repos.d/ (or /etc/zypp/repos.d for SUSE distros).
baseurl The URL to a yum repository
mirrorlist A URL which points to a file containing a collection of baseurls
comments Sometimes you want to supply additional information, but not as enabled configuration. Anything supplied for this list will be saved in the repo configuration with a comment marker (#) in front.
gpgautoimport Only valid for Zypper package manager. If set to True, automatically trust and import the new repository signing key. The key should be specified with gpgkey parameter. See details below.
Additional configuration values seen in YUM/DNF/Zypper repo files, such as gpgkey or gpgcheck, will be used directly as key-value pairs.  For example:
foo: pkgrepo.managed: - humanname: Personal repo for foo - baseurl: https://mydomain.tld/repo/foo/$releasever/$basearch - gpgkey: file:///etc/pki/rpm-gpg/foo-signing-key - gpgcheck: 1
APT-BASED SYSTEMS
ppa    On Ubuntu, you can take advantage of Personal Package Archives on Launchpad simply by specifying the user and archive name. The keyid will be queried from launchpad and everything else is set automatically. You can override any of the below settings by simply setting them as you would normally. For example:
logstash-ppa: pkgrepo.managed: - ppa: wolfnet/logstash
ppa_auth For Ubuntu PPAs there can be private PPAs that require authentication to access. For these PPAs the username/password can be passed as an HTTP Basic style username/password combination.
logstash-ppa: pkgrepo.managed: - ppa: wolfnet/logstash - ppa_auth: username:password
name   On apt-based systems this must be the complete entry as it would be seen in the sources.list file. This can have a limited subset of components (e.g. main) which can be added/modified with the comps option.
precise-repo: pkgrepo.managed: - name: deb http://us.archive.ubuntu.com/ubuntu precise main
NOTE: The above example is intended as a more readable way of configuring the SLS, it is equivalent to the following:
'deb http://us.archive.ubuntu.com/ubuntu precise main': pkgrepo.managed
disabled False Toggles whether or not the repo is used for resolving dependencies and/or installing packages.
enabled True Included to reduce confusion due to YUM/DNF/Zypper's use of the enabled argument. If this is passed for an APT-based distro, then the reverse will be passed as disabled. For example, passing enabled=False will assume disabled=False.
architectures On apt-based systems, architectures can restrict the available architectures that the repository provides (e.g. only amd64).  architectures should be a comma-separated list.
comps  On apt-based systems, comps dictate the types of packages to be installed from the repository (e.g. main, nonfree, ...).  For purposes of this, comps should be a comma-separated list.
file   The filename for the *.list that the repository is configured in.  It is important to include the full-path AND make sure it is in a directory that APT will look in when handling packages
dist   This dictates the release of the distro the packages should be built for.  (e.g. unstable). This option is rarely needed.
keyid  The KeyID or a list of KeyIDs of the GPG key to install. This option also requires the keyserver option to be set.
keyserver This is the name of the keyserver to retrieve GPG keys from. The keyid option must also be set for this option to work.
key_url URL to retrieve a GPG key from. Allows the usage of http://, https:// as well as salt://.
NOTE: Use either keyid/keyserver or key_url, but not both.
key_text The string representation of the GPG key to install.
NOTE: Use either keyid/keyserver, key_url, or key_text but not more than one method.
consolidate False If set to True, this will consolidate all sources definitions to the sources.list file, cleanup the now unused files, consolidate components (e.g. main) for the same URI, type, and architecture to a single line, and finally remove comments from the sources.list file.  The consolidation will run every time the state is processed. The option only needs to be set on one repo managed by Salt to take effect.
clean_file False If set to True, empty the file before configuring the defined repository
NOTE: Use with care. This can be dangerous if multiple sources are configured in the same file.
refresh True If set to False this will skip refreshing the apt package database on Debian based systems.
refresh_db True Deprecated since version 2018.3.0: Use refresh instead.
require_in Set this to a list of pkg.installed or pkg.latest to trigger the running of apt-get update prior to attempting to install these packages. Setting a require in the pkg state will not work for this.
salt.states.portage_config Management of Portage package configuration on Gentoo A state module to manage Portage configuration on Gentoo
salt: portage_config.flags: - use: - openssl
salt.states.portage_config.flags(name, use=None, accept_keywords=None, env=None, license=None, properties=None, unmask=False, mask=False) Enforce the given flags on the given package or DEPEND atom.
WARNING: In most cases, the affected package(s) need to be rebuilt in order to apply the changes.
name   The name of the package or its DEPEND atom
use    A list of USE flags
accept_keywords A list of keywords to accept. ~ARCH means current host arch, and will be translated into a line without keywords
env    A list of environment files
license A list of accepted licenses
properties A list of additional properties
unmask A boolean to unmask the package
mask   A boolean to mask the package
salt.states.ports Manage software from FreeBSD ports
NOTE: It may be helpful to use a higher timeout when running a ports.installed state, since compiling the port may exceed Salt's timeout.
salt -t 1200 '*' state.highstate
salt.states.ports.installed(name, options=None) Verify that the desired port is installed, and that it was compiled with the desired options.
options Make sure that the desired non-default options are set