neulab/tldr huggingface dataset:
┌─────────────────┬─────────────────────────────┐ │Execution Module │ Used for                    │ ├─────────────────┼─────────────────────────────┤ │debian_service   │ Debian Wheezy and earlier   │ ├─────────────────┼─────────────────────────────┤ │freebsdservice   │ FreeBSD-based OSes using    │ │                 │ service(8)                  │ ├─────────────────┼─────────────────────────────┤ │gentoo_service   │ Gentoo Linux using sysvinit │ │                 │ and rc-update(8)            │ ├─────────────────┼─────────────────────────────┤ │mac_service      │ Mac OS hosts using          │ │                 │ launchctl(1)                │ ├─────────────────┼─────────────────────────────┤ │netbsdservice    │ NetBSD-based OSes           │ ├─────────────────┼─────────────────────────────┤ │openbsdservice   │ OpenBSD-based OSes          │ ├─────────────────┼─────────────────────────────┤ │rh_service       │ RedHat-based distros and    │ │                 │ derivatives using           │ │                 │ service(8) and              │ │                 │ chkconfig(8). Supports both │ │                 │ pure sysvinit and mixed     │ │                 │ sysvinit/upstart systems.   │ ├─────────────────┼─────────────────────────────┤ │service          │ Fallback which simply wraps │ │                 │ sysvinit scripts            │ ├─────────────────┼─────────────────────────────┤ │smf_service      │ Solaris-based OSes which    │ │                 │ use SMF                     │ ├─────────────────┼─────────────────────────────┤ │systemd_service  │ Linux distros which use     │ │                 │ systemd                     │ ├─────────────────┼─────────────────────────────┤ │upstart_service  │ Ubuntu-based distros using  │ │                 │ upstart                     │ ├─────────────────┼─────────────────────────────┤ │win_service      │ Windows                     │ └─────────────────┴─────────────────────────────┘
salt.modules.shadow shadow is a virtual module that is fulfilled by one of the following modules:
┌─────────────────┬──────────────────────────┐ │Execution Module │ Used for                 │ ├─────────────────┼──────────────────────────┤ │aix_shadow       │ AIX                      │ ├─────────────────┼──────────────────────────┤ │linux_shadow     │ Linux                    │ ├─────────────────┼──────────────────────────┤ │bsd_shadow       │ FreeBSD, OpenBSD, NetBSD │ ├─────────────────┼──────────────────────────┤ │solaris_shadow   │ Solaris-based OSes       │ ├─────────────────┼──────────────────────────┤ │win_shadow       │ Windows                  │ └─────────────────┴──────────────────────────┘
salt.modules.sysctl sysctl is a virtual module that is fulfilled by one of the following modules:
┌─────────────────┬──────────┐ │Execution Module │ Used for │ ├─────────────────┼──────────┤ │freebsd_sysctl   │ FreeBSD  │ ├─────────────────┼──────────┤ │linux_sysctl     │ Linux    │ ├─────────────────┼──────────┤ │mac_sysctl       │ macOS    │ ├─────────────────┼──────────┤ │netbsd_sysctl    │ NetBSD   │ ├─────────────────┼──────────┤ │openbsd_sysctl   │ OpenBSD  │ └─────────────────┴──────────┘
salt.modules.user user is a virtual module that is fulfilled by one of the following modules:
┌─────────────────┬────────────────────────────┐ │Execution Module │ Used for                   │ ├─────────────────┼────────────────────────────┤ │useradd          │ Linux, NetBSD, and OpenBSD │ │                 │ systems using useradd(8),  │ │                 │ userdel(8), and usermod(8) │ ├─────────────────┼────────────────────────────┤ │pw_user          │ FreeBSD-based OSes using   │ │                 │ pw(8)                      │ ├─────────────────┼────────────────────────────┤ │solaris_user     │ Solaris-based OSes using   │ │                 │ useradd(1M), userdel(1M),  │ │                 │ and usermod(1M)            │ ├─────────────────┼────────────────────────────┤ │mac_user         │ MacOS                      │ ├─────────────────┼────────────────────────────┤ │win_useradd      │ Windows                    │ └─────────────────┴────────────────────────────┘
salt.modules.acme ACME / Let's Encrypt module New in version 2016.3.
This module currently looks for certbot script in the $PATH as - certbot, - lestsencrypt, - certbot-auto, - letsencrypt-auto eventually falls back to /opt/letsencrypt/letsencrypt-auto
NOTE: Installation & configuration of the Let's Encrypt client can for example be done using https://github.com/saltstack-formulas/letsencrypt-formula
WARNING: Be sure to set at least accept-tos = True in cli.ini!
Most parameters will fall back to cli.ini defaults if None is given.
DNS plugins This module currently supports the CloudFlare certbot DNS plugin.  The DNS plugin credentials file needs to be passed in using the dns_plugin_credentials argument.
Make sure the appropriate certbot plugin for the wanted DNS provider is installed before using this module.
salt.modules.acme.cert(name, aliases=None, email=None, webroot=None, test_cert=False, renew=None, keysize=None, server=None, owner='root', group='root', mode='0640', certname=None, preferred_challenges=None, tls_sni_01_port=None, tls_sni_01_address=None, http_01_port=None, http_01_address=None, dns_plugin=None, dns_plugin_credentials=None) Obtain/renew a certificate from an ACME CA, probably Let's Encrypt.
• name -- Common Name of the certificate (DNS name of certificate)
• aliases -- subjectAltNames (Additional DNS names on certificate)
• email -- e-mail address for interaction with ACME provider
• webroot -- True or a full path to use to use webroot. Otherwise use standalone mode
• test_cert -- Request a certificate from the Happy Hacker Fake CA (mutually exclusive with 'server')
• renew -- True/'force' to force a renewal, or a window of renewal before expiry in days
• keysize -- RSA key bits
• server -- API endpoint to talk to
• owner -- owner of the private key file
• group -- group of the private key file
• mode -- mode of the private key file
• certname -- Name of the certificate to save
• preferred_challenges -- A sorted, comma delimited list of the preferred challenge to use during authorization with the most preferred challenge listed first.
• tls_sni_01_port -- Port used during tls-sni-01 challenge. This only affects the port Certbot listens on. A conforming ACME server will still attempt to connect on port 443.
• tls_sni_01_address -- The address the server listens to during tls-sni-01 challenge.
• http_01_port -- Port used in the http-01 challenge. This only affects the port Certbot listens on. A conforming ACME server will still attempt to connect on port 80.
• https_01_address -- The address the server listens to during http-01 challenge.
• dns_plugin -- Name of a DNS plugin to use (currently only 'cloudflare' or 'digitalocean')
• dns_plugin_credentials -- Path to the credentials file if required by the specified DNS plugin
• dns_plugin_propagate_seconds -- Number of seconds to wait for DNS propogations before asking ACME servers to verify the DNS record. (default 10)
Returns Dictionary with 'result' True/False/None, 'comment' and certificate's expiry date ('not_after')
salt 'gitlab.example.com' acme.cert dev.example.com "[gitlab.example.com]" test_cert=True         renew=14 webroot=/opt/gitlab/embedded/service/gitlab-rails/public
salt.modules.acme.certs() Return a list of active certificates
salt 'vhost.example.com' acme.certs
salt.modules.acme.expires(name) The expiry date of a certificate in ISO format
Parameters name (str) -- Name of certificate
Returns Expiry date in ISO format.
salt 'gitlab.example.com' acme.expires dev.example.com
salt.modules.acme.has(name) Test if a certificate is in the Let's Encrypt Live directory
if __salt__['acme.has']('dev.example.com'): log.info('That is one nice certificate you have there!')
salt.modules.acme.info(name) Return information about a certificate
Returns Dictionary with information about the certificate.  If neither the tls nor the x509 module can be used to determine the certificate information, the information will be retrieved as one big text block under the key text using the openssl cli.
salt 'gitlab.example.com' acme.info dev.example.com
salt.modules.acme.needs_renewal(name, window=None) Check if a certificate needs renewal
• name (str) -- Name of certificate
• window (bool/str/int) -- Window in days to renew earlier or True/force to just return True
Returns Whether or not the certificate needs to be renewed.
if __salt__['acme.needs_renewal']('dev.example.com'): __salt__['acme.cert']('dev.example.com', **kwargs) else: log.info('Your certificate is still good')
salt.modules.acme.renew_by(name, window=None) Date in ISO format when a certificate should first be renewed
• window (int) -- number of days before expiry when renewal should take place
Returns Date of certificate renewal in ISO format.
salt.modules.aix_group Manage groups on Solaris
IMPORTANT: If you feel that Salt should be using this module to manage groups on a minion, and it is using a different module (or gives an error similar to 'group.info' is not available), see here.
salt.modules.aix_group.add(name, gid=None, system=False, root=None) Add the specified group
salt '*' group.add foo 3456
salt.modules.aix_group.adduser(name, username, root=None) Add a user in the group.
salt '*' group.adduser foo bar
Verifies if a valid username 'bar' as a member of an existing group 'foo', if not then adds it.
salt.modules.aix_group.chgid(name, gid) Change the gid for a named group
salt '*' group.chgid foo 4376
salt.modules.aix_group.delete(name) Remove the named group
salt '*' group.delete foo
salt.modules.aix_group.deluser(name, username, root=None) Remove a user from the group.
salt '*' group.deluser foo bar
Removes a member user 'bar' from a group 'foo'. If group is not present then returns True.
salt.modules.aix_group.getent(refresh=False) Return info on all groups
salt '*' group.getent
salt.modules.aix_group.info(name) Return information about a group
salt '*' group.info foo
salt.modules.aix_group.members(name, members_list, root=None) Replaces members of the group with a provided list.
salt '*' group.members foo 'user1,user2,user3,...'
Replaces a membership list for a local group 'foo'. foo:x:1234:user1,user2,user3,...
salt.modules.aix_shadow Manage account locks on AIX systems
salt.modules.aix_shadow.locked(user) Query for all accounts which are flagged as locked.
salt <minion_id> shadow.locked ALL
salt.modules.aix_shadow.login_failures(user) Query for all accounts which have 3 or more login failures.
salt <minion_id> shadow.login_failures ALL
salt.modules.aix_shadow.unlock(user) Unlock user for locked account
salt <minion_id> shadow.unlock user
salt.modules.aixpkg Package support for AIX
IMPORTANT: If you feel that Salt should be using this module to manage filesets or rpm packages on a minion, and it is using a different module (or gives an error similar to 'pkg.install' is not available), see here.
salt.modules.aixpkg.available_version(*names, **kwargs) This function is an alias of latest_version. Return the latest version of the named fileset/rpm package available for upgrade or installation. If more than one fileset/rpm package name is specified, a dict of name/version pairs is returned.
If the latest version of a given fileset/rpm package is already installed, an empty string will be returned for that package.
salt '*' pkg.latest_version <package name> salt '*' pkg.latest_version <package1> <package2> <package3> ...
NOTE: Repositories are not presently supported for AIX.  This function will always return an empty string for a given fileset/rpm package.
salt.modules.aixpkg.install(name=None, refresh=False, pkgs=None, version=None, test=False, **kwargs) Install the named fileset(s)/rpm package(s).
name   The name of the fileset or rpm package to be installed.
refresh Whether or not to update the yum database before executing.
Multiple Package Installation Options:
pkgs   A list of filesets and/or rpm packages to install.  Must be passed as a python list. The name parameter will be ignored if this option is passed.
version Install a specific version of a fileset/rpm package. (Unused at present).
test   Verify that command functions correctly:
Returns a dict containing the new fileset(s)/rpm package(s) names and versions:
{'<package>': {'old': '<old-version>', 'new': '<new-version>'}}
salt '*' pkg.install /stage/middleware/AIX/bash-4.2-3.aix6.1.ppc.rpm salt '*' pkg.install /stage/middleware/AIX/bash-4.2-3.aix6.1.ppc.rpm refresh=True salt '*' pkg.install /stage/middleware/AIX/VIOS2211_update/tpc_4.1.1.85.bff salt '*' pkg.install /stage/middleware/AIX/Xlc/usr/sys/inst.images/xlC.rte salt '*' pkg.install /stage/middleware/AIX/Firefox/ppc-AIX53/Firefox.base salt '*' pkg.install pkgs='["foo", "bar"]'
salt.modules.aixpkg.latest_version(*names, **kwargs) Return the latest version of the named fileset/rpm package available for upgrade or installation. If more than one fileset/rpm package name is specified, a dict of name/version pairs is returned.
salt.modules.aixpkg.list_pkgs(versions_as_list=False, **kwargs) List the filesets/rpm packages currently installed as a dict:
{'<package_name>': '<version>'}
salt '*' pkg.list_pkgs
salt.modules.aixpkg.remove(name=None, pkgs=None, **kwargs) Remove specified fileset(s)/rpm package(s).
name   The name of the fileset or rpm package to be deleted.
Multiple Package Options:
pkgs   A list of filesets and/or rpm packages to delete.  Must be passed as a python list. The name parameter will be ignored if this option is passed.
Returns a list containing the removed packages.
salt '*' pkg.remove <fileset/rpm package name> salt '*' pkg.remove tcsh salt '*' pkg.remove xlC.rte salt '*' pkg.remove Firefox.base.adt salt '*' pkg.remove pkgs='["foo", "bar"]'
salt.modules.aixpkg.upgrade_available(name, **kwargs) Check whether or not an upgrade is available for a given package
salt '*' pkg.upgrade_available <package name>
salt.modules.aixpkg.version(*names, **kwargs) Common interface for obtaining the version of installed fileset/rpm package.
salt '*' pkg.version vim salt '*' pkg.version foo bar baz
salt.modules.aliases Manage the information in the aliases file
salt.modules.aliases.get_target(alias) Return the target associated with an alias
salt '*' aliases.get_target alias
salt.modules.aliases.has_target(alias, target) Return true if the alias/target is set
salt '*' aliases.has_target alias target
salt.modules.aliases.list_aliases() Return the aliases found in the aliases file in this format:
{'alias': 'target'}
salt '*' aliases.list_aliases
salt.modules.aliases.rm_alias(alias) Remove an entry from the aliases file
salt '*' aliases.rm_alias alias
salt.modules.aliases.set_target(alias, target) Set the entry in the aliases file for the given alias, this will overwrite any previous entry for the given alias or create a new one if it does not exist.
salt '*' aliases.set_target alias target
salt.modules.alternatives Support for Alternatives system
codeauthor Radek Rada <radek.rada@gmail.com>
salt.modules.alternatives.auto(name) Trigger alternatives to set the path for <name> as specified by priority.
salt '*' alternatives.auto name
salt.modules.alternatives.check_exists(name, path) Check if the given path is an alternative for a name.
salt '*' alternatives.check_exists name path
salt.modules.alternatives.check_installed(name, path) Check if the current highest-priority match for a given alternatives link is set to the desired path
salt '*' alternatives.check_installed name path
salt.modules.alternatives.display(name) Display alternatives settings for defined command name
salt '*' alternatives.display editor
salt.modules.alternatives.install(name, link, path, priority) Install symbolic links determining default commands
salt '*' alternatives.install editor /usr/bin/editor /usr/bin/emacs23 50
salt.modules.alternatives.remove(name, path) Remove symbolic links determining the default commands.
salt '*' alternatives.remove name path
salt.modules.alternatives.set_(name, path) Manually set the alternative <path> for <name>.
salt '*' alternatives.set name path
salt.modules.alternatives.show_current(name) Display the current highest-priority alternative for a given alternatives link
salt '*' alternatives.show_current editor
salt.modules.alternatives.show_link(name) Display master link for the alternative
New in version 2015.8.13,2016.3.4,2016.11.0.
salt '*' alternatives.show_link editor
salt.modules.ansiblegate Ansible Support This module can have an optional minion-level configuration in /etc/salt/minion.d/ as follows: ansible_timeout: 1200
The timeout is how many seconds Salt should wait for any Ansible module to respond.
salt.modules.ansiblegate.call(module, *args, **kwargs) Call an Ansible module by invoking it.
• module -- the name of the module.
• args -- Arguments to pass to the module
• kwargs -- keywords to pass to the module
salt * ansible.call ping data=foobar
salt.modules.ansiblegate.help(module=None, *args) Display help on Ansible standard module.
Parameters module -- The module to get the help
salt * ansible.help ping
salt.modules.ansiblegate.list_(pattern=None) Lists available modules.
salt * ansible.list salt * ansible.list '*win*'  # To get all modules matching 'win' on it's name
salt.modules.ansiblegate.playbooks(playbook, rundir=None, check=False, diff=False, extra_vars=None, flush_cache=False, forks=5, inventory=None, limit=None, list_hosts=False, list_tags=False, list_tasks=False, module_path=None, skip_tags=None, start_at_task=None, syntax_check=False, tags=None, playbook_kwargs=None) Run Ansible Playbooks
• playbook -- Which playbook to run.
• rundir -- Directory to run ansible-playbook in. (Default: None)
• check -- don't make any changes; instead, try to predict some of the changes that may occur (Default: False)
• diff -- when changing (small) files and templates, show the differences in those files; works great with --check (default: False)
• extra_vars -- set additional variables as key=value or YAML/JSON, if filename prepend with @, (default: None)
• flush_cache -- clear the fact cache for every host in inventory (default: False)
• forks -- specify number of parallel processes to use (Default: 5)
• inventory -- specify inventory host path or comma separated host list. (Default: None) (Ansible's default is /etc/ansible/hosts)
• limit -- further limit selected hosts to an additional pattern (Default: None)
• list_hosts -- outputs a list of matching hosts; does not execute anything else (Default: False)
• list_tags -- list all available tags (Default: False)
• list_tasks -- list all tasks that would be executed (Default: False)
• module_path -- prepend colon-separated path(s) to module library. (Default: None)
• skip_tags -- only run plays and tasks whose tags do not match these values (Default: False)
• start_at_task -- start the playbook at the task matching this name (Default: None)
• tags -- only run plays and tasks tagged with these values (Default: None)
Param  syntax_check: perform a syntax check on the playbook, but do not execute it (Default: False)
Returns Playbook return
salt 'ansiblehost'  ansible.playbook playbook=/srv/playbooks/play.yml
salt.modules.apache Support for Apache
NOTE: The functions in here are generic functions designed to work with all implementations of Apache. Debian-specific functions have been moved into deb_apache.py, but will still load under the apache namespace when a Debian-based system is detected.
salt.modules.apache.config(name, config, edit=True) Create VirtualHost configuration files
name   File for the virtual host
config VirtualHost configurations
NOTE: This function is not meant to be used from the command line. Config is meant to be an ordered dict of all of the apache configs.
salt '*' apache.config /etc/httpd/conf.d/ports.conf config="[{'Listen': '22'}]"
salt.modules.apache.directives() Return list of directives together with expected arguments and places where the directive is valid (apachectl -L)
salt '*' apache.directives
salt.modules.apache.fullversion() Return server version (apachectl -V)
salt '*' apache.fullversion
salt.modules.apache.modules() Return list of static and shared modules (apachectl -M)
salt '*' apache.modules
salt.modules.apache.server_status(profile='default') Get Information from the Apache server-status handler
NOTE: The server-status handler is disabled by default.  In order for this function to work it needs to be enabled.  See http://httpd.apache.org/docs/2.2/mod/mod_status.html
The following configuration needs to exists in pillar/grains. Each entry nested in apache.server-status is a profile of a vhost/server.  This would give support for multiple apache servers/vhosts.
apache.server-status: default: url: http://localhost/server-status user: someuser pass: password realm: 'authentication realm for digest passwords' timeout: 5
salt '*' apache.server_status salt '*' apache.server_status other-profile
salt.modules.apache.servermods() Return list of modules compiled into the server (apachectl -l)
salt '*' apache.servermods
salt.modules.apache.signal(signal=None) Signals httpd to start, restart, or stop.
salt '*' apache.signal restart
salt.modules.apache.useradd(pwfile, user, password, opts='') Add HTTP user using the htpasswd command. If the htpasswd file does not exist, it will be created. Valid options that can be passed are:
n  Don't update file; display results on stdout. m  Force MD5 hashing of the password (default). d  Force CRYPT(3) hashing of the password. p  Do not hash the password (plaintext). s  Force SHA1 hashing of the password.
salt '*' apache.useradd /etc/httpd/htpasswd larry badpassword salt '*' apache.useradd /etc/httpd/htpasswd larry badpass opts=ns
salt.modules.apache.userdel(pwfile, user) Delete HTTP user from the specified htpasswd file.
salt '*' apache.userdel /etc/httpd/htpasswd larry
salt.modules.apache.version() Return server version (apachectl -v)
salt '*' apache.version
salt.modules.apache.vhosts() Show the settings as parsed from the config file (currently only shows the virtualhost settings) (apachectl -S).  Because each additional virtual host adds to the execution time, this command may require a long timeout be specified by using -t 10.
salt -t 10 '*' apache.vhosts
salt.modules.apcups Module for apcupsd
salt.modules.apcups.status() Return apcaccess output
salt '*' apcups.status
salt.modules.apcups.status_battery() Return true if running on battery power
salt '*' apcups.status_battery
salt.modules.apcups.status_charge() Return battery charge
salt '*' apcups.status_charge
salt.modules.apcups.status_load() Return load
salt '*' apcups.status_load
salt.modules.apf Support for Advanced Policy Firewall (APF) maintainer Mostafa Hussein <mostafa.hussein91@gmail.com>
depends python-iptables
platform Linux
salt.modules.apf.allow(ip, port=None) Add host (IP/FQDN) to allow_hosts.rules and immediately load new rule into firewall
salt '*' apf.allow 127.0.0.1
salt.modules.apf.deny(ip) Add host (IP/FQDN) to deny_hosts.rules and immediately load new rule into firewall
salt '*' apf.deny 1.2.3.4
salt.modules.apf.disable() Stop (flush) all firewall rules
salt '*' apf.disable
salt.modules.apf.enable() Load all firewall rules
salt '*' apf.enable
salt.modules.apf.refresh() Refresh & resolve dns names in trust rules
salt '*' apf.refresh
salt.modules.apf.reload() Stop (flush) & reload firewall rules
salt '*' apf.reload
salt.modules.apf.remove(ip) Remove host from [glob]*_hosts.rules and immediately remove rule from firewall
salt '*' apf.remove 1.2.3.4
salt.modules.apf.running() Check apf status
salt '*' apf.running
salt.modules.apkpkg Support for apk
IMPORTANT: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to 'pkg.install' is not available), see here.
salt.modules.apkpkg.file_dict(*packages, **kwargs) List the files that belong to a package, grouped by package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended).
salt '*' pkg.file_list httpd salt '*' pkg.file_list httpd postfix salt '*' pkg.file_list
salt.modules.apkpkg.file_list(*packages, **kwargs) List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended).
salt.modules.apkpkg.install(name=None, refresh=False, pkgs=None, sources=None, **kwargs) Install the passed package, add refresh=True to update the apk database.
name   The name of the package to be installed. Note that this parameter is ignored if either "pkgs" or "sources" is passed. 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.
salt '*' pkg.install <package name>
refresh Whether or not to refresh the package database before installing.
pkgs   A list of packages to install from a software repository. Must be passed as a python list.
salt '*' pkg.install pkgs='["foo", "bar"]'
sources A list of IPK packages to install. Must be passed as a list of dicts, with the keys being package names, and the values being the source URI or local path to the package. Dependencies are automatically resolved and marked as auto-installed.
salt '*' pkg.install sources='[{"foo": "salt://foo.deb"},{"bar": "salt://bar.deb"}]'
install_recommends Whether to install the packages marked as recommended. Default is True.
Returns a dict containing the new package names and versions:
salt.modules.apkpkg.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.
If the latest version of a given package is already installed, an empty string will be returned for that package.
salt '*' pkg.latest_version <package name> salt '*' pkg.latest_version <package name> salt '*' pkg.latest_version <package1> <package2> <package3> ...
salt.modules.apkpkg.list_pkgs(versions_as_list=False, **kwargs) List the packages currently installed in a dict:
salt '*' pkg.list_pkgs salt '*' pkg.list_pkgs versions_as_list=True
salt.modules.apkpkg.list_upgrades(refresh=True, **kwargs) List all available package upgrades.
salt '*' pkg.list_upgrades
salt.modules.apkpkg.owner(*paths, **kwargs) Return the name of the package that owns the file. Multiple file paths can be passed. Like pkg.version <salt.modules.apk.version, if a single path is passed, a string will be returned, and if multiple paths are passed, a dictionary of file/package name pairs will be returned.
If the file is not owned by a package, or is not present on the minion, then an empty string will be returned for that path.
salt '*' pkg.owns /usr/bin/apachectl salt '*' pkg.owns /usr/bin/apachectl /usr/bin/basename
salt.modules.apkpkg.purge(name=None, pkgs=None, **kwargs) Alias to remove
salt.modules.apkpkg.refresh_db(**kwargs) Updates the package list
• True: Database updated successfully
• False: Problem updating database
salt '*' pkg.refresh_db
salt.modules.apkpkg.remove(name=None, pkgs=None, purge=False, **kwargs) Remove packages using apk del.
name   The name of the package to be deleted.
pkgs   A list of packages to delete. Must be passed as a python list. The name parameter will be ignored if this option is passed.
Returns a dict containing the changes.
salt '*' pkg.remove <package name> salt '*' pkg.remove <package1>,<package2>,<package3> salt '*' pkg.remove pkgs='["foo", "bar"]'
salt.modules.apkpkg.upgrade(name=None, pkgs=None, refresh=True, **kwargs) Upgrades all packages via apk upgrade or a specific package if name or pkgs is specified. Name is ignored if pkgs is specified
salt '*' pkg.upgrade
salt.modules.apkpkg.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 '*' pkg.version <package name> salt '*' pkg.version <package1> <package2> <package3> ...
salt.modules.aptly Aptly Debian repository manager.
salt.modules.aptly.cleanup_db(config_path='/etc/aptly.conf', dry_run=False)
Remove data regarding unreferenced packages and delete files in the package pool that are no longer being used by packages.
Parameters dry_run (bool) -- Report potential changes without making any changes.
Returns A dictionary of the package keys and files that were removed.
salt '*' aptly.cleanup_db
salt.modules.aptly.delete_repo(name, config_path='/etc/aptly.conf', force=False) Remove the repository.
• name (str) -- The name of the repository.
• config_path (str) -- The path to the configuration file for the aptly instance.
• force (bool) -- Whether to remove the repository even if it is used as the source of an existing snapshot.
Returns A boolean representing whether all changes succeeded.
salt '*' aptly.delete_repo name="test-repo"
salt.modules.aptly.get_config(config_path='/etc/aptly.conf') Get the configuration data.
Parameters config_path (str) -- The path to the configuration file for the aptly instance.
Returns A dictionary containing the configuration data.
salt '*' aptly.get_config
salt.modules.aptly.get_repo(name, config_path='/etc/aptly.conf', with_packages=False) Get the details of the repository.
• with_packages (bool) -- Return a list of packages in the repo.
Returns A dictionary containing information about the repository.
salt '*' aptly.get_repo name="test-repo"
salt.modules.aptly.list_mirrors(config_path='/etc/aptly.conf') Get a list of all the mirrors.
Returns A list of the mirror names.
salt '*' aptly.list_mirrors
salt.modules.aptly.list_published(config_path='/etc/aptly.conf') Get a list of all the published repositories.
Returns A list of the published repository names.
salt '*' aptly.list_published
salt.modules.aptly.list_repos(config_path='/etc/aptly.conf', with_packages=False) List all of the repos.
Returns A dictionary of the repositories.
salt '*' aptly.list_repos
salt.modules.aptly.list_snapshots(config_path='/etc/aptly.conf', sort_by_time=False) Get a list of all the snapshots.
• sort_by_time (bool) -- Whether to sort by creation time instead of by name.
Returns A list of the snapshot names.
salt '*' aptly.list_snapshots
salt.modules.aptly.new_repo(name, config_path='/etc/aptly.conf', comment=None, component=None, distribution=None, uploaders_file=None, from_snapshot=None, saltenv='base') Create the new repository.
• comment (str) -- The description of the repository.
• component (str) -- The default component to use when publishing.
• distribution (str) -- The default distribution to use when publishing.
• uploaders_file (str) -- The repository upload restrictions config.
• from_snapshot (str) -- The snapshot to initialize the repository contents from.
• saltenv (str) -- The environment the file resides in.
salt '*' aptly.new_repo name="test-repo" comment="Test main repo" component="main" distribution="trusty"
salt.modules.aptly.set_repo(name, config_path='/etc/aptly.conf', comment=None, component=None, distribution=None, uploaders_file=None, saltenv='base') Configure the repository settings.
salt '*' aptly.set_repo name="test-repo" comment="Test universe repo" component="universe" distribution="xenial"
salt.modules.aptpkg Support for APT (Advanced Packaging Tool)
For repository management, the python-apt package must be installed.
class salt.modules.aptpkg.SourceEntry(line, file=None)
repo_line() Return the repo line for the sources file
class salt.modules.aptpkg.SourcesList
add(type, uri, dist, orig_comps, architectures)
remove(source)
salt.modules.aptpkg.add_repo_key(path=None, text=None, keyserver=None, keyid=None, saltenv='base') New in version 2017.7.0.
Add a repo key using apt-key add.
• path (str) -- The path of the key file to import.
• text (str) -- The key data to import, in string form.
• keyserver (str) -- The server to download the repo key specified by the keyid.
• keyid (str) -- The key id of the repo key to add.
• saltenv (str) -- The environment the key file resides in.
Returns A boolean representing whether the repo key was added.
salt '*' pkg.add_repo_key 'salt://apt/sources/test.key'
salt '*' pkg.add_repo_key text="'$KEY1'"
salt '*' pkg.add_repo_key keyserver='keyserver.example' keyid='0000AAAA'
salt.modules.aptpkg.autoremove(list_only=False, purge=False) New in version 2015.5.0.
Remove packages not required by another package using apt-get autoremove.
list_only False Only retrieve the list of packages to be auto-removed, do not actually perform the auto-removal.
purge  False Also remove package config data when autoremoving packages.
salt '*' pkg.autoremove salt '*' pkg.autoremove list_only=True salt '*' pkg.autoremove purge=True
salt.modules.aptpkg.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.
A specific repo can be requested using the fromrepo keyword argument.
cache_valid_time New in version 2016.11.0.
Skip refreshing the package database if refresh has already occurred within <value> seconds
salt '*' pkg.latest_version <package name> salt '*' pkg.latest_version <package name> fromrepo=unstable salt '*' pkg.latest_version <package1> <package2> <package3> ...
salt.modules.aptpkg.del_repo(repo, **kwargs) Delete a repo from the sources.list / sources.list.d
If the .list file is in the sources.list.d directory and the file that the repo exists in does not contain any other repo configuration, the file itself will be deleted.
The repo passed in must be a fully formed repository definition string.
salt '*' pkg.del_repo "myrepo definition"
salt.modules.aptpkg.del_repo_key(name=None, **kwargs) New in version 2015.8.0.
Remove a repo key using apt-key del
name   Repo from which to remove the key. Unnecessary if keyid is passed.
keyid  The KeyID of the GPG key to remove
keyid_ppa False If set to True, the repo's GPG key ID will be looked up from ppa.launchpad.net and removed.
NOTE: Setting this option to True requires that the name param also be passed.
salt '*' pkg.del_repo_key keyid=0123ABCD salt '*' pkg.del_repo_key name='ppa:foo/bar' keyid_ppa=True
salt.modules.aptpkg.expand_repo_def(**kwargs) Take a repository definition and expand it to the full pkg repository dict that can be used for comparison.  This is a helper function to make the Debian/Ubuntu apt sources sane for comparison in the pkgrepo states.
This is designed to be called from pkgrepo states and will have little use being called on the CLI.
salt.modules.aptpkg.file_dict(*packages, **kwargs) List the files that belong to a package, grouped by package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended).
salt '*' pkg.file_dict httpd salt '*' pkg.file_dict httpd postfix salt '*' pkg.file_dict
salt.modules.aptpkg.file_list(*packages, **kwargs) List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended).
salt.modules.aptpkg.get_repo(repo, **kwargs) Display a repo from the sources.list / sources.list.d
The repo passed in needs to be a complete repo entry.
salt '*' pkg.get_repo "myrepo definition"
salt.modules.aptpkg.get_repo_keys() New in version 2017.7.0.
List known repo key details.
Returns A dictionary containing the repo keys.
salt '*' pkg.get_repo_keys
salt.modules.aptpkg.get_selections(pattern=None, state=None) View package state from the dpkg database.
Returns a dict of dicts containing the state, and package names:
{'<host>': {'<state>': ['pkg1', ... ] }, ... }
salt '*' pkg.get_selections salt '*' pkg.get_selections 'python-*' salt '*' pkg.get_selections state=hold salt '*' pkg.get_selections 'openssh*' state=hold
salt.modules.aptpkg.hold(name=None, pkgs=None, sources=None, **kwargs) New in version 2014.7.0.
Set package in 'hold' state, meaning it will not be upgraded.
name   The name of the package, e.g., 'tmux'
salt '*' pkg.hold <package name>
pkgs   A list of packages to hold. Must be passed as a python list.
salt '*' pkg.hold pkgs='["foo", "bar"]'
salt.modules.aptpkg.info_installed(*names, **kwargs) Return the information of the named package(s) installed on the system.
names  The names of the packages for which to return information.
failhard Whether to throw an exception if none of the packages are installed.  Defaults to True.
New in version 2016.11.3.
salt '*' pkg.info_installed <package1> salt '*' pkg.info_installed <package1> <package2> <package3> ... salt '*' pkg.info_installed <package1> failhard=false
salt.modules.aptpkg.install(name=None, refresh=False, fromrepo=None, skip_verify=False, debconf=None, pkgs=None, sources=None, reinstall=False, downloadonly=False, ignore_epoch=False, **kwargs) Changed in version 2015.8.12,2016.3.3,2016.11.0: On minions running systemd>=205, 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 any apt-get/dpkg commands spawned by Salt when the salt-minion service is restarted. (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.scope, with a value of False (no quotes).
Install the passed package, add refresh=True to update the dpkg database.
32-bit packages can be installed on 64-bit systems by appending the architecture designation (:i386, etc.) to the end of the package name.
fromrepo Specify a package repository to install from (e.g., apt-get -t unstable install somepackage)
skip_verify Skip the GPG verification check (e.g., --allow-unauthenticated, or --force-bad-verify for install from package file).
debconf Provide the path to a debconf answers file, processed before installation.
version Install a specific version of the package, e.g. 1.2.3~0ubuntu0. Ignored if "pkgs" or "sources" is passed.
Changed in version 2018.3.0: version can now contain comparison operators (e.g. >1.2.3, <=2.0, etc.)
reinstall False Specifying reinstall=True will use apt-get install --reinstall rather than simply apt-get install for requested packages that are already installed.
If a version is specified with the requested package, then apt-get install --reinstall will only be used if the installed version matches the requested version.
ignore_epoch False Only used when the version of a package is specified using a comparison operator (e.g. >4.1). If set to True, then the epoch will be ignored when comparing the currently-installed version to the desired version.
salt '*' pkg.install pkgs='["foo", "bar"]' salt '*' pkg.install pkgs='["foo", {"bar": "1.2.3-0ubuntu0"}]'
sources A list of DEB packages to install. Must be passed as a list of dicts, with the keys being package names, and the values being the source URI or local path to the package. Dependencies are automatically resolved and marked as auto-installed.
Changed in version 2014.7.0.
force_yes Passes --force-yes to the apt-get command.  Don't use this unless you know what you're doing.
New in version 0.17.4.
only_upgrade Only upgrade the packages, if they are already installed. Default is False.
force_conf_new Always install the new version of any configuration files.
salt.modules.aptpkg.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.aptpkg.list_downloaded(root=None, **kwargs) New in version 3000?.
List prefetched packages downloaded by apt in the local disk.
root   operate on a different root directory.
salt '*' pkg.list_downloaded
salt.modules.aptpkg.list_pkgs(versions_as_list=False, removed=False, purge_desired=False, **kwargs) List the packages currently installed in a dict:
removed If True, then only packages which have been removed (but not purged) will be returned.
purge_desired If True, then only packages which have been marked to be purged, but can't be purged due to their status as dependencies for other installed packages, will be returned. Note that these packages will appear in installed
Changed in version 2014.1.1: Packages in this state now correctly show up in the output of this function.
salt.modules.aptpkg.list_repo_pkgs(*args, **kwargs) New in version 2017.7.0.
Returns all available packages. Optionally, package names (and name globs) can be passed and the results will be filtered to packages matching those names.
This function can be helpful in discovering the version or repo to specify in a pkg.installed state.
The return data will be a dictionary mapping package names to a list of version numbers, ordered from newest to oldest. For example:
{ 'bash': ['4.3-14ubuntu1.1', '4.3-14ubuntu1'], 'nginx': ['1.10.0-0ubuntu0.16.04.4', '1.9.15-0ubuntu1'] }
salt '*' pkg.list_repo_pkgs salt '*' pkg.list_repo_pkgs foo bar baz
salt.modules.aptpkg.list_repos(**kwargs) Lists all repos in the sources.list (and sources.lists.d) files
salt '*' pkg.list_repos salt '*' pkg.list_repos disabled=True
salt.modules.aptpkg.list_upgrades(refresh=True, dist_upgrade=True, **kwargs) List all available package upgrades.
refresh Whether to refresh the package database before listing upgrades.  Default: True.
dist_upgrade Whether to list the upgrades using dist-upgrade vs upgrade. Default is to use dist-upgrade.
salt.modules.aptpkg.mod_repo(repo, saltenv='base', **kwargs) Modify one or more values for a repo.  If the repo does not exist, it will be created, so long as the definition is well formed.  For Ubuntu the ppa:<project>/repo format is acceptable. ppa: format can only be used to create a new repository.
The following options are available to modify a repo definition:
architectures A comma-separated list of supported architectures, e.g. amd64 If this option is not set, all architectures (configured in the system) will be used.
comps  A comma separated list of components for the repo, e.g. main
file   A file name to be used
keyserver Keyserver to get gpg key from
keyid  Key ID or a list of key IDs to load with the keyserver argument
key_url URL to a GPG key to add to the APT GPG keyring
key_text GPG key in string form to add to the APT GPG keyring
consolidate False If True, will attempt to de-duplicate and consolidate sources
comments Sometimes you want to supply additional information, but not as enabled configuration. All comments provided here will be joined into a single string and appended to the repo configuration with a comment marker (#) before it.
New in version 2015.8.9.
refresh True Enable or disable (True or False) refreshing of the apt package database. The previous refresh_db argument was deprecated in favor of refresh`. The refresh_db argument will still continue to work to ensure backwards compatibility, but please change to using the preferred refresh.
NOTE: Due to the way keys are stored for APT, there is a known issue where the key won't be updated unless another change is made at the same time. Keys should be properly added on initial configuration.
salt '*' pkg.mod_repo 'myrepo definition' uri=http://new/uri salt '*' pkg.mod_repo 'myrepo definition' comps=main,universe
salt.modules.aptpkg.normalize_name(name) Strips the architecture from the specified package name, if necessary.
salt '*' pkg.normalize_name zsh:amd64
salt.modules.aptpkg.owner(*paths, **kwargs) New in version 2014.7.0.
Return the name of the package that owns the file. Multiple file paths can be passed. Like pkg.version, if a single path is passed, a string will be returned, and if multiple paths are passed, a dictionary of file/package name pairs will be returned.
salt '*' pkg.owner /usr/bin/apachectl salt '*' pkg.owner /usr/bin/apachectl /usr/bin/basename
salt.modules.aptpkg.parse_arch(name) Parse name and architecture from the specified package name.
salt '*' pkg.parse_arch zsh:amd64
salt.modules.aptpkg.purge(name=None, pkgs=None, **kwargs) Changed in version 2015.8.12,2016.3.3,2016.11.0: On minions running systemd>=205, 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 any apt-get/dpkg commands spawned by Salt when the salt-minion service is restarted. (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.scope, with a value of False (no quotes).
Remove packages via apt-get purge along with all configuration files.
salt '*' pkg.purge <package name> salt '*' pkg.purge <package1>,<package2>,<package3> salt '*' pkg.purge pkgs='["foo", "bar"]'
salt.modules.aptpkg.refresh_db(cache_valid_time=0, failhard=False, **kwargs) Updates the APT database to latest packages based upon repositories
Returns a dict, with the keys being package databases and the values being the result of the update attempt. Values can be one of the following:
• None: Database already up-to-date
failhard If False, return results of Err lines as False for the package database that encountered the error.  If True, raise an error with a list of the package databases that encountered errors.
salt.modules.aptpkg.remove(name=None, pkgs=None, **kwargs) Changed in version 2015.8.12,2016.3.3,2016.11.0: On minions running systemd>=205, 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 any apt-get/dpkg commands spawned by Salt when the salt-minion service is restarted. (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.scope, with a value of False (no quotes).
Remove packages using apt-get remove.
salt.modules.aptpkg.services_need_restart(**kwargs) New in version 3003.
List services that use files which have been changed by the package manager. It might be needed to restart them.
Requires checkrestart from the debian-goodies package.
salt '*' pkg.services_need_restart
salt.modules.aptpkg.set_selections(path=None, selection=None, clear=False, saltenv='base') Change package state in the dpkg database.
The state can be any one of, documented in dpkg(1):
• install
• deinstall
• purge
This command is commonly used to mark specific packages to be held from being upgraded, that is, to be kept at a certain version. When a state is changed to anything but being held, then it is typically followed by apt-get -u dselect-upgrade.
Note: Be careful with the clear argument, since it will start with setting all packages to deinstall state.
Returns a dict of dicts containing the package names, and the new and old versions:
{'<host>': {'<package>': {'new': '<new-state>', 'old': '<old-state>'} }, ... }
salt '*' pkg.set_selections selection='{"install": ["netcat"]}' salt '*' pkg.set_selections selection='{"hold": ["openssh-server", "openssh-client"]}' salt '*' pkg.set_selections salt://path/to/file salt '*' pkg.set_selections salt://path/to/file clear=True
salt.modules.aptpkg.show(*names, **kwargs) New in version 2019.2.0.
Runs an apt-cache show on the passed package names, and returns the results in a nested dictionary. The top level of the return data will be the package name, with each package name mapping to a dictionary of version numbers to any additional information returned by apt-cache show.
filter An optional comma-separated list (or quoted Python list) of case-insensitive keys on which to filter. This allows one to restrict the information returned for each package to a smaller selection of pertinent items.
refresh False If True, the apt cache will be refreshed first. By default, no refresh is performed.
salt myminion pkg.show gawk salt myminion pkg.show 'nginx-*' salt myminion pkg.show 'nginx-*' filter=description,provides
salt.modules.aptpkg.unhold(name=None, pkgs=None, sources=None, **kwargs) New in version 2014.7.0.
Set package current in 'hold' state to install state, meaning it will be upgraded.
salt '*' pkg.unhold <package name>
pkgs   A list of packages to unhold. Must be passed as a python list.
salt '*' pkg.unhold pkgs='["foo", "bar"]'