neulab/tldr huggingface dataset:
salt '*' peeringdb.get_net id=4224 salt '*' peeringdb.get_net asn=13335 salt '*' peeringdb.get_net city='Salt Lake City' salt '*' peeringdb.get_net name__startswith=GTT
salt.modules.peeringdb.get_netfac(**kwargs) Return the list of facilities used by a particular network, given the id or other filters specified in the query.
NOTE: If no id or filter arguments are specified, it will return all the possible network facilities registered in PeeringDB.
salt '*' peeringdb.get_netfac id=780 salt '*' peeringdb.get_netfac city='Milwaukee'
salt.modules.peeringdb.get_netixlan(**kwargs) Return the IP addresses used by a particular network at all the IXs where it is available. The network is selected either via the id argument or the other filters specified in the query.
NOTE: If no id or filter arguments are specified, it will return all the possible IP addresses, of all networks, at all IXs, registered in PeeringDB.
The available filters are documented at: https://www.peeringdb.com/apidocs/#!/netixlan/netixlan_list
salt '*' peeringdb.get_netixlan asn=13335 salt '*' peeringdb.get_netixlan ipaddr4=185.1.114.25
salt.modules.peeringdb.get_org(**kwargs) Return the details of an organisation together with the networks available in this location, using the search filters specified in the query.
NOTE: If no id or filter arguments are specified, it will return all the possible organisations registered in PeeringDB.
The available filters are documented at: https://www.peeringdb.com/apidocs/#!/org/org_list
salt '*' peeringdb.get_org id=2 salt '*' peeringdb.get_org city=Duesseldorf
salt.modules.peeringdb.get_poc(**kwargs) Return the details of a person of contact together using the search filters specified in the query.
NOTE: If no id or filter arguments are specified, it will return all the possible contacts registered in PeeringDB.
The available filters are documented at: https://www.peeringdb.com/apidocs/#!/poc/poc_list
salt '*' peeringdb.get_poc id=6721 salt '*' peeringdb.get_poc email__contains='@cloudflare.com'
salt.modules.pf Control the OpenBSD packet filter (PF).
codeauthor Jasper Lievisse Adriaanse <j@jasper.la>
salt.modules.pf.disable() Disable the Packet Filter.
salt '*' pf.disable
salt.modules.pf.enable() Enable the Packet Filter.
salt '*' pf.enable
salt.modules.pf.flush(modifier) Flush the specified packet filter parameters.
modifier: Should be one of the following:
• info
• osfp
• rules
• sources
• tables
Please refer to the OpenBSD pfctl(8) documentation for a detailed explanation of each command.
salt '*' pf.flush states
salt.modules.pf.load(file='/etc/pf.conf', noop=False) Load a ruleset from the specific file, overwriting the currently loaded ruleset.
file:  Full path to the file containing the ruleset.
noop:  Don't actually load the rules, just parse them.
salt '*' pf.load /etc/pf.conf.d/lockdown.conf
salt.modules.pf.loglevel(level) Set the debug level which limits the severity of log messages printed by pf(4).
level: Log level. Should be one of the following: emerg, alert, crit, err, warning, notice, info or debug (OpenBSD); or none, urgent, misc, loud (FreeBSD).
salt '*' pf.loglevel emerg
salt.modules.pf.show(modifier) Show filter parameters.
modifier: Modifier to apply for filtering. Only a useful subset of what pfctl supports can be used with Salt.
salt '*' pf.show rules
salt.modules.pf.table(command, table, **kwargs) Apply a command on the specified table.
table: Name of the table.
command: Command to apply to the table. Supported commands are:
• add
• expire
• flush
• replace
• show
• test
• zero
salt '*' pf.table expire table=spam_hosts number=300 salt '*' pf.table add table=local_hosts addresses='["127.0.0.1", "::1"]'
salt.modules.philips_hue Philips HUE lamps module for proxy.
salt.modules.pillar Extract the pillar data for this minion
salt.modules.pillar.data(*args, **kwargs) This function is an alias of items. Calls the master for a fresh pillar and generates the pillar data on the fly
Contrast with raw() which returns the pillar data that is currently loaded into the minion.
pillar If specified, allows for a dictionary of pillar data to be made available to pillar and ext_pillar rendering. these pillar variables will also override any variables of the same name in pillar or ext_pillar.
pillar_enc If specified, the data passed in the pillar argument will be passed through this renderer to decrypt it.
NOTE: This will decrypt on the minion side, so the specified renderer must be set up on the minion for this to work. Alternatively, pillar data can be decrypted master-side. For more information, see the Pillar Encryption documentation.  Pillar data that is decrypted master-side, is not decrypted until the end of pillar compilation though, so minion-side decryption will be necessary if the encrypted pillar data must be made available in an decrypted state pillar/ext_pillar rendering.
pillarenv Pass a specific pillar environment from which to compile pillar data.  If not specified, then the minion's pillarenv option is not used, and if that also is not specified then all configured pillar environments will be merged into a single pillar dictionary and returned.
salt.modules.pillar.ext(external, pillar=None) Changed in version 2016.3.6,2016.11.3,2017.7.0: The supported ext_pillar types are now tunable using the on_demand_ext_pillar config option. Earlier releases used a hard-coded default.
Generate the pillar and apply an explicit external pillar
external A single ext_pillar to add to the ext_pillar configuration. This must be passed as a single section from the ext_pillar configuration (see CLI examples below). For more complicated ext_pillar configurations, it can be helpful to use the Python shell to load YAML configuration into a dictionary, and figure out
>>> import salt.utils.yaml >>> ext_pillar = salt.utils.yaml.safe_load(""" ... ext_pillar: ...   - git: ...     - issue38440 https://github.com/terminalmage/git_pillar: ...       - env: base ... """) >>> ext_pillar {'ext_pillar': [{'git': [{'mybranch https://github.com/myuser/myrepo': [{'env': 'base'}]}]}]} >>> ext_pillar['ext_pillar'][0] {'git': [{'mybranch https://github.com/myuser/myrepo': [{'env': 'base'}]}]}
In the above example, the value to pass would be {'git': [{'mybranch https://github.com/myuser/myrepo': [{'env': 'base'}]}]}.  Note that this would need to be quoted when passing on the CLI (as in the CLI examples below).
pillar None If specified, allows for a dictionary of pillar data to be made available to pillar and ext_pillar rendering. These pillar variables will also override any variables of the same name in pillar or ext_pillar.
salt '*' pillar.ext '{libvirt: _}' salt '*' pillar.ext "{'git': ['master https://github.com/myuser/myrepo']}" salt '*' pillar.ext "{'git': [{'mybranch https://github.com/myuser/myrepo': [{'env': 'base'}]}]}"
salt.modules.pillar.fetch(key, default=<class 'KeyError'>, merge=False, merge_nested_lists=None, delimiter=':', pillarenv=None, saltenv=None) New in version 0.14.
Attempt to retrieve the named value from in-memory pillar data. If the pillar key is not present in the in-memory pillar, then the value specified in the default option (described below) will be returned.
If the merge parameter is set to True, the default will be recursively merged into the returned pillar data.
The value can also represent a value in a nested dict using a ":" delimiter for the dict. This means that if a dict in pillar looks like this:
To retrieve the value associated with the apache key in the pkg dict this key can be passed as:
key    The pillar key to get value from
default The value specified by this option will be returned if the desired pillar key does not exist.
If a default value is not specified, then it will be an empty string, unless pillar_raise_on_missing is set to True, in which case an error will be raised.
merge  False If True, the retrieved values will be merged into the passed default. When the default and the retrieved value are both dictionaries, the dictionaries will be recursively merged.
Changed in version 2016.3.7,2016.11.4,2017.7.0: If the default and the retrieved value are not of the same type, then merging will be skipped and the retrieved value will be returned. Earlier releases raised an error in these cases.
merge_nested_lists If set to False, lists nested within the retrieved pillar dictionary will overwrite lists in default. If set to True, nested lists will be merged into lists in default. If unspecified (the default), this option is inherited from the pillar_merge_lists minion config option.
NOTE: This option is ignored when merge is set to False.
delimiter Specify an alternate delimiter to use when traversing a nested dict.  This is useful for when the desired key contains a colon. See CLI example below for usage.
pillarenv If specified, this function will query the master to generate fresh pillar data on the fly, specifically from the requested pillar environment. Note that this can produce different pillar data than executing this function without an environment, as its normal behavior is just to return a value from minion's pillar data in memory (which can be sourced from more than one pillar environment).
Using this argument will not affect the pillar data in memory. It will however be slightly slower and use more resources on the master due to the need for the master to generate and send the minion fresh pillar data. This tradeoff in performance however allows for the use case where pillar data is desired only from a single environment.
salt '*' pillar.get pkg:apache salt '*' pillar.get abc::def|ghi delimiter='|'
salt.modules.pillar.file_exists(path, saltenv=None) New in version 2016.3.0.
This is a master-only function. Calling from the minion is not supported.
Use the given path and search relative to the pillar environments to see if a file exists at that path.
If the saltenv argument is given, restrict search to that environment only.
Will only work with pillar_roots, not external pillars.
Returns True if the file is found, and False otherwise.
path   The path to the file in question. Will be treated as a relative path
saltenv Optional argument to restrict the search to a specific saltenv
salt '*' pillar.file_exists foo/bar.sls
salt.modules.pillar.filter_by(lookup_dict, pillar, merge=None, default='default', base=None) New in version 2017.7.0.
Look up the given pillar in a given dictionary and return the result
A dictionary, keyed by a pillar, containing a value or values relevant to systems matching that pillar. For example, a key could be a pillar for a role and the value could the name of a package on that particular OS.
The dictionary key can be a globbing pattern. The function will return the corresponding lookup_dict value where the pillar value matches the  pattern. For example:
# this will render 'got some salt' if ``role`` begins with 'salt' salt '*' pillar.filter_by '{salt*: got some salt, default: salt is not here}' role
• pillar --
The name of a pillar to match with the system's pillar. For example, the value of the "role" pillar could be used to pull values from the lookup_dict dictionary.
The pillar value can be a list. The function will return the lookup_dict value for a first found item in the list matching one of the lookup_dict keys.
• merge -- A dictionary to merge with the results of the pillar selection from lookup_dict. This allows another dictionary to override the values in the lookup_dict.
• default -- default lookup_dict's key used if the pillar does not exist or if the pillar value has no match on lookup_dict.  If unspecified the value is "default".
• base -- A lookup_dict key to use for a base dictionary. The pillar-selected lookup_dict is merged over this and then finally the merge dictionary is merged.  This allows common values for each case to be collected in the base and overridden by the pillar selection dictionary and the merge dictionary.  Default is unset.
salt '*' pillar.filter_by '{web: Serve it up, db: I query, default: x_x}' role
salt.modules.pillar.get(key, default=<class 'KeyError'>, merge=False, merge_nested_lists=None, delimiter=':', pillarenv=None, saltenv=None) New in version 0.14.
salt.modules.pillar.item(*args, **kwargs) New in version 0.16.2.
Return one or more pillar entries from the in-memory pillar data.
delimiter Delimiter used to traverse nested dictionaries.
NOTE: This is different from pillar.get in that no default value can be specified. pillar.get should probably still be used in most cases to retrieve nested pillar values, as it is a bit more flexible. One reason to use this function instead of pillar.get however is when it is desirable to retrieve the values of more than one key, since pillar.get can only retrieve one key at a time.
New in version 2017.7.6,2018.3.1.
salt '*' pillar.item foo salt '*' pillar.item foo:bar salt '*' pillar.item foo bar baz
salt.modules.pillar.items(*args, **kwargs) Calls the master for a fresh pillar and generates the pillar data on the fly
salt.modules.pillar.keys(key, delimiter=':') New in version 2015.8.0.
Attempt to retrieve a list of keys from the named value from the pillar.
The value can also represent a value in a nested dict using a ":" delimiter for the dict, similar to how pillar.get works.
salt '*' pillar.keys web:sites
salt.modules.pillar.ls(*args) New in version 2015.8.0.
Calls the master for a fresh pillar, generates the pillar data on the fly (same as items()), but only shows the available main keys.
salt '*' pillar.ls
salt.modules.pillar.obfuscate(*args) New in version 2015.8.0.
Same as items(), but replace pillar values with a simple type indication.
This is useful to avoid displaying sensitive information on console or flooding the console with long output, such as certificates.  For many debug or control purposes, the stakes lie more in dispatching than in actual values.
In case the value is itself a collection type, obfuscation occurs within the value.  For mapping types, keys are not obfuscated. Here are some examples:
• 'secret password' becomes '<str>'
• ['secret', 1] becomes ['<str>', '<int>']
• {'login': 'somelogin', 'pwd': 'secret'} becomes {'login': '<str>', 'pwd': '<str>'}
salt '*' pillar.obfuscate
salt.modules.pillar.raw(key=None) Return the raw pillar data that is currently loaded into the minion.
Contrast with items() which calls the master to fetch the most up-to-date Pillar.
salt '*' pillar.raw
With the optional key argument, you can select a subtree of the pillar raw data.:
salt '*' pillar.raw key='roles'
salt.modules.pip Install Python packages with pip to either the system or a virtualenv
Windows Support New in version 2014.7.4.
Salt now uses a portable python. As a result the entire pip module is now functional on the salt installation itself. You can pip install dependencies for your custom modules. You can even upgrade salt itself using pip. For this to work properly, you must specify the Current Working Directory (cwd) and the Pip Binary (bin_env) salt should use. The variable pip_bin can be either a virtualenv path or the path to the pip binary itself.
For example, the following command will list all software installed using pip to your current salt environment:
salt <minion> pip.list cwd='C:\salt\bin\Scripts' bin_env='C:\salt\bin\Scripts\pip.exe'
Specifying the cwd and bin_env options ensures you're modifying the salt environment. If these are omitted, it will default to the local installation of python. If python is not installed locally it will fail saying it couldn't find pip.
State File Support This functionality works in states as well. If you need to pip install colorama with a state, for example, the following will work:
install_colorama: pip.installed: - name: colorama - cwd: 'C:\salt\bin\scripts' - bin_env: 'C:\salt\bin\scripts\pip.exe' - upgrade: True
Upgrading Salt using Pip You can now update salt using pip to any version from the 2014.7 branch forward. Previous version require recompiling some of the dependencies which is painful in windows.
To do this you just use pip with git to update to the version you want and then restart the service. Here is a sample state file that upgrades salt to the head of the 2015.5 branch:
install_salt: pip.installed: - cwd: 'C:\salt\bin\scripts' - bin_env: 'C:\salt\bin\scripts\pip.exe' - editable: git+https://github.com/saltstack/salt@2015.5#egg=salt - upgrade: True
restart_service: service.running: - name: salt-minion - enable: True - watch: - pip: install_salt
NOTE: If you're having problems, you might try doubling the back slashes. For example, cwd: 'C:\salt\bin\scripts'. Sometimes python thinks the single back slash is an escape character.
There is a known incompatibility between Python2 pip>=10.* and Salt <=2018.3.0.  The issue is described here: https://github.com/saltstack/salt/issues/46163
salt.modules.pip.freeze(bin_env=None, user=None, cwd=None, use_vt=False, env_vars=None, **kwargs) Return a list of installed packages either globally or in the specified virtualenv
user   The user under which to run pip
cwd    Directory from which to run pip
NOTE: If the version of pip available is older than 8.0.3, the list will not include the packages pip, wheel, setuptools, or distribute even if they are installed.
salt '*' pip.freeze bin_env=/home/code/path/to/virtualenv
salt.modules.pip.install(pkgs=None, requirements=None, bin_env=None, use_wheel=False, no_use_wheel=False, log=None, proxy=None, timeout=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, global_options=None, install_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, saltenv='base', env_vars=None, use_vt=False, trusted_host=None, no_cache_dir=False, extra_args=None, cache_dir=None, no_binary=None, disable_version_check=False, **kwargs) Install packages with pip
Install packages individually or from a pip requirements file. Install packages globally or to a virtualenv.
pkgs   Comma separated list of packages to install
requirements Path to requirements
NOTE: For Windows, if the pip module is being used to upgrade the pip package, bin_env should be the path to the virtualenv or to the python binary that should be used. The pip command is unable to upgrade itself in Windows.
use_wheel Prefer wheel archives (requires pip>=1.4)
no_use_wheel Force to not use wheel archives (requires pip>=1.4,<10.0.0)
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 one or more package names with commas between them
log    Log file where a complete (maximum verbosity) record will be kept
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.
NOTE: If the Minion has a globaly configured proxy - it will be used even if no proxy was set here. To explicitly disable proxy for pip you should pass False as a value.
timeout Set the socket timeout (default 15 seconds)
editable install something editable (e.g. git+https://github.com/worldcompany/djangoembed.git#egg=djangoembed)
find_links URL to search for packages
index_url Base URL of Python Package Index
extra_index_url Extra URLs of package indexes to use in addition to index_url
no_index Ignore package index
mirrors Specific mirror URL(s) to query (automatically adds --use-mirrors)
WARNING: This option has been deprecated and removed in pip version 7.0.0.  Please use index_url and/or extra_index_url instead.
build  Unpack packages into build dir
target Install packages into target dir
download Download packages into download instead of installing them
download_cache | cache_dir Cache downloaded packages in download_cache or cache_dir dir
source Check out editable packages into source dir
upgrade Upgrade all packages to the newest available version
force_reinstall When upgrading, reinstall all packages even if they are already up-to-date.
ignore_installed Ignore the installed packages (reinstalling instead)
exists_action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup
no_deps Ignore package dependencies
no_install Download and unpack all packages, but don't actually install them
no_download Don't download any packages, just install the ones already downloaded (completes an install run with --no-install)
install_options Extra arguments to be supplied to the setup.py install command (e.g.  like --install-option='--install-scripts=/usr/local/bin').  Use multiple --install-option options to pass multiple options to setup.py install. If you are using an option with a directory path, be sure to use absolute path.
global_options Extra global options to be supplied to the setup.py call before the install command.
pre_releases Include pre-releases in the available versions
cert   Provide a path to an alternate CA bundle
allow_all_external Allow the installation of all externally hosted files
allow_external Allow the installation of externally hosted files (comma separated list)
allow_unverified Allow the installation of insecure and unverifiable files (comma separated list)
process_dependency_links Enable the processing of dependency links
env_vars Set environment variables that some builds will depend on. For example, a Python C-module may have a Makefile that needs INCLUDE_PATH set to pick up a header file while compiling.  This must be in the form of a dictionary or a mapping.
salt '*' pip.install django_app env_vars="{'CUSTOM_PATH': '/opt/django_app'}"
trusted_host Mark this host as trusted, even though it does not have valid or any HTTPS.
use_vt Use VT terminal emulation (see output while installing)
no_cache_dir Disable the cache.
extra_args pip keyword and positional arguments not yet implemented in salt
salt '*' pip.install pandas extra_args="[{'--latest-pip-kwarg':'param'}, '--latest-pip-arg']"
WARNING: If unsupported options are passed here that are not supported in a minion's version of pip, a No such option error will be thrown.
Will be translated into the following pip command:
pip install pandas --latest-pip-kwarg param --latest-pip-arg
disable_version_check Pip may periodically check PyPI to determine whether a new version of pip is available to download. Passing True for this option disables that check.
salt '*' pip.install <package name>,<package2 name> salt '*' pip.install requirements=/path/to/requirements.txt salt '*' pip.install <package name> bin_env=/path/to/virtualenv salt '*' pip.install <package name> bin_env=/path/to/pip_bin
Complicated CLI Example:
salt '*' pip.install markdown,django                 editable=git+https://github.com/worldcompany/djangoembed.git#egg=djangoembed upgrade=True no_deps=True
salt.modules.pip.is_installed(pkgname=None, bin_env=None, user=None, cwd=None) New in version 2018.3.0.
Filter list of installed apps from freeze and return True or False if pkgname exists in the list of packages installed.
NOTE: If the version of pip available is older than 8.0.3, the packages wheel, setuptools, and distribute will not be reported by this function even if they are installed. Unlike pip.freeze, this function always reports the version of pip which is installed.
salt '*' pip.is_installed salt
salt.modules.pip.list_(prefix=None, bin_env=None, user=None, cwd=None, env_vars=None, **kwargs) Filter list of installed apps from freeze and check to see if prefix exists in the list of packages installed.
salt '*' pip.list salt
salt.modules.pip.list_all_versions(pkg, bin_env=None, include_alpha=False, include_beta=False, include_rc=False, user=None, cwd=None, index_url=None, extra_index_url=None) New in version 2017.7.3.
List all available versions of a pip package
pkg    The package to check
include_alpha Include alpha versions in the list
include_beta Include beta versions in the list
include_rc Include release candidates versions in the list
index_url Base URL of Python Package Index .. versionadded:: 2019.2.0
extra_index_url Additional URL of Python Package Index .. versionadded:: 2019.2.0
salt '*' pip.list_all_versions <package name>
salt.modules.pip.list_upgrades(bin_env=None, user=None, cwd=None) Check whether or not an upgrade is available for all packages
salt '*' pip.list_upgrades
salt.modules.pip.uninstall(pkgs=None, requirements=None, bin_env=None, log=None, proxy=None, timeout=None, user=None, cwd=None, saltenv='base', use_vt=False) Uninstall packages individually or from a pip requirements file
pkgs   comma separated list of packages to install
requirements Path to requirements file
proxy  Specify a proxy in the format 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.
salt '*' pip.uninstall <package name>,<package2 name> salt '*' pip.uninstall requirements=/path/to/requirements.txt salt '*' pip.uninstall <package name> bin_env=/path/to/virtualenv salt '*' pip.uninstall <package name> bin_env=/path/to/pip_bin
salt.modules.pip.upgrade(bin_env=None, user=None, cwd=None, use_vt=False) New in version 2015.5.0.
Upgrades outdated pip packages.
NOTE: On Windows you can't update salt from pip using salt, so salt will be skipped
salt '*' pip.upgrade
salt.modules.pip.upgrade_available(pkg, bin_env=None, user=None, cwd=None) New in version 2015.5.0.
Check whether or not an upgrade is available for a given package
salt '*' pip.upgrade_available <package name>
salt.modules.pip.version(bin_env=None, cwd=None, user=None) New in version 0.17.0.
Returns the version of pip. Use bin_env to specify the path to a virtualenv and get the version of pip in that virtualenv.
If unable to detect the pip version, returns None.
Changed in version 3001.1: The user parameter was added, to allow specifying the user who runs the version command.
salt '*' pip.version
salt.modules.pkg_resource Resources needed by pkg providers
salt.modules.pkg_resource.add_pkg(pkgs, name, pkgver) Add a package to a dict of installed packages.
salt '*' pkg_resource.add_pkg '{}' bind 9
salt.modules.pkg_resource.check_extra_requirements(pkgname, pkgver) Check if the installed package already has the given requirements. This function will return the result of pkg.check_extra_requirements if this function exists for the minion, otherwise it will return True.
salt '*' pkg_resource.check_extra_requirements <pkgname> <extra_requirements>
salt.modules.pkg_resource.format_pkg_list(packages, versions_as_list, attr) Formats packages according to parameters for list_pkgs.
salt.modules.pkg_resource.format_version(epoch, version, release) Formats a version string for list_pkgs.
salt.modules.pkg_resource.pack_sources(sources, normalize=True) Accepts list of dicts (or a string representing a list of dicts) and packs the key/value pairs into a single dict.
'[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]' would become {"foo": "salt://foo.rpm", "bar": "salt://bar.rpm"}
normalize True 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.
salt '*' pkg_resource.pack_sources '[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]'
salt.modules.pkg_resource.parse_targets(name=None, pkgs=None, sources=None, saltenv='base', normalize=True, **kwargs) Parses the input to pkg.install and returns back the package(s) to be installed. Returns a list of packages, as well as a string noting whether the packages are to come from a repository or a binary package.
salt '*' pkg_resource.parse_targets
salt.modules.pkg_resource.sort_pkglist(pkgs) Accepts a dict obtained from pkg.list_pkgs() and sorts in place the list of versions for any packages that have multiple versions installed, so that two package lists can be compared to one another.
salt '*' pkg_resource.sort_pkglist '["3.45", "2.13"]'
salt.modules.pkg_resource.stringify(pkgs) Takes a dict of package name/version information and joins each list of installed versions into a string.
salt '*' pkg_resource.stringify 'vim: 7.127'
salt.modules.pkg_resource.version(*names, **kwargs) Common interface for obtaining the version of installed packages.
salt '*' pkg_resource.version vim salt '*' pkg_resource.version foo bar baz salt '*' pkg_resource.version 'python*'
salt.modules.pkg_resource.version_clean(verstr) Clean the version string removing extra data.  This function will simply try to call pkg.version_clean.
salt '*' pkg_resource.version_clean <version_string>
salt.modules.pkg_resource.version_compare(ver1, oper, ver2, ignore_epoch=False) New in version 3001.
Perform a version comparison, using (where available) platform-specific version comparison tools to make the comparison.
ver1   The first version to be compared
oper   One of ==, !=, >=, <=, >, <
ver2   The second version to be compared
NOTE: To avoid shell interpretation, each of the above values should be quoted when this function is used on the CLI.
ignore_epoch False If True, both package versions will have their epoch prefix stripped before comparison.
This function is useful in Jinja templates, to perform specific actions when a package's version meets certain criteria. For example:
{%- set postfix_version = salt.pkg.version('postfix') %} {%- if postfix_version and salt.pkg_resource.version_compare(postfix_version, '>=', '3.3', ignore_epoch=True) %} {#- do stuff #} {%- endif %}
salt myminion pkg_resource.version_compare '3.5' '<=' '2.4' salt myminion pkg_resource.version_compare '3.5' '<=' '2.4' ignore_epoch=True
salt.modules.pkgin Package support for pkgin based systems, inspired from freebsdpkg module
salt.modules.pkgin.available_version(*names, **kwargs) This function is an alias of latest_version. Changed in version 2016.3.0.
Return the latest version of the named package available for upgrade or installation.
salt '*' pkg.latest_version <package name> salt '*' pkg.latest_version <package1> <package2> ...
salt.modules.pkgin.file_dict(*packages, **kwargs) Changed in version 2016.3.0.
List the files that belong to a package.
salt '*' pkg.file_dict nginx salt '*' pkg.file_dict nginx varnish
salt.modules.pkgin.file_list(package, **kwargs) List the files that belong to a package.
salt '*' pkg.file_list nginx
salt.modules.pkgin.install(name=None, refresh=False, fromrepo=None, pkgs=None, sources=None, **kwargs) Install the passed package
fromrepo Specify a package repository to install from.
salt.modules.pkgin.latest_version(*names, **kwargs) Changed in version 2016.3.0.
salt.modules.pkgin.list_pkgs(versions_as_list=False, **kwargs) Changed in version 2016.3.0.
List the packages currently installed as a dict:
salt.modules.pkgin.list_upgrades(refresh=True, **kwargs) List all available package upgrades.
salt.modules.pkgin.normalize_name(pkgs, **kwargs) Normalize package names
NOTE: Nothing special to do to normalize, just return the original. (We do need it to be compatible with the pkg_resource provider.)
salt.modules.pkgin.purge(name=None, pkgs=None, **kwargs) Package purges are not supported, this function is identical to remove().
salt.modules.pkgin.refresh_db(force=False, **kwargs) Use pkg update to get latest pkg_summary
force  Pass -f so that the cache is always refreshed.
salt.modules.pkgin.remove(name=None, pkgs=None, **kwargs)
salt.modules.pkgin.search(pkg_name, **kwargs) Searches for an exact match using pkgin ^package$
salt '*' pkg.search 'mysql-server'
salt.modules.pkgin.upgrade(refresh=True, pkgs=None, **kwargs) Run pkg upgrade, if pkgin used. Otherwise do nothing
Multiple Package Upgrade Options:
pkgs   A list of packages to upgrade from a software repository. Must be passed as a python list.
salt '*' pkg.upgrade pkgs='["foo","bar"]'
salt.modules.pkgin.version(*names, **kwargs) Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned.
salt.modules.pkgng Support for pkgng, the new package manager for FreeBSD
WARNING: This module has been completely rewritten. Up to and including version 0.17.x, it was available as the pkgng module, (pkgng.install, pkgng.delete, etc.), but moving forward this module will no longer be available as pkgng, as it will behave like a normal Salt pkg provider. The documentation below should not be considered to apply to this module in versions <= 0.17.x. If your minion is running a 0.17.x release or older, then the documentation for this module can be viewed using the sys.doc function:
salt bsdminion sys.doc pkgng
This module provides an interface to pkg(8). It acts as the default package provider for FreeBSD 10 and newer. For FreeBSD hosts which have been upgraded to use pkgng, you will need to override the pkg provider by setting the providers parameter in your Minion config file, in order to use this module to manage packages, like so:
salt.modules.pkgng.audit(jail=None, chroot=None, root=None) Audits installed packages against known vulnerabilities
salt '*' pkg.audit
jail   Audit packages within the specified jail
salt '*' pkg.audit jail=<jail name or id>
chroot Audit packages within the specified chroot (ignored if jail is specified)
root   Audit packages within the specified root (ignored if jail is specified)
salt '*' pkg.audit chroot=/path/to/chroot
salt.modules.pkgng.autoremove(jail=None, chroot=None, root=None, dryrun=False) Delete packages which were automatically installed as dependencies and are not required anymore.
dryrun Dry-run mode. The list of changes to packages is always printed, but no changes are actually made.
salt '*' pkg.autoremove salt '*' pkg.autoremove jail=<jail name or id> salt '*' pkg.autoremove dryrun=True salt '*' pkg.autoremove jail=<jail name or id> dryrun=True
salt.modules.pkgng.available_version(*names, **kwargs) This function is an alias of latest_version. Return the latest version of the named package available for upgrade or installation. If more than one package name is specified, a dict of name/version pairs is returned.
salt '*' pkg.latest_version <package name> salt '*' pkg.latest_version <package name> jail=<jail name or id> salt '*' pkg.latest_version <package name> chroot=/path/to/chroot
salt.modules.pkgng.backup(file_name, jail=None, chroot=None, root=None) Export installed packages into yaml+mtree file
salt '*' pkg.backup /tmp/pkg
jail   Backup packages from the specified jail. Note that this will run the command within the jail, and so the path to the backup file will be relative to the root of the jail
salt '*' pkg.backup /tmp/pkg jail=<jail name or id>
chroot Backup packages from the specified chroot (ignored if jail is specified). Note that this will run the command within the chroot, and so the path to the backup file will be relative to the root of the chroot.
root   Backup packages from the specified root (ignored if jail is specified). Note that this will run the command within the root, and so the path to the backup file will be relative to the root of the root.
salt '*' pkg.backup /tmp/pkg chroot=/path/to/chroot
salt.modules.pkgng.check(jail=None, chroot=None, root=None, depends=False, recompute=False, checksum=False, checklibs=False) Sanity checks installed packages
jail   Perform the sanity check in the specified jail
salt '*' pkg.check jail=<jail name or id>
chroot Perform the sanity check in the specified chroot (ignored if jail is specified)
root   Perform the sanity check in the specified root (ignored if jail is specified)
salt '*' pkg.check chroot=/path/to/chroot
Of the below, at least one must be set to True.
depends Check for and install missing dependencies.
salt '*' pkg.check depends=True
recompute Recompute sizes and checksums of installed packages.
salt '*' pkg.check recompute=True
checksum Find invalid checksums for installed packages.
salt '*' pkg.check checksum=True
checklibs Regenerates the library dependency metadata for a package.
salt '*' pkg.check checklibs=True
salt.modules.pkgng.clean(jail=None, chroot=None, root=None, clean_all=False, dryrun=False) Cleans the local cache of fetched remote packages
salt '*' pkg.clean
jail   Cleans the package cache in the specified jail
salt '*' pkg.clean jail=<jail name or id>
chroot Cleans the package cache in the specified chroot (ignored if jail is specified)
root   Cleans the package cache in the specified root (ignored if jail is specified)
salt '*' pkg.clean chroot=/path/to/chroot
clean_all Clean all packages from the local cache (not just those that have been superseded by newer versions).
salt '*' pkg.clean clean_all=True
dryrun Dry-run mode. This list of changes to the local cache is always printed, but no changes are actually made.
salt '*' pkg.clean dryrun=True
salt.modules.pkgng.delete(name=None, pkgs=None, jail=None, chroot=None, root=None, all_installed=False, force=False, glob=False, dryrun=False, recurse=False, regex=False, pcre=False, **kwargs) This function is an alias of remove. Remove a package from the database and system
NOTE: This function can accessed using pkg.delete in addition to pkg.remove, to more closely match the CLI usage of pkg(8).
name   The package to remove
salt '*' pkg.remove <package name>
jail   Delete the package from the specified jail
chroot Delete the package from the specified chroot (ignored if jail is specified)
root   Delete the package from the specified root (ignored if jail is specified)
all_installed Deletes all installed packages from the system and empties the database. USE WITH CAUTION!
salt '*' pkg.remove all all_installed=True force=True
force  Forces packages to be removed despite leaving unresolved dependencies.
salt '*' pkg.remove <package name> force=True
glob   Treat the package names as shell glob patterns.
salt '*' pkg.remove <package name> glob=True
dryrun Dry run mode. The list of packages to delete is always printed, but no packages are actually deleted.
salt '*' pkg.remove <package name> dryrun=True
recurse Delete all packages that require the listed package as well.
salt '*' pkg.remove <package name> recurse=True
regex  Treat the package names as regular expressions.
salt '*' pkg.remove <regular expression> regex=True
pcre   Treat the package names as extended regular expressions.
salt '*' pkg.remove <extended regular expression> pcre=True
salt.modules.pkgng.fetch(name, jail=None, chroot=None, root=None, fetch_all=False, quiet=False, fromrepo=None, glob=True, regex=False, pcre=False, local=False, depends=False) Fetches remote packages
salt '*' pkg.fetch <package name>
jail   Fetch package in the specified jail
salt '*' pkg.fetch <package name> jail=<jail name or id>
chroot Fetch package in the specified chroot (ignored if jail is specified)
root   Fetch package in the specified root (ignored if jail is specified)
salt '*' pkg.fetch <package name> chroot=/path/to/chroot
fetch_all Fetch all packages.
salt '*' pkg.fetch <package name> fetch_all=True
quiet  Quiet mode. Show less output.
salt '*' pkg.fetch <package name> quiet=True
fromrepo Fetches packages from the given repo if multiple repo support is enabled. See pkg.conf(5).
salt '*' pkg.fetch <package name> fromrepo=repo
glob   Treat pkg_name as a shell glob pattern.
salt '*' pkg.fetch <package name> glob=True
regex  Treat pkg_name as a regular expression.
salt '*' pkg.fetch <regular expression> regex=True
pcre   Treat pkg_name is an extended regular expression.
salt '*' pkg.fetch <extended regular expression> pcre=True
local  Skip updating the repository catalogs with pkg-update(8). Use the local cache only.
salt '*' pkg.fetch <package name> local=True
depends Fetch the package and its dependencies as well.
salt '*' pkg.fetch <package name> depends=True
salt.modules.pkgng.hold(name=None, pkgs=None, **kwargs) Version-lock packages
NOTE: This function is provided primarily for compatibility with some parts of states.pkg.  Consider using Consider using pkg.lock instead. instead.
name   The name of the package to be held.
pkgs   A list of packages to hold. Must be passed as a python list. The name parameter will be ignored if this option is passed.
salt '*' pkg.hold <package name> salt '*' pkg.hold pkgs='["foo", "bar"]'
salt.modules.pkgng.info(*names, **kwargs) This function is an alias of version. Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned.
NOTE: This function can accessed using pkg.info in addition to pkg.version, to more closely match the CLI usage of pkg(8).
jail   Get package version information for the specified jail
chroot Get package version information for the specified chroot (ignored if jail is specified)
root   Get package version information for the specified root (ignored if jail is specified)
salt '*' pkg.version <package name> salt '*' pkg.version <package name> jail=<jail name or id> salt '*' pkg.version <package1> <package2> <package3> ...
salt.modules.pkgng.install(name=None, fromrepo=None, pkgs=None, sources=None, jail=None, chroot=None, root=None, orphan=False, force=False, glob=False, local=False, dryrun=False, quiet=False, reinstall_requires=False, regex=False, pcre=False, batch=False, **kwargs) Install package(s) from a repository
name   The name of the package to install
jail   Install the package into the specified jail
chroot Install the package into the specified chroot (ignored if jail is specified)
root   Install the package into the specified root (ignored if jail is specified)
orphan Mark the installed package as orphan. Will be automatically removed if no other packages depend on them. For more information please refer to pkg-autoremove(8).
salt '*' pkg.install <package name> orphan=True
force  Force the reinstallation of the package if already installed.
salt '*' pkg.install <package name> force=True
salt '*' pkg.install <package name> glob=True
local  Do not update the repository catalogs with pkg-update(8). A value of True here is equivalent to using the -U flag with pkg install.
salt '*' pkg.install <package name> local=True
dryrun Dru-run mode. The list of changes to packages is always printed, but no changes are actually made.
salt '*' pkg.install <package name> dryrun=True
quiet  Force quiet output, except when dryrun is used, where pkg install will always show packages to be installed, upgraded or deleted.
salt '*' pkg.install <package name> quiet=True
reinstall_requires When used with force, reinstalls any packages that require the given package.
salt '*' pkg.install <package name> reinstall_requires=True force=True
Changed in version 2014.7.0: require kwarg renamed to reinstall_requires
fromrepo In multi-repo mode, override the pkg.conf ordering and only attempt to download packages from the named repository.
salt '*' pkg.install <package name> fromrepo=repo
regex  Treat the package names as a regular expression
salt '*' pkg.install <regular expression> regex=True
batch  Use BATCH=true for pkg install, skipping all questions.  Be careful when using in production.
salt '*' pkg.install <package name> batch=True
salt.modules.pkgng.latest_version(*names, **kwargs) Return the latest version of the named package available for upgrade or installation. If more than one package name is specified, a dict of name/version pairs is returned.
salt.modules.pkgng.list_locked(**kwargs) Query the package database those packages which are locked against reinstallation, modification or deletion.
Returns returns a list of package names with version strings
salt '*' pkg.list_locked
jail   List locked packages within the specified jail
salt '*' pkg.list_locked jail=<jail name or id>
chroot List locked packages within the specified chroot (ignored if jail is specified)
salt '*' pkg.list_locked chroot=/path/to/chroot
root   List locked packages within the specified root (ignored if jail is specified)
salt '*' pkg.list_locked root=/path/to/chroot
salt.modules.pkgng.list_pkgs(versions_as_list=False, jail=None, chroot=None, root=None, with_origin=False, **kwargs) List the packages currently installed as a dict:
jail   List the packages in the specified jail
chroot List the packages in the specified chroot (ignored if jail is specified)
root   List the packages in the specified root (ignored if jail is specified)
salt '*' pkg.list_pkgs salt '*' pkg.list_pkgs jail=<jail name or id> salt '*' pkg.list_pkgs chroot=/path/to/chroot
salt.modules.pkgng.list_upgrades(refresh=True, **kwargs) List those packages for which an upgrade is available
The fromrepo argument is also supported, as used in pkg states.
jail   List upgrades within the specified jail
salt '*' pkg.list_upgrades jail=<jail name or id>
chroot List upgrades within the specified chroot (ignored if jail is specified)
salt '*' pkg.list_upgrades chroot=/path/to/chroot
root   List upgrades within the specified root (ignored if jail is specified)
salt '*' pkg.list_upgrades root=/path/to/chroot
salt.modules.pkgng.lock(name, **kwargs) Lock the named package against reinstallation, modification or deletion.
Returns True if the named package was successfully locked.
salt '*' pkg.lock <package name>
jail   Lock packages within the specified jail
salt '*' pkg.lock <package name> jail=<jail name or id>
chroot Lock packages within the specified chroot (ignored if jail is specified)
salt '*' pkg.lock <package name> chroot=/path/to/chroot
root   Lock packages within the specified root (ignored if jail is specified)
salt '*' pkg.lock <package name> root=/path/to/chroot
salt.modules.pkgng.locked(name, **kwargs) Query the package database to determine if the named package is locked against reinstallation, modification or deletion.
Returns True if the named package is locked, False otherwise.
salt '*' pkg.locked <package name>
jail   Test if a package is locked within the specified jail
salt '*' pkg.locked <package name> jail=<jail name or id>
chroot Test if a package is locked within the specified chroot (ignored if jail is specified)
salt '*' pkg.locked <package name> chroot=/path/to/chroot
root   Test if a package is locked within the specified root (ignored if jail is specified)
salt '*' pkg.locked <package name> root=/path/to/chroot
salt.modules.pkgng.parse_config(file_name='/usr/local/etc/pkg.conf') Return dict of uncommented global variables.
salt '*' pkg.parse_config
NOTE: not working properly right now
salt.modules.pkgng.purge(name=None, pkgs=None, jail=None, chroot=None, root=None, all_installed=False, force=False, glob=False, dryrun=False, recurse=False, regex=False, pcre=False, **kwargs) This function is an alias of remove. Remove a package from the database and system
salt.modules.pkgng.refresh_db(jail=None, chroot=None, root=None, force=False, **kwargs) Refresh PACKAGESITE contents
NOTE: This function can accessed using pkg.update in addition to pkg.refresh_db, to more closely match the CLI usage of pkg(8).
jail   Refresh the pkg database within the specified jail
chroot Refresh the pkg database within the specified chroot (ignored if jail is specified)
root   Refresh the pkg database within the specified root (ignored if jail is specified)
force  Force a full download of the repository catalog without regard to the respective ages of the local and remote copies of the catalog.
salt '*' pkg.refresh_db force=True
salt.modules.pkgng.remove(name=None, pkgs=None, jail=None, chroot=None, root=None, all_installed=False, force=False, glob=False, dryrun=False, recurse=False, regex=False, pcre=False, **kwargs) Remove a package from the database and system
salt.modules.pkgng.restore(file_name, jail=None, chroot=None, root=None) Reads archive created by pkg backup -d and recreates the database.
salt '*' pkg.restore /tmp/pkg
jail   Restore database to the specified jail. Note that this will run the command within the jail, and so the path to the file from which the pkg database will be restored is relative to the root of the jail.
salt '*' pkg.restore /tmp/pkg jail=<jail name or id>
chroot Restore database to the specified chroot (ignored if jail is specified). Note that this will run the command within the chroot, and so the path to the file from which the pkg database will be restored is relative to the root of the chroot.
root   Restore database to the specified root (ignored if jail is specified). Note that this will run the command within the root, and so the path to the file from which the pkg database will be restored is relative to the root of the root.