neulab/tldr huggingface dataset:
When run in non-global zone, it can report more upgradable packages than pkg update -vn, because pkg update hides packages that require newer version of pkg://solaris/entire (which means that they can be upgraded only from the global zone). If pkg://solaris/entire is found in the list of upgrades, then the global zone should be updated to get all possible updates. Use refresh=True to refresh the package database.
refresh True Runs a full package database refresh before listing. Set to False to disable running the refresh.
In previous versions of Salt, refresh defaulted to False. This was changed to default to True in the 2017.7.0 release to make the behavior more consistent with the other package modules, which all default to True.
salt '*' pkg.list_upgrades salt '*' pkg.list_upgrades refresh=False
salt.modules.solarisipspkg.normalize_name(name, **kwargs) Internal function. Normalizes pkg name to full FMRI before running pkg.install. In case of multiple matches or no match, it returns the name without modifications.
salt '*' pkg.normalize_name vim
salt.modules.solarisipspkg.purge(name, **kwargs) Remove specified package. Accepts full or partial FMRI.
salt '*' pkg.purge <package name>
salt.modules.solarisipspkg.refresh_db(full=False, **kwargs) Updates the remote repos database.
full : False Set to True to force a refresh of the pkg DB from all publishers, regardless of the last refresh time.
salt '*' pkg.refresh_db salt '*' pkg.refresh_db full=True
salt.modules.solarisipspkg.remove(name=None, pkgs=None, **kwargs) Remove specified package. Accepts full or partial FMRI.  In case of multiple match, the command fails and won't modify the OS.
salt '*' pkg.remove <package name> salt '*' pkg.remove tcsh salt '*' pkg.remove pkg://solaris/shell/tcsh salt '*' pkg.remove pkgs='["foo", "bar"]'
salt.modules.solarisipspkg.search(name, versions_as_list=False, **kwargs) Searches the repository for given pkg name.  The name can be full or partial FMRI. All matches are printed. Globs are also supported.
salt '*' pkg.search bash
salt.modules.solarisipspkg.upgrade(refresh=False, **kwargs) Upgrade all packages to the latest possible version.  When run in global zone, it updates also all non-global zones.  In non-global zones upgrade is limited by dependency constrains linked to the version of pkg://solaris/entire.
When there is a failure, an explanation is also included in the error message, based on the return code of the pkg update command.
salt.modules.solarisipspkg.upgrade_available(name, **kwargs) Check if there is an upgrade available for a certain package Accepts full or partial FMRI. Returns all matches found.
salt '*' pkg.upgrade_available apache-22
salt.modules.solarisipspkg.version(*names, **kwargs) Common interface for obtaining the version of installed packages. Accepts full or partial FMRI. If called using pkg_resource, full FMRI is required.  Partial FMRI is returned if the package is not installed.
salt '*' pkg.version vim salt '*' pkg.version foo bar baz salt '*' pkg_resource.version pkg://solaris/entire
salt.modules.solarispkg Package support for Solaris
salt.modules.solarispkg.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.
NOTE: As package repositories are not presently supported for Solaris pkgadd, this function will always return an empty string for a given package.
salt.modules.solarispkg.install(name=None, sources=None, saltenv='base', **kwargs) Install the passed package. Can install packages from the following sources:
• Locally (package already exists on the minion
• HTTP/HTTPS server
• FTP server
• Salt master
# Installing a data stream pkg that already exists on the minion
salt '*' pkg.install sources='[{"<pkg name>": "/dir/on/minion/<pkg filename>"}]' salt '*' pkg.install sources='[{"SMClgcc346": "/var/spool/pkg/gcc-3.4.6-sol10-sparc-local.pkg"}]'
# Installing a data stream pkg that exists on the salt master
salt '*' pkg.install sources='[{"<pkg name>": "salt://pkgs/<pkg filename>"}]' salt '*' pkg.install sources='[{"SMClgcc346": "salt://pkgs/gcc-3.4.6-sol10-sparc-local.pkg"}]'
# Installing a data stream pkg that exists on a HTTP server salt '*' pkg.install sources='[{"<pkg name>": "http://packages.server.com/<pkg filename>"}]' salt '*' pkg.install sources='[{"SMClgcc346": "http://packages.server.com/gcc-3.4.6-sol10-sparc-local.pkg"}]'
If working with solaris zones and you want to install a package only in the global zone you can pass 'current_zone_only=True' to salt to have the package only installed in the global zone. (Behind the scenes this is passing '-G' to the pkgadd command.) Solaris default when installing a package in the global zone is to install it in all zones. This overrides that and installs the package only in the global.
# Installing a data stream package only in the global zone: salt 'global_zone' pkg.install sources='[{"SMClgcc346": "/var/spool/pkg/gcc-3.4.6-sol10-sparc-local.pkg"}]' current_zone_only=True
By default salt automatically provides an adminfile, to automate package installation, with these options set:
email= instance=quit partial=nocheck runlevel=nocheck idepend=nocheck rdepend=nocheck space=nocheck setuid=nocheck conflict=nocheck action=nocheck basedir=default
You can override any of these options in two ways. First you can optionally pass any of the options as a kwarg to the module/state to override the default value or you can optionally pass the 'admin_source' option providing your own adminfile to the minions.
Note: You can find all of the possible options to provide to the adminfile by reading the admin man page:
man -s 4 admin
# Overriding the 'instance' adminfile option when calling the module directly salt '*' pkg.install sources='[{"<pkg name>": "salt://pkgs/<pkg filename>"}]' instance="overwrite"
# Overriding the 'instance' adminfile option when used in a state
SMClgcc346: pkg.installed: - sources: - SMClgcc346: salt://srv/salt/pkgs/gcc-3.4.6-sol10-sparc-local.pkg - instance: overwrite
NOTE: The ID declaration is ignored, as the package name is read from the sources parameter.
# Providing your own adminfile when calling the module directly
salt '*' pkg.install sources='[{"<pkg name>": "salt://pkgs/<pkg filename>"}]' admin_source='salt://pkgs/<adminfile filename>'
# Providing your own adminfile when using states
<pkg name>: pkg.installed: - sources: - <pkg name>: salt://pkgs/<pkg filename> - admin_source: salt://pkgs/<adminfile filename>
salt.modules.solarispkg.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.solarispkg.list_pkgs(versions_as_list=False, **kwargs) List the packages currently installed as a dict:
salt.modules.solarispkg.purge(name=None, pkgs=None, **kwargs) Package purges are not supported, this function is identical to remove().
name   The name of the package to be deleted
salt.modules.solarispkg.remove(name=None, pkgs=None, saltenv='base', **kwargs) Remove packages with pkgrm
By default salt automatically provides an adminfile, to automate package removal, with these options set:
salt '*' pkg.remove <package name> salt '*' pkg.remove SUNWgit salt '*' pkg.remove <package1>,<package2>,<package3> salt '*' pkg.remove pkgs='["foo", "bar"]'
salt.modules.solarispkg.upgrade_available(name, **kwargs) Check whether or not an upgrade is available for a given package
salt.modules.solarispkg.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.solr Apache Solr Salt Module
Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011
This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave.  However if you want to use the signal function the minion must reside on the physical solr host.
This module supports multi-core and standard setups.  Certain methods are master/slave specific.  Make sure you set the solr.type. If you have questions or want a feature request please ask.
Coming Features in 0.3 1. Add command for checking for replication failures on slaves
2. Improve match_index_versions since it's pointless on busy solr masters
3. Add additional local fs checks for backups to make sure they succeeded
Override these in the minion config solr.cores A list of core names e.g. ['core1','core2'].  An empty list indicates non-multicore setup.
solr.baseurl The root level URL to access solr via HTTP
solr.request_timeout The number of seconds before timing out an HTTP/HTTPS/FTP request. If nothing is specified then the python global timeout setting is used.
solr.type Possible values are 'master' or 'slave'
solr.backup_path The path to store your backups. If you are using cores and you can specify to append the core name to the path in the backup method.
solr.num_backups For versions of solr >= 3.5. Indicates the number of backups to keep. This option is ignored if your version is less.
solr.init_script The full path to your init script with start/stop options
solr.dih.options A list of options to pass to the DIH.
Required Options for DIH clean  False Clear the index before importing
commit True Commit the documents to the index upon completion
optimize True Optimize the index after commit is complete
verbose True Get verbose output
salt.modules.solr.abort_import(handler, host=None, core_name=None, verbose=False) MASTER ONLY Aborts an existing import command to the specified handler.  This command can only be run if the minion is configured with solr.type=master
handler str The name of the data import handler.
host   str (None) The solr host to query. __opts__['host'] is default.
core   str (None) The core the handler belongs to.
verbose boolean (False) Run the command with verbose output.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
salt '*' solr.abort_import dataimport None music {'clean':True}
salt.modules.solr.backup(host=None, core_name=None, append_core_to_path=False) Tell solr make a backup.  This method can be mis-leading since it uses the backup API.  If an error happens during the backup you are not notified.  The status: 'OK' in the response simply means that solr received the request successfully.
core_name str (None) The name of the solr core if using cores. Leave this blank if you are not using cores or if you want to check all cores.
append_core_to_path boolean (False) If True add the name of the core to the backup path. Assumes that minion backup path is not None.
salt '*' solr.backup music
salt.modules.solr.core_status(host=None, core_name=None) MULTI-CORE HOSTS ONLY Get the status for a given core or all cores if no core is specified
core_name str The name of the core to reload
salt '*' solr.core_status None music
salt.modules.solr.delta_import(handler, host=None, core_name=None, options=None, extra=None) Submits an import command to the specified handler using specified options.  This command can only be run if the minion is configured with solr.type=master
options dict (__opts__) A list of options such as clean, optimize commit, verbose, and pause_replication. leave blank to use __opts__ defaults. options will be merged with __opts__
extra  dict ([]) Extra name value pairs to pass to the handler. e.g. ["name=value"]
salt '*' solr.delta_import dataimport None music {'clean':True}
salt.modules.solr.full_import(handler, host=None, core_name=None, options=None, extra=None) MASTER ONLY Submits an import command to the specified handler using specified options.  This command can only be run if the minion is configured with solr.type=master
salt '*' solr.full_import dataimport None music {'clean':True}
salt.modules.solr.import_status(handler, host=None, core_name=None, verbose=False) Submits an import command to the specified handler using specified options.  This command can only be run if the minion is configured with solr.type: 'master'
verbose boolean (False) Specifies verbose output
salt '*' solr.import_status dataimport None music False
salt.modules.solr.is_replication_enabled(host=None, core_name=None) SLAVE CALL Check for errors, and determine if a slave is replicating or not.
salt '*' solr.is_replication_enabled music
salt.modules.solr.lucene_version(core_name=None) Gets the lucene version that solr is using. If you are running a multi-core setup you should specify a core name since all the cores run under the same servlet container, they will all have the same version.
Return: dict<str,obj>:
salt '*' solr.lucene_version
salt.modules.solr.match_index_versions(host=None, core_name=None) SLAVE CALL Verifies that the master and the slave versions are in sync by comparing the index version. If you are constantly pushing updates the index the master and slave versions will seldom match. A solution to this is pause indexing every so often to allow the slave to replicate and then call this method before allowing indexing to resume.
salt '*' solr.match_index_versions music
salt.modules.solr.optimize(host=None, core_name=None) Search queries fast, but it is a very expensive operation. The ideal process is to run this with a master/slave configuration. Then you can optimize the master, and push the optimized index to the slaves.  If you are running a single solr instance, or if you are going to run this on a slave be aware than search performance will be horrible while this command is being run. Additionally it can take a LONG time to run and your HTTP request may timeout. If that happens adjust your timeout settings.
salt '*' solr.optimize music
salt.modules.solr.ping(host=None, core_name=None) Does a health check on solr, makes sure solr can talk to the indexes.
salt '*' solr.ping music
salt.modules.solr.reload_core(host=None, core_name=None) MULTI-CORE HOSTS ONLY Load a new core from the same configuration as an existing registered core.  While the "new" core is initializing, the "old" one will continue to accept requests. Once it has finished, all new request will go to the "new" core, and the "old" core will be unloaded.
salt '*' solr.reload_core None music
Return data is in the following format:
{'success':bool, 'data':dict, 'errors':list, 'warnings':list}
salt.modules.solr.reload_import_config(handler, host=None, core_name=None, verbose=False) MASTER ONLY re-loads the handler config XML file.  This command can only be run if the minion is a 'master' type
salt '*' solr.reload_import_config dataimport None music {'clean':True}
salt.modules.solr.replication_details(host=None, core_name=None) Get the full replication details.
salt '*' solr.replication_details music
salt.modules.solr.set_is_polling(polling, host=None, core_name=None) SLAVE CALL Prevent the slaves from polling the master for updates.
polling boolean True will enable polling. False will disable it.
salt '*' solr.set_is_polling False
salt.modules.solr.set_replication_enabled(status, host=None, core_name=None) MASTER ONLY Sets the master to ignore poll requests from the slaves. Useful when you don't want the slaves replicating during indexing or when clearing the index.
status boolean Sets the replication status to the specified state.
core_name str (None) The name of the solr core if using cores. Leave this blank if you are not using cores or if you want to set the status on all cores.
salt '*' solr.set_replication_enabled false, None, music
salt.modules.solr.signal(signal=None) Signals Apache Solr to start, stop, or restart. Obviously this is only going to work if the minion resides on the solr host. Additionally Solr doesn't ship with an init script so one must be created.
signal str (None) The command to pass to the apache solr init valid values are 'start', 'stop', and 'restart'
salt '*' solr.signal restart
salt.modules.solr.version(core_name=None) Gets the solr version for the core specified.  You should specify a core here as all the cores will run under the same servlet container and so will all have the same version.
salt '*' solr.version
salt.modules.solrcloud Module for solrcloud configuration
For now, module is limited to http-exposed API. It doesn't implement config upload via Solr zkCli
salt.modules.solrcloud.BOOL_PROPS_LIST = ['transient', 'loadOnStartup'] Collections options type definition Reference: https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api1
salt.modules.solrcloud.DICT_OPTIONS_LIST = ['properties'] Collection unmodifiable options Reference: https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-modifycoll
salt.modules.solrcloud.alias_exists(alias_name, **kwargs) Check alias existence
Additional parameters (kwargs) may be passed, they will be proxied to http.query
salt '*' solrcloud.alias_exists my_alias
salt.modules.solrcloud.alias_get_collections(alias_name, **kwargs) Get collection list for an alias
salt '*' solrcloud.alias_get my_alias
salt.modules.solrcloud.alias_set_collections(alias_name, collections=None, **kwargs) Define an alias
salt '*' solrcloud.alias_set my_alias collections=[collection1, colletion2]
salt.modules.solrcloud.cluster_status(**kwargs) Get cluster status
salt '*' solrcloud.cluster_status
salt.modules.solrcloud.collection_backup(collection_name, location, backup_name=None, **kwargs) Create a backup for a collection.
salt '*' solrcloud.core_backup collection_name /mnt/nfs_backup
salt.modules.solrcloud.collection_backup_all(location, backup_name=None, **kwargs) Create a backup for all collection present on the server.
salt '*' solrcloud.core_backup /mnt/nfs_backup
salt.modules.solrcloud.collection_check_options(options) Check collections options
salt '*' solrcloud.collection_check_options '{"replicationFactor":4}'
salt.modules.solrcloud.collection_create(collection_name, options=None, **kwargs) Create a collection,
salt '*' solrcloud.collection_create collection_name
Collection creation options may be passed using the "options" parameter.  Do not include option "name" since it already specified by the mandatory parameter "collection_name"
salt '*' solrcloud.collection_create collection_name options={"replicationFactor":2, "numShards":3}
Cores options may be passed using the "properties" key in options. Do not include property "name"
salt '*' solrcloud.collection_create collection_name options={"replicationFactor":2, "numShards":3,             "properties":{"dataDir":"/srv/solr/hugePartitionSollection"}}
salt.modules.solrcloud.collection_creation_options() Get collection option list that can only be defined at creation
salt '*' solrcloud.collection_creation_options
salt.modules.solrcloud.collection_exists(collection_name, **kwargs) Check if a collection exists
salt '*' solrcloud.collection_exists collection_name
salt.modules.solrcloud.collection_get_options(collection_name, **kwargs) Get collection options
salt '*' solrcloud.collection_get_options collection_name
salt.modules.solrcloud.collection_list(**kwargs) List all collections
salt '*' solrcloud.collection_list
salt.modules.solrcloud.collection_reload(collection, **kwargs) Check if a collection exists
salt '*' solrcloud.collection_reload collection_name
salt.modules.solrcloud.collection_set_options(collection_name, options, **kwargs) Change collection options
Note that not every parameter can be changed after collection creation
salt '*' solrcloud.collection_set_options collection_name options={"replicationFactor":4}
salt.modules.solrcloud.log = <SaltLoggingClass salt.modules.solrcloud (GARBAGE)> Core properties type definition.  Reference: https://cwiki.apache.org/confluence/display/solr/Defining+core.properties
salt.modules.splunk Module for interop with the Splunk API
• splunk-sdk python module
configuration Configure this module by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The module will use the 'splunk' key by default, if defined.
splunk: username: alice password: abc123 host: example.splunkcloud.com port: 8080
salt.modules.splunk.create_user(email, profile='splunk', **kwargs) create a splunk user by name/email
salt myminion splunk.create_user user@example.com roles=['user'] realname="Test User" name=testuser
salt.modules.splunk.delete_user(email, profile='splunk') Delete a splunk user by email
salt myminion splunk_user.delete 'user@example.com'
salt.modules.splunk.get_user(email, profile='splunk', **kwargs) Get a splunk user by name/email
salt myminion splunk.get_user 'user@example.com' user_details=false salt myminion splunk.get_user 'user@example.com' user_details=true
salt.modules.splunk.list_users(profile='splunk') List all users in the splunk DB
salt myminion splunk.list_users
salt.modules.splunk.update_user(email, profile='splunk', **kwargs) Create a splunk user by email
salt myminion splunk.update_user example@domain.com roles=['user'] realname="Test User"
salt.modules.splunk_search Module for interop with the Splunk API
salt.modules.splunk_search.create(name, profile='splunk', **kwargs) Create a splunk search
CLI Example: splunk_search.create 'my search name' search='error msg'
salt.modules.splunk_search.delete(name, profile='splunk') Delete a splunk search
CLI Example: splunk_search.delete 'my search name'
salt.modules.splunk_search.get(name, profile='splunk') Get a splunk search
CLI Example: splunk_search.get 'my search name'
salt.modules.splunk_search.list_(profile='splunk') List splunk searches (names only)
CLI Example: splunk_search.list
salt.modules.splunk_search.list_all(prefix=None, app=None, owner=None, description_contains=None, name_not_contains=None, profile='splunk') Get all splunk search details. Produces results that can be used to create an sls file.
if app or owner are specified, results will be limited to matching saved searches.
if description_contains is specified, results will be limited to those where "description_contains in description" is true if name_not_contains is specified, results will be limited to those where "name_not_contains not in name" is true.
If prefix parameter is given, alarm names in the output will be prepended with the prefix; alarms that have the prefix will be skipped. This can be used to convert existing alarms to be managed by salt, as follows:
Make a backup of all existing searches $ salt-call splunk_search.list_all --out=txt | sed "s/local: //" > legacy_searches.sls
Get all searches with new prefixed names $ salt-call splunk_search.list_all "prefix=**MANAGED BY SALT** " --out=txt | sed "s/local: //" > managed_searches.sls
Insert the managed searches into splunk $ salt-call state.sls managed_searches.sls
4. Manually verify that the new searches look right
5. Delete the original searches $ sed s/present/absent/ legacy_searches.sls > remove_legacy_searches.sls $ salt-call state.sls remove_legacy_searches.sls
6. Get all searches again, verify no changes $ salt-call splunk_search.list_all --out=txt | sed "s/local: //" > final_searches.sls $ diff final_searches.sls managed_searches.sls
salt.modules.splunk_search.update(name, profile='splunk', **kwargs) Update a splunk search
CLI Example: splunk_search.update 'my search name' sharing=app
salt.modules.sqlite3 Support for SQLite3
salt.modules.sqlite3.fetch(db=None, sql=None) Retrieve data from an sqlite3 db (returns all rows, be careful!)
salt '*' sqlite3.fetch /root/test.db 'SELECT * FROM test;'
salt.modules.sqlite3.indexes(db=None) Show all indices in the database, for people with poor spelling skills
salt '*' sqlite3.indexes /root/test.db
salt.modules.sqlite3.indices(db=None) Show all indices in the database
salt '*' sqlite3.indices /root/test.db
salt.modules.sqlite3.modify(db=None, sql=None) Issue an SQL query to sqlite3 (with no return data), usually used to modify the database in some way (insert, delete, create, etc)
salt '*' sqlite3.modify /root/test.db 'CREATE TABLE test(id INT, testdata TEXT);'
salt.modules.sqlite3.sqlite_version() Return version of sqlite
salt '*' sqlite3.sqlite_version
salt.modules.sqlite3.tables(db=None) Show all tables in the database
salt '*' sqlite3.tables /root/test.db
salt.modules.sqlite3.version() Return version of pysqlite
salt '*' sqlite3.version
salt.modules.ssh Manage client ssh components
NOTE: This module requires the use of MD5 hashing. Certain security audits may not permit the use of MD5. For those cases, this module should be disabled or removed.
salt.modules.ssh.auth_keys(user=None, config='.ssh/authorized_keys', fingerprint_hash_type=None) Return the authorized keys for users
salt '*' ssh.auth_keys salt '*' ssh.auth_keys root salt '*' ssh.auth_keys user=root salt '*' ssh.auth_keys user="[user1, user2]"
salt.modules.ssh.check_key(user, key, enc, comment, options, config='.ssh/authorized_keys', cache_keys=None, fingerprint_hash_type=None) Check to see if a key needs updating, returns "update", "add" or "exists"
salt '*' ssh.check_key <user> <key> <enc> <comment> <options>
salt.modules.ssh.check_key_file(user, source, config='.ssh/authorized_keys', saltenv='base', fingerprint_hash_type=None) Check a keyfile from a source destination against the local keys and return the keys to change
salt '*' ssh.check_key_file root salt://ssh/keyfile
salt.modules.ssh.check_known_host(user=None, hostname=None, key=None, fingerprint=None, config=None, port=None, fingerprint_hash_type=None) Check the record in known_hosts file, either by its value or by fingerprint (it's enough to set up either key or fingerprint, you don't need to set up both).
If provided key or fingerprint doesn't match with stored value, return "update", if no value is found for a given host, return "add", otherwise return "exists".
If neither key, nor fingerprint is defined, then additional validation is not performed.
salt '*' ssh.check_known_host <user> <hostname> key='AAAA...FAaQ=='
salt.modules.ssh.get_known_host_entries(user, hostname, config=None, port=None, fingerprint_hash_type=None) New in version 2018.3.0.
Return information about known host entries from the configfile, if any.  If there are no entries for a matching hostname, return None.
salt '*' ssh.get_known_host_entries <user> <hostname>
salt.modules.ssh.hash_known_hosts(user=None, config=None) Hash all the hostnames in the known hosts file.
user   hash known hosts of this user
config path to known hosts file: can be absolute or relative to user's home directory
salt '*' ssh.hash_known_hosts
salt.modules.ssh.host_keys(keydir=None, private=True, certs=True) Return the minion's host keys
salt '*' ssh.host_keys salt '*' ssh.host_keys keydir=/etc/ssh salt '*' ssh.host_keys keydir=/etc/ssh private=False salt '*' ssh.host_keys keydir=/etc/ssh certs=False
salt.modules.ssh.key_is_encrypted(key) New in version 2015.8.7.
Function to determine whether or not a private key is encrypted with a passphrase.
Checks key for a Proc-Type header with ENCRYPTED in the value. If found, returns True, otherwise returns False.
salt '*' ssh.key_is_encrypted /root/id_rsa
salt.modules.ssh.recv_known_host_entries(hostname, enc=None, port=None, hash_known_hosts=True, timeout=5, fingerprint_hash_type=None) New in version 2018.3.0.
Retrieve information about host public keys from remote server
hostname The name of the remote host (e.g. "github.com")
enc    Defines what type of key is being used, can be ed25519, ecdsa ssh-rsa or ssh-dss
port   Optional parameter, denoting the port of the remote host on which an SSH daemon is running. By default the port 22 is used.
hash_known_hosts True Hash all hostnames and addresses in the known hosts file.
timeout int Set the timeout for connection attempts.  If timeout seconds have elapsed since a connection was initiated to a host or since the last time anything was read from that host, then the connection is closed and the host in question considered unavailable.  Default is 5 seconds.
fingerprint_hash_type The fingerprint hash type that the public key fingerprints were originally hashed with. This defaults to sha256 if not specified.
Changed in version 2017.7.0: default changed from md5 to sha256
salt '*' ssh.recv_known_host_entries <hostname> enc=<enc> port=<port>
salt.modules.ssh.rm_auth_key(user, key, config='.ssh/authorized_keys', fingerprint_hash_type=None) Remove an authorized key from the specified user's authorized key file
salt '*' ssh.rm_auth_key <user> <key>
salt.modules.ssh.rm_auth_key_from_file(user, source, config='.ssh/authorized_keys', saltenv='base', fingerprint_hash_type=None) Remove an authorized key from the specified user's authorized key file, using a file as source
salt '*' ssh.rm_auth_key_from_file <user> salt://ssh_keys/<user>.id_rsa.pub
salt.modules.ssh.rm_known_host(user=None, hostname=None, config=None, port=None) Remove all keys belonging to hostname from a known_hosts file.
salt '*' ssh.rm_known_host <user> <hostname>
salt.modules.ssh.set_auth_key(user, key, enc='ssh-rsa', comment='', options=None, config='.ssh/authorized_keys', cache_keys=None, fingerprint_hash_type=None) Add a key to the authorized_keys file. The "key" parameter must only be the string of text that is the encoded key. If the key begins with "ssh-rsa" or ends with user@host, remove those from the key before passing it to this function.
salt '*' ssh.set_auth_key <user> '<key>' enc='dsa'
salt.modules.ssh.set_auth_key_from_file(user, source, config='.ssh/authorized_keys', saltenv='base', fingerprint_hash_type=None) Add a key to the authorized_keys file, using a file as the source.
salt '*' ssh.set_auth_key_from_file <user> salt://ssh_keys/<user>.id_rsa.pub
salt.modules.ssh.set_known_host(user=None, hostname=None, fingerprint=None, key=None, port=None, enc=None, config=None, hash_known_hosts=True, timeout=5, fingerprint_hash_type=None) Download SSH public key from remote host "hostname", optionally validate its fingerprint against "fingerprint" variable and save the record in the known_hosts file.
If such a record does already exists in there, do nothing.
user   The user who owns the ssh authorized keys file to modify
fingerprint The fingerprint of the key which must be present in the known_hosts file (optional if key specified)
key    The public key which must be presented in the known_hosts file (optional if fingerprint specified)
port   optional parameter, denoting the port of the remote host, which will be used in case, if the public key will be requested from it. By default the port 22 is used.
config The location of the authorized keys file relative to the user's home directory, defaults to ".ssh/known_hosts". If no user is specified, defaults to "/etc/ssh/ssh_known_hosts". If present, must be an absolute path when a user is not specified.
fingerprint_hash_type The public key fingerprint hash type that the public key fingerprint was originally hashed with. This defaults to sha256 if not specified.
salt '*' ssh.set_known_host <user> fingerprint='xx:xx:..:xx' enc='ssh-rsa' config='.ssh/known_hosts'
salt.modules.ssh.user_keys(user=None, pubfile=None, prvfile=None) Return the user's ssh keys on the minion
salt '*' ssh.user_keys salt '*' ssh.user_keys user=user1 salt '*' ssh.user_keys user=user1 pubfile=/home/user1/.ssh/id_rsa.pub prvfile=/home/user1/.ssh/id_rsa salt '*' ssh.user_keys user=user1 prvfile=False salt '*' ssh.user_keys user="['user1','user2'] pubfile=id_rsa.pub prvfile=id_rsa
As you can see you can tell Salt not to read from the user's private (or public) key file by setting the file path to False. This can be useful to prevent Salt from publishing private data via Salt Mine or others.
salt.modules.ssh_pkg Service support for the REST example
salt.modules.ssh_pkg.install(name=None, refresh=False, fromrepo=None, pkgs=None, sources=None, **kwargs)
salt.modules.ssh_pkg.list_pkgs(versions_as_list=False, **kwargs)
salt.modules.ssh_pkg.remove(name=None, pkgs=None, **kwargs)
salt.modules.ssh_service Provide the service module for the proxy-minion SSH sample .. versionadded:: 2015.8.2
salt.modules.ssh_service.enabled(name, sig=None) Only the 'redbull' service is 'enabled' in the test
salt.modules.ssh_service.get_all() Return a list of all available services
salt.modules.ssh_service.list_() Return a list of all available services.
salt.modules.ssh_service.restart(name, sig=None) Restart the specified service with rest_sample
salt.modules.ssh_service.running(name, sig=None) Return whether this service is running.
salt.modules.ssh_service.start(name, sig=None) Start the specified service on the ssh_sample
salt.modules.ssh_service.status(name, sig=None) Return the status for a service via ssh_sample.  If the name contains globbing, a dict mapping service name to True/False values is returned.
salt.modules.ssh_service.stop(name, sig=None) Stop the specified service on the rest_sample
salt.modules.state Control the state system on the minion.
State Caching When a highstate is called, the minion automatically caches a copy of the last high data. If you then run a highstate with cache=True it will use that cached highdata and won't hit the fileserver except for salt:// links in the states themselves.
salt.modules.state.apply_(mods=None, **kwargs) New in version 2015.5.0.
This function will call state.highstate or state.sls based on the arguments passed to this function.  It exists as a more intuitive way of applying states.
APPLYING ALL STATES CONFIGURED IN TOP.SLS (A.K.A. HIGHSTATE)
To apply all configured states, simply run state.apply:
The following additional arguments are also accepted when applying all states configured in top.sls:
mock   The mock option allows for the state run to execute without actually calling any states. This then returns a mocked return which will show the requisite ordering as well as fully validate the state run.
salt '*' state.apply stuff pillar='{"foo": "bar"}'
salt '*' state.apply exclude=bar,baz salt '*' state.apply exclude=foo* salt '*' state.apply exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
queue  False Instead of failing immediately when another state run is in progress, queue the new state run to begin running once the other has finished.
This option starts a new thread for each queued state run, so use this option sparingly.
localconfig Optionally, instead of using the minion config, load minion opts from the file specified by this argument, and then merge them with the options from the minion config. This functionality allows for specific states to be run with their own custom minion configuration, including different pillars, file_roots, etc.
salt '*' state.apply localconfig=/path/to/minion.yml
APPLYING INDIVIDUAL SLS FILES (A.K.A. STATE.SLS)
To apply individual SLS files, pass them as a comma-separated list:
# Run the states configured in salt://stuff.sls (or salt://stuff/init.sls) salt '*' state.apply stuff
# Run the states configured in salt://stuff.sls (or salt://stuff/init.sls) # and salt://pkgs.sls (or salt://pkgs/init.sls). salt '*' state.apply stuff,pkgs
# Run the states configured in a more deeply nested directory such as salt://my/organized/stuff.sls (or salt://my/organized/stuff/init.sls) salt '*' state.apply my.organized.stuff
The following additional arguments are also accepted when applying individual SLS files:
concurrent False Execute state runs concurrently instead of serially
WARNING: This flag is potentially dangerous. It is designed for use when multiple state runs can safely be run at the same time. Do not use this flag for performance optimization.
Changed in version 0.17.0: Argument name changed from env to saltenv
Changed in version 2014.7.0: If no saltenv is specified, the minion config will be checked for an environment parameter and if found, it will be used. If none is found, base will be used. In prior releases, the minion config was not checked and base would always be assumed when the saltenv was not explicitly set.
salt '*' state.apply stuff localconfig=/path/to/minion.yml
sync_mods If specified, the desired custom module types will be synced prior to running the SLS files:
salt '*' state.apply stuff sync_mods=states,modules salt '*' state.apply stuff sync_mods=all
NOTE: This option is ignored when no SLS files are specified, as a highstate automatically syncs all custom module types.
New in version 2017.7.8,2018.3.3,2019.2.0.
salt.modules.state.check_request(name=None) New in version 2015.5.0.
Return the state request information, if any
salt '*' state.check_request
salt.modules.state.clear_cache() Clear out cached state files, forcing even cache runs to refresh the cache on the next state execution.
Remember that the state cache is completely disabled by default, this execution only applies if cache=True is used in states
salt '*' state.clear_cache
salt.modules.state.clear_request(name=None) New in version 2015.5.0.
Clear out the state execution request without executing it
salt '*' state.clear_request
salt.modules.state.disable(states) Disable state runs.
salt '*' state.disable highstate
salt '*' state.disable highstate,test.succeed_without_changes
NOTE: To disable a state file from running provide the same name that would be passed in a state.sls call.
salt '*' state.disable bind.config
salt.modules.state.enable(states) Enable state function or sls run
salt '*' state.enable highstate
salt '*' state.enable test.succeed_without_changes
NOTE: To enable a state file from running provide the same name that would be passed in a state.sls call.
salt.modules.state.event(tagmatch='*', count=- 1, quiet=False, sock_dir=None, pretty=False, node='minion') Watch Salt's event bus and block until the given tag is matched
Changed in version 2019.2.0: tagmatch can now be either a glob or regular expression.
This is useful for utilizing Salt's event bus from shell scripts or for taking simple actions directly from the CLI.
Enable debug logging to see ignored events.
• tagmatch -- the event is written to stdout for each tag that matches this glob or regular expression.
• count -- this number is decremented for each event that matches the tagmatch parameter; pass -1 to listen forever.
• quiet -- do not print to stdout; just block
• sock_dir -- path to the Salt master's event socket file.
• pretty -- Output the JSON all on a single line if False (useful for shell tools); pretty-print the JSON output if True.
• node -- Watch the minion-side or master-side event bus.
salt-call --local state.event pretty=True
salt.modules.state.get_pauses(jid=None) Get a report on all of the currently paused state runs and pause run settings.  Optionally send in a jid if you only desire to see a single pause data set.
salt.modules.state.high(data, test=None, queue=False, **kwargs) Execute the compound calls stored in a single set of high data
This function is mostly intended for testing the state system and is not likely to be needed in everyday usage.
salt '*' state.high '{"vim": {"pkg": ["installed"]}}'
salt.modules.state.highstate(test=None, queue=False, **kwargs) Retrieve the state data from the salt master for this minion and execute it
salt '*' state.highstate stuff pillar='{"foo": "bar"}'
Changed in version 2016.3.0: GPG-encrypted CLI Pillar data is now supported via the GPG renderer. See here for details.
pillar_enc Specify which renderer to use to decrypt encrypted data located within the pillar value. Currently, only gpg is supported.
salt '*' state.highstate exclude=bar,baz salt '*' state.highstate exclude=foo* salt '*' state.highstate exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
Changed in version 0.17.0: Argument name changed from env to saltenv.
Changed in version 2014.7.0: If no saltenv is specified, the minion config will be checked for a saltenv parameter and if found, it will be used. If none is found, base will be used. In prior releases, the minion config was not checked and base would always be assumed when the saltenv was not explicitly set.
salt '*' state.highstate
salt '*' state.highstate whitelist=sls1_to_run,sls2_to_run salt '*' state.highstate exclude=sls_to_exclude salt '*' state.highstate exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
salt '*' state.highstate pillar="{foo: 'Foo!', bar: 'Bar!'}"
salt.modules.state.id_exists(ids, mods, test=None, queue=False, **kwargs) Tests for the existence of a specific ID or list of IDs within the specified SLS file(s). Similar to state.sls_exists, returns True or False. The default environment is base``, use saltenv to specify a different environment.
saltenv Specify a salt fileserver environment from which to look for the SLS files specified in the mods argument
salt '*' state.id_exists create_myfile,update_template filestate saltenv=dev
salt.modules.state.list_disabled() List the states which are currently disabled
salt '*' state.list_disabled
salt.modules.state.low(data, queue=False, **kwargs) Execute a single low data call
salt '*' state.low '{"state": "pkg", "fun": "installed", "name": "vi"}'
salt.modules.state.orchestrate(mods, saltenv='base', test=None, exclude=None, pillar=None, pillarenv=None) New in version 2016.11.0.
Execute the orchestrate runner from a masterless minion.
SEE ALSO: More Orchestrate documentation
• Full Orchestrate Tutorial
• Docs for the salt state module salt.states.saltmod
salt-call --local state.orchestrate webserver salt-call --local state.orchestrate webserver saltenv=dev test=True salt-call --local state.orchestrate webserver saltenv=dev pillarenv=aws
salt.modules.state.pause(jid, state_id=None, duration=None) Set up a state id pause, this instructs a running state to pause at a given state id. This needs to pass in the jid of the running state and can optionally pass in a duration in seconds. If a state_id is not passed then the jid referenced will be paused at the beginning of the next state run.
The given state id is the id got a given state execution, so given a state that looks like this:
The state_id to pass to pause is vim
salt '*' state.pause 20171130110407769519 salt '*' state.pause 20171130110407769519 vim salt '*' state.pause 20171130110407769519 vim 20
salt.modules.state.pkg(pkg_path, pkg_sum, hash_type, test=None, **kwargs) Execute a packaged state run, the packaged state run will exist in a tarball available locally. This packaged state can be generated using salt-ssh.
salt '*' state.pkg /tmp/salt_state.tgz 760a9353810e36f6d81416366fc426dc md5
salt.modules.state.request(mods=None, **kwargs) New in version 2015.5.0.
Request that the local admin execute a state run via salt-call state.run_request.  All arguments match those of state.apply.
salt '*' state.request salt '*' state.request stuff salt '*' state.request stuff,pkgs
salt.modules.state.resume(jid, state_id=None) Remove a pause from a jid, allowing it to continue. If the state_id is not specified then the a general pause will be resumed.
The given state_id is the id got a given state execution, so given a state that looks like this:
The state_id to pass to rm_pause is vim
salt '*' state.resume 20171130110407769519 salt '*' state.resume 20171130110407769519 vim
salt.modules.state.run_request(name='default', **kwargs) New in version 2015.5.0.
Execute the pending state request
salt '*' state.run_request
salt.modules.state.running(concurrent=False) Return a list of strings that contain state return data if a state function is already running. This function is used to prevent multiple state calls from being run at the same time.
salt '*' state.running
salt.modules.state.show_highstate(queue=False, **kwargs) Retrieve the highstate data from the salt master and display it
Custom Pillar data can be passed with the pillar kwarg.
salt.modules.state.show_low_sls(mods, test=None, queue=False, **kwargs) Display the low data from a specific sls. The default environment is base, use saltenv to specify a different environment.
salt '*' state.show_low_sls stuff pillar='{"foo": "bar"}'
salt '*' state.show_low_sls foo salt '*' state.show_low_sls foo saltenv=dev
salt.modules.state.show_lowstate(queue=False, **kwargs) List out the low data that will be applied to this minion
salt.modules.state.show_sls(mods, test=None, queue=False, **kwargs) Display the state data from a specific sls or list of sls files on the master. The default environment is base, use saltenv to specify a different environment.
This function does not support topfiles.  For top.sls please use show_top instead.
salt '*' state.show_sls core,edit.vim saltenv=dev
salt.modules.state.show_state_usage(queue=False, **kwargs) Retrieve the highstate data from the salt master to analyse used and unused states
salt '*' state.show_state_usage
salt.modules.state.show_states(queue=False, **kwargs) Returns the list of states that will be applied on highstate.
salt '*' state.show_states
salt.modules.state.show_top(queue=False, **kwargs) Return the top data that the minion will use for a highstate
salt '*' state.show_top
salt.modules.state.single(fun, name, test=None, queue=False, **kwargs) Execute a single state function with the named kwargs, returns False if insufficient data is sent to the command
By default, the values of the kwargs will be parsed as YAML. So, you can specify lists values, or lists of single entry key-value maps, as you would in a YAML salt file. Alternatively, JSON format of keyword values is also supported.
salt '*' state.single pkg.installed name=vim
salt.modules.state.sls(mods, test=None, exclude=None, queue=False, sync_mods=None, **kwargs) Execute the states in one or more SLS files
salt '*' state.sls stuff pillar='{"foo": "bar"}'
NOTE: Values passed this way will override existing Pillar values set via pillar_roots or an external Pillar source.  Pillar values that are not included in the kwarg will not be overwritten.
salt '*' state.sls foo,bar,baz exclude=bar,baz salt '*' state.sls foo,bar,baz exclude=ba* salt '*' state.sls foo,bar,baz exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
salt '*' state.sls stuff sync_mods=states,modules salt '*' state.sls stuff sync_mods=all
# Run the states configured in salt://example.sls (or salt://example/init.sls) salt '*' state.apply example
# Run the states configured in salt://core.sls (or salt://core/init.sls) # and salt://edit/vim.sls (or salt://edit/vim/init.sls) salt '*' state.sls core,edit.vim
# Run the states configured in a more deeply nested directory such as salt://my/nested/state.sls (or salt://my/nested/state/init.sls) salt '*' state.sls my.nested.state
salt '*' state.sls core exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]" salt '*' state.sls myslsfile pillar="{foo: 'Foo!', bar: 'Bar!'}"
salt.modules.state.sls_exists(mods, test=None, queue=False, **kwargs) Tests for the existence the of a specific SLS or list of SLS files on the master. Similar to state.show_sls, rather than returning state details, returns True or False. The default environment is base, use saltenv to specify a different environment.
salt '*' state.sls_exists core,edit.vim saltenv=dev
salt.modules.state.sls_id(id_, mods, test=None, queue=False, **kwargs) Call a single ID from the named module(s) and handle all requisites
The state ID comes before the module ID(s) on the command line.
id     ID to call
mods   Comma-delimited list of modules to search for given id and its requisites
saltenv base Specify a salt fileserver environment to be used when applying states
salt '*' state.sls_id my_state my_module pillar='{"foo": "bar"}'
salt '*' state.sls_id my_state my_module
salt '*' state.sls_id my_state my_module,a_common_module
salt.modules.state.soft_kill(jid, state_id=None) Set up a state run to die before executing the given state id, this instructs a running state to safely exit at a given state id. This needs to pass in the jid of the running state.  If a state_id is not passed then the jid referenced will be safely exited at the beginning of the next state run.
The state_id to pass to soft_kill is vim
salt '*' state.soft_kill 20171130110407769519 salt '*' state.soft_kill 20171130110407769519 vim
salt.modules.state.template(tem, queue=False, **kwargs) Execute the information stored in a template file on the minion.
This function does not ask a master for a SLS file to render but instead directly processes the file at the provided path on the minion.
salt '*' state.template '<Path to template on the minion>'
salt.modules.state.template_str(tem, queue=False, **kwargs) Execute the information stored in a string from an sls template
salt '*' state.template_str '<Template String>'
salt.modules.state.test(*args, **kwargs) New in version 3001.
Alias for state.apply with the kwarg test forced to True.
This is a nicety to avoid the need to type out test=True and the possibility of a typo causing changes you do not intend.