neulab/tldr huggingface dataset:
salt.modules.redismod.get_master_ip(host=None, port=None, password=None) Get host information about slave
salt '*' redis.get_master_ip
salt.modules.redismod.hdel(key, *fields, **options) Delete one of more hash fields.
salt '*' redis.hdel foo_hash bar_field1 bar_field2
salt.modules.redismod.hexists(key, field, host=None, port=None, db=None, password=None) Determine if a hash fields exists.
salt '*' redis.hexists foo_hash bar_field
salt.modules.redismod.hget(key, field, host=None, port=None, db=None, password=None) Get specific field value from a redis hash, returns dict
salt '*' redis.hget foo_hash bar_field
salt.modules.redismod.hgetall(key, host=None, port=None, db=None, password=None) Get all fields and values from a redis hash, returns dict
salt '*' redis.hgetall foo_hash
salt.modules.redismod.hincrby(key, field, increment=1, host=None, port=None, db=None, password=None) Increment the integer value of a hash field by the given number.
salt '*' redis.hincrby foo_hash bar_field 5
salt.modules.redismod.hincrbyfloat(key, field, increment=1.0, host=None, port=None, db=None, password=None) Increment the float value of a hash field by the given number.
salt '*' redis.hincrbyfloat foo_hash bar_field 5.17
salt.modules.redismod.hlen(key, host=None, port=None, db=None, password=None) Returns number of fields of a hash.
salt '*' redis.hlen foo_hash
salt.modules.redismod.hmget(key, *fields, **options) Returns the values of all the given hash fields.
salt '*' redis.hmget foo_hash bar_field1 bar_field2
salt.modules.redismod.hmset(key, **fieldsvals) Sets multiple hash fields to multiple values.
salt '*' redis.hmset foo_hash bar_field1=bar_value1 bar_field2=bar_value2
salt.modules.redismod.hscan(key, cursor=0, match=None, count=None, host=None, port=None, db=None, password=None) Incrementally iterate hash fields and associated values.
salt '*' redis.hscan foo_hash match='field_prefix_*' count=1
salt.modules.redismod.hset(key, field, value, host=None, port=None, db=None, password=None) Set the value of a hash field.
salt '*' redis.hset foo_hash bar_field bar_value
salt.modules.redismod.hsetnx(key, field, value, host=None, port=None, db=None, password=None) Set the value of a hash field only if the field does not exist.
salt '*' redis.hsetnx foo_hash bar_field bar_value
salt.modules.redismod.hvals(key, host=None, port=None, db=None, password=None) Return all the values in a hash.
salt '*' redis.hvals foo_hash bar_field1 bar_value1
salt.modules.redismod.info(host=None, port=None, db=None, password=None) Get information and statistics about the server
salt '*' redis.info
salt.modules.redismod.key_type(key, host=None, port=None, db=None, password=None) Get redis key type
salt '*' redis.type foo
salt.modules.redismod.keys(pattern='*', host=None, port=None, db=None, password=None) Get redis keys, supports glob style patterns
salt '*' redis.keys salt '*' redis.keys test*
salt.modules.redismod.lastsave(host=None, port=None, db=None, password=None) Get the UNIX time in seconds of the last successful save to disk
salt '*' redis.lastsave
salt.modules.redismod.llen(key, host=None, port=None, db=None, password=None) Get the length of a list in Redis
salt '*' redis.llen foo_list
salt.modules.redismod.lrange(key, start, stop, host=None, port=None, db=None, password=None) Get a range of values from a list in Redis
salt '*' redis.lrange foo_list 0 10
salt.modules.redismod.ping(host=None, port=None, db=None, password=None) Ping the server, returns False on connection errors
salt '*' redis.ping
salt.modules.redismod.save(host=None, port=None, db=None, password=None) Synchronously save the dataset to disk
salt '*' redis.save
salt.modules.redismod.sentinel_get_master_ip(master, host=None, port=None, password=None) Get ip for sentinel master
salt '*' redis.sentinel_get_master_ip 'mymaster'
salt.modules.redismod.set_key(key, value, host=None, port=None, db=None, password=None) Set redis key value
salt '*' redis.set_key foo bar
salt.modules.redismod.shutdown(host=None, port=None, db=None, password=None) Synchronously save the dataset to disk and then shut down the server
salt '*' redis.shutdown
salt.modules.redismod.slaveof(master_host=None, master_port=None, host=None, port=None, db=None, password=None) Make the server a slave of another instance, or promote it as master
# Become slave of redis-n01.example.com:6379 salt '*' redis.slaveof redis-n01.example.com 6379 salt '*' redis.slaveof redis-n01.example.com # Become master salt '*' redis.slaveof
salt.modules.redismod.smembers(key, host=None, port=None, db=None, password=None) Get members in a Redis set
salt '*' redis.smembers foo_set
salt.modules.redismod.time(host=None, port=None, db=None, password=None) Return the current server UNIX time in seconds
salt '*' redis.time
salt.modules.redismod.zcard(key, host=None, port=None, db=None, password=None) Get the length of a sorted set in Redis
salt '*' redis.zcard foo_sorted
salt.modules.redismod.zrange(key, start, stop, host=None, port=None, db=None, password=None) Get a range of values from a sorted set in Redis by index
salt '*' redis.zrange foo_sorted 0 10
salt.modules.reg Manage the Windows registry
Hives Hives are the main sections of the registry and all begin with the word HKEY.
• HKEY_LOCAL_MACHINE
• HKEY_CURRENT_USER
• HKEY_USER
Keys Keys are the folders in the registry. Keys can have many nested subkeys. Keys can have a value assigned to them under the (Default)
When passing a key on the CLI it must be quoted correctly depending on the backslashes being used (\ vs \\). The following are valid methods of passing the key on the CLI:
Using single backslashes: "SOFTWARE\Python" 'SOFTWARE\Python' (will not work on a Windows Master)
Using double backslashes: SOFTWARE\\Python
Values or Entries Values or Entries are the name/data pairs beneath the keys and subkeys. All keys have a default name/data pair. The name is (Default) with a displayed value of (value not set). The actual value is Null.
The following example is an export from the Windows startup portion of the registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] "RTHDVCPL"="\"C:\\Program Files\\Realtek\\Audio\\HDA\\RtkNGUI64.exe\" -s" "NvBackend"="\"C:\\Program Files (x86)\\NVIDIA Corporation\\Update Core\\NvBackend.exe\"" "BTMTrayAgent"="rundll32.exe \"C:\\Program Files (x86)\\Intel\\Bluetooth\\btmshellex.dll\",TrayApp"
In this example these are the values for each:
Hive:  HKEY_LOCAL_MACHINE
Key and subkeys: SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run
Value:
There are 3 value names:
• RTHDVCPL
• NvBackend
• BTMTrayAgent
• Each value name has a corresponding value
• salt.utils.win_reg
salt.modules.reg.broadcast_change() Refresh the windows environment.
NOTE: This will only effect new processes and windows. Services will not see the change until the system restarts.
salt '*' reg.broadcast_change
salt.modules.reg.delete_key_recursive(hive, key, use_32bit_registry=False) New in version 2015.5.4.
Delete a registry key to include all subkeys and value/data pairs.
Parameters hive (str) --
The name of the hive. Can be one of the following
• HKEY_LOCAL_MACHINE or HKLM
• HKEY_CURRENT_USER or HKCU
• HKEY_USER or HKU
• HKEY_CLASSES_ROOT or HKCR
• HKEY_CURRENT_CONFIG or HKCC
key (str): The key to remove (looks like a path)
use_32bit_registry (bool): Deletes the 32bit portion of the registry on 64bit installations. On 32bit machines this is ignored.
A dictionary listing the keys that deleted successfully as well as those that failed to delete.
CLI Example: The following example will remove delete_me and all its subkeys from the SOFTWARE key in HKEY_LOCAL_MACHINE:
salt '*' reg.delete_key_recursive HKLM SOFTWARE\\delete_me
salt.modules.reg.delete_value(hive, key, vname=None, use_32bit_registry=False) Delete a registry value entry or the default value for a key.
• hive (str) --
• key (str) -- The key (looks like a path) to the value name.
• vname (str) -- The value name. These are the individual name/data pairs under the key. If not passed, the key (Default) value will be deleted.
• use_32bit_registry (bool) -- Deletes the 32bit portion of the registry on 64bit installations. On 32bit machines this is ignored.
salt '*' reg.delete_value HKEY_CURRENT_USER 'SOFTWARE\\Salt' 'version'
salt.modules.reg.import_file(source, use_32bit_registry=False) Import registry settings from a Windows REG file by invoking REG.EXE.
• source (str) -- The full path of the REG file. This can be either a local file path or a URL type supported by salt (e.g. salt://salt_master_path)
• use_32bit_registry (bool) -- If the value of this parameter is True then the REG file will be imported into the Windows 32 bit registry. Otherwise the Windows 64 bit registry will be used.
Returns True if successful, otherwise an error is raised
• ValueError -- If the value of source is an invalid path or otherwise causes cp.cache_file to return False
• CommandExecutionError -- If reg.exe exits with a non-0 exit code
salt machine1 reg.import_file salt://win/printer_config/110_Canon/postinstall_config.reg
salt.modules.reg.key_exists(hive, key, use_32bit_registry=False) Check that the key is found in the registry. This refers to keys and not value/data pairs.
• hive (str) -- The hive to connect to
• key (str) -- The key to check
• use_32bit_registry (bool) -- Look in the 32bit portion of the registry
Returns True if exists, otherwise False
salt '*' reg.key_exists HKLM SOFTWARE\Microsoft
salt.modules.reg.list_keys(hive, key=None, use_32bit_registry=False) Enumerates the subkeys in a registry key or hive.
The name of the hive. Can be one of the following:
• key (str) -- The key (looks like a path) to the value name. If a key is not passed, the keys under the hive will be returned.
• use_32bit_registry (bool) -- Accesses the 32bit portion of the registry on 64 bit installations.  On 32bit machines this is ignored.
Returns A list of keys/subkeys under the hive or key.
salt '*' reg.list_keys HKLM 'SOFTWARE'
salt.modules.reg.list_values(hive, key=None, use_32bit_registry=False) Enumerates the values in a registry key or hive.
NOTE: The (Default) value will only be returned if it is set, otherwise it will not be returned in the list of values.
• key (str) -- The key (looks like a path) to the value name. If a key is not passed, the values under the hive will be returned.
Returns A list of values under the hive or key.
salt '*' reg.list_values HKLM 'SYSTEM\\CurrentControlSet\\Services\\Tcpip'
salt.modules.reg.read_value(hive, key, vname=None, use_32bit_registry=False) Reads a registry value entry or the default value for a key. To read the default value, don't pass vname
• vname (str) -- The value name. These are the individual name/data pairs under the key. If not passed, the key (Default) value will be returned.
• use_32bit_registry (bool) -- Accesses the 32bit portion of the registry on 64bit installations.  On 32bit machines this is ignored.
Returns A dictionary containing the passed settings as well as the value_data if successful. If unsuccessful, sets success to False.
bool: Returns False if the key is not found
If vname is not passed:
• Returns the first unnamed value (Default) as a string.
• Returns none if first unnamed value is empty.
CLI Example: The following will get the value of the version value name in the HKEY_LOCAL_MACHINE\\SOFTWARE\\Salt key
salt '*' reg.read_value HKEY_LOCAL_MACHINE 'SOFTWARE\Salt' 'version'
CLI Example: The following will get the default value of the HKEY_LOCAL_MACHINE\\SOFTWARE\\Salt key
salt '*' reg.read_value HKEY_LOCAL_MACHINE 'SOFTWARE\Salt'
salt.modules.reg.set_value(hive, key, vname=None, vdata=None, vtype='REG_SZ', use_32bit_registry=False, volatile=False) Sets a value in the registry. If vname is passed, it will be the value for that value name, otherwise it will be the default value for the specified key
• vname (str) -- The value name. These are the individual name/data pairs under the key. If not passed, the key (Default) value will be set.
• vdata (str, int, list, bytes) --
The value you'd like to set. If a value name (vname) is passed, this will be the data for that value name. If not, this will be the (Default) value for the key.
The type of data this parameter expects is determined by the value type specified in vtype. The correspondence is as follows:
• REG_BINARY: Binary data (str in Py2, bytes in Py3)
• REG_DWORD: int
• REG_EXPAND_SZ: str
• REG_MULTI_SZ: list of str
• REG_QWORD: int
• REG_SZ: str
NOTE: When setting REG_BINARY, string data will be converted to binary.
NOTE: The type for the (Default) value is always REG_SZ and cannot be changed.
NOTE: This parameter is optional. If vdata is not passed, the Key will be created with no associated item/value pairs.
• vtype (str) -- The value type. The possible values of the vtype parameter are indicated above in the description of the vdata parameter.
• use_32bit_registry (bool) -- Sets the 32bit portion of the registry on 64bit installations. On 32bit machines this is ignored.
• volatile (bool) -- When this parameter has a value of True, the registry key will be made volatile (i.e. it will not persist beyond a system reset or shutdown). This parameter only has an effect when a key is being created and at no other time.
CLI Example: This will set the version value to 2015.5.2 in the SOFTWARESalt key in the HKEY_LOCAL_MACHINE hive
salt '*' reg.set_value HKEY_LOCAL_MACHINE 'SOFTWARE\Salt' 'version' '2015.5.2'
CLI Example: This function is strict about the type of vdata. For instance this example will fail because vtype has a value of REG_SZ and vdata has a type of int (as opposed to str as expected).
salt '*' reg.set_value HKEY_LOCAL_MACHINE 'SOFTWARE\Salt' 'str_data' 1.2
CLI Example: In this next example vdata is properly quoted and should succeed.
salt '*' reg.set_value HKEY_LOCAL_MACHINE 'SOFTWARE\Salt' 'str_data' vtype=REG_SZ vdata="'1.2'"
CLI Example: This is an example of using vtype REG_BINARY.
salt '*' reg.set_value HKEY_LOCAL_MACHINE 'SOFTWARE\Salt' 'bin_data' vtype=REG_BINARY vdata='Salty Data'
CLI Example: An example of using vtype REG_MULTI_SZ is as follows:
salt '*' reg.set_value HKEY_LOCAL_MACHINE 'SOFTWARE\Salt' 'list_data' vtype=REG_MULTI_SZ vdata='["Salt", "is", "great"]'
salt.modules.reg.value_exists(hive, key, vname, use_32bit_registry=False) Check that the value/data pair is found in the registry.
• key (str) -- The key to check in
• vname (str) -- The name of the value/data pair you're checking
salt '*' reg.value_exists HKLM SOFTWARE\Microsoft\Windows\CurrentVersion CommonFilesDir
salt.modules.rest_pkg Package support for the REST example
salt.modules.rest_pkg.install(name=None, refresh=False, fromrepo=None, pkgs=None, sources=None, **kwargs)
salt.modules.rest_pkg.installed(name, version=None, refresh=False, fromrepo=None, skip_verify=False, pkgs=None, sources=None, **kwargs)
salt.modules.rest_pkg.list_pkgs(versions_as_list=False, **kwargs)
salt.modules.rest_pkg.remove(name=None, pkgs=None, **kwargs)
salt.modules.rest_pkg.upgrade(refresh=True, skip_verify=True, **kwargs)
salt.modules.rest_pkg.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.rest_sample_utils Utility functions for the rest_sample
salt.modules.rest_sample_utils.fix_outage() "Fix" the outage
salt 'rest-sample-proxy' rest_sample.fix_outage
salt.modules.rest_sample_utils.get_test_string() Helper function to test cross-calling to the __proxy__ dunder.
salt 'rest-sample-proxy' rest_sample.get_test_string
salt.modules.rest_service Provide the service module for the proxy-minion REST sample
salt.modules.rest_service.enabled(name, sig=None) Only the 'redbull' service is 'enabled' in the test
salt.modules.rest_service.get_all() Return a list of all available services
salt.modules.rest_service.list_() Return a list of all available services.
salt.modules.rest_service.restart(name, sig=None) Restart the specified service with rest_sample
salt.modules.rest_service.running(name, sig=None) Return whether this service is running.
salt.modules.rest_service.start(name, sig=None) Start the specified service on the rest_sample
salt.modules.rest_service.status(name, sig=None) Return the status for a service via rest_sample.  If the name contains globbing, a dict mapping service name to True/False values is returned.
• sig (str) -- Not implemented
salt.modules.rest_service.stop(name, sig=None) Stop the specified service on the rest_sample
salt.modules.restartcheck checkrestart functionality for Debian and Red Hat Based systems
Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library).
Based on checkrestart script from debian-goodies (written  by Matt Zimmerman for the Debian GNU/Linux distribution, https://packages.debian.org/debian-goodies) and psdel by Sam Morris.
salt.modules.restartcheck.restartcheck(ignorelist=None, blacklist=None, excludepid=None, **kwargs) Analyzes files openeded by running processes and seeks for packages which need to be restarted.
• ignorelist -- string or list of packages to be ignored.
• blacklist -- string or list of file paths to be ignored.
• excludepid -- string or list of process IDs to be ignored.
• verbose -- boolean, enables extensive output.
• timeout -- int, timeout in minute.
Returns { 'result': False, 'comment': '<reason>' }.  String with checkrestart output if some package seems to need to be restarted or if no packages need restarting.
Return type Dict on error
salt '*' restartcheck.restartcheck
salt.modules.ret Module to integrate with the returner system and retrieve data sent to a salt returner
salt.modules.ret.get_fun(returner, fun) Return info about last time fun was called on each minion
salt '*' ret.get_fun mysql network.interfaces
salt.modules.ret.get_jid(returner, jid) Return the information for a specified job id
salt '*' ret.get_jid redis 20421104181954700505
salt.modules.ret.get_jids(returner) Return a list of all job ids
salt '*' ret.get_jids mysql
salt.modules.ret.get_minions(returner) Return a list of all minions
salt '*' ret.get_minions mysql
salt.modules.rh_ip The networking module for RHEL/Fedora based distros
salt.modules.rh_ip.apply_network_settings(**settings) Apply global network configuration.
salt.modules.rh_ip.build_interface(iface, iface_type, enabled, **settings) Build an interface script for a network interface.
salt.modules.rh_ip.build_network_settings(**settings) Build the global network script.
salt.modules.rh_ip.build_routes(iface, **settings) Build a route script for a network interface.
salt.modules.rh_ip.down(iface, iface_type) Shutdown a network interface
salt.modules.rh_ip.get_interface(iface) Return the contents of an interface script
salt.modules.rh_ip.get_network_settings() Return the contents of the global network script.
salt.modules.rh_ip.get_routes(iface) Return the contents of the interface routes script.
salt.modules.rh_ip.up(iface, iface_type) Start up a network interface
salt.modules.rh_service Service support for RHEL-based systems, including support for both upstart and sysvinit
salt.modules.rh_service.available(name, limit='') Return True if the named service is available.  Use the limit param to restrict results to services of that type.
salt '*' service.available sshd salt '*' service.available sshd limit=upstart salt '*' service.available sshd limit=sysvinit
salt.modules.rh_service.delete(name, **kwargs) Delete the named service
salt '*' service.delete <service name>
salt.modules.rh_service.disable(name, **kwargs) Disable the named service to start at boot
salt.modules.rh_service.disabled(name) Check to see if the named service is disabled to start on boot
salt.modules.rh_service.enable(name, **kwargs) Enable the named service to start at boot
salt.modules.rh_service.enabled(name, **kwargs) Check to see if the named service is enabled to start on boot
salt.modules.rh_service.get_all(limit='') Return all installed services. Use the limit param to restrict results to services of that type.
salt '*' service.get_all salt '*' service.get_all limit=upstart salt '*' service.get_all limit=sysvinit
salt.modules.rh_service.get_disabled(limit='') Return the disabled services. Use the limit param to restrict results to services of that type.
salt '*' service.get_disabled salt '*' service.get_disabled limit=upstart salt '*' service.get_disabled limit=sysvinit
salt.modules.rh_service.get_enabled(limit='') Return the enabled services. Use the limit param to restrict results to services of that type.
salt '*' service.get_enabled salt '*' service.get_enabled limit=upstart salt '*' service.get_enabled limit=sysvinit
salt.modules.rh_service.missing(name, limit='') The inverse of service.available.  Return True if the named service is not available.  Use the limit param to restrict results to services of that type.
salt '*' service.missing sshd salt '*' service.missing sshd limit=upstart salt '*' service.missing sshd limit=sysvinit
salt.modules.rh_service.reload_(name) Reload the named service
salt.modules.rh_service.restart(name) Restart the named service
salt.modules.rh_service.start(name) Start the specified service
salt.modules.rh_service.status(name, sig=None) Return the status for a service.  If the name contains globbing, a dict mapping service name to True/False values is returned.
salt.modules.rh_service.stop(name) Stop the specified service
salt.modules.riak Riak Salt Module
salt.modules.riak.cluster_commit() Commit Cluster Changes
Changed in version 2015.8.0.
salt '*' riak.cluster_commit
salt.modules.riak.cluster_join(username, hostname) Join a Riak cluster
salt '*' riak.cluster_join <user> <host>
username - The riak username to join the cluster hostname - The riak hostname you are connecting to
salt.modules.riak.cluster_leave(username, hostname) Leave a Riak cluster
salt '*' riak.cluster_leave <username> <host>
salt.modules.riak.cluster_plan() Review Cluster Plan
salt '*' riak.cluster_plan
salt.modules.riak.member_status() Get cluster member status
salt '*' riak.member_status
salt.modules.riak.services() List available services on a node
salt '*' riak.services
salt.modules.riak.start() Start Riak
salt '*' riak.start
salt.modules.riak.status() Current node status
salt '*' riak.status
salt.modules.riak.stop() Stop Riak
salt '*' riak.stop
salt.modules.riak.test() Runs a test of a few standard Riak operations
salt '*' riak.test
salt.modules.rpm_lowpkg Support for rpm
salt.modules.rpm_lowpkg.bin_pkg_info(path, saltenv='base') New in version 2015.8.0.
salt '*' lowpkg.bin_pkg_info /root/salt-2015.5.1-2.el7.noarch.rpm salt '*' lowpkg.bin_pkg_info salt://salt-2015.5.1-2.el7.noarch.rpm
salt.modules.rpm_lowpkg.checksum(*paths, **kwargs) Return if the signature of a RPM file is valid.
root   use root as top level directory (default: "/")
salt '*' lowpkg.checksum /path/to/package1.rpm salt '*' lowpkg.checksum /path/to/package1.rpm /path/to/package2.rpm
salt.modules.rpm_lowpkg.diff(package_path, path) Return a formatted diff between current file and original in a package.  NOTE: this function includes all files (configuration and not), but does not work on binary content.
• package -- Full pack of the RPM file
• path -- Full path to the installed file
Returns Difference or empty string. For binary files only a notification.
salt '*' lowpkg.diff /path/to/apache2.rpm /etc/apache2/httpd.conf
salt.modules.rpm_lowpkg.file_dict(*packages, **kwargs) List the files that belong to a package, sorted by group. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended).
salt '*' lowpkg.file_dict httpd salt '*' lowpkg.file_dict httpd postfix salt '*' lowpkg.file_dict
salt.modules.rpm_lowpkg.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 rpm database (not generally recommended).
salt '*' lowpkg.file_list httpd salt '*' lowpkg.file_list httpd postfix salt '*' lowpkg.file_list
salt.modules.rpm_lowpkg.info(*packages, **kwargs) Return a detailed package(s) summary information.  If no packages specified, all packages will be returned.
• packages --
Valid attributes are: version, vendor, release, build_date, build_date_time_t, install_date, install_date_time_t, build_host, group, source_rpm, arch, epoch, size, license, signature, packager, url, summary, description.
• all_versions -- Return information for all installed versions of the packages
• root -- use root as top level directory (default: "/")
salt '*' lowpkg.info apache2 bash salt '*' lowpkg.info apache2 bash attr=version salt '*' lowpkg.info apache2 bash attr=version,build_date_iso,size salt '*' lowpkg.info apache2 bash attr=version,build_date_iso,size all_versions=True
salt.modules.rpm_lowpkg.list_pkgs(*packages, **kwargs) List the packages currently installed in a dict:
salt '*' lowpkg.list_pkgs
salt.modules.rpm_lowpkg.modified(*packages, **flags) List the modified files that belong to a package. Not specifying any packages will return a list of _all_ modified files on the system's RPM database.
salt '*' lowpkg.modified httpd salt '*' lowpkg.modified httpd postfix salt '*' lowpkg.modified
salt.modules.rpm_lowpkg.owner(*paths, **kwargs) Return the name of the package that owns the file. Multiple file paths can be passed. 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 '*' lowpkg.owner /usr/bin/apachectl salt '*' lowpkg.owner /usr/bin/apachectl /etc/httpd/conf/httpd.conf
salt.modules.rpm_lowpkg.verify(*packages, **kwargs) Runs an rpm -Va on a system, and returns the results in a dict
Files with an attribute of config, doc, ghost, license or readme in the package header can be ignored using the ignore_types keyword argument
salt '*' lowpkg.verify salt '*' lowpkg.verify httpd salt '*' lowpkg.verify httpd postfix salt '*' lowpkg.verify httpd postfix ignore_types=['config','doc']
salt.modules.rpm_lowpkg.version_cmp(ver1, ver2, ignore_epoch=False) New in version 2015.8.9.
Do a cmp-style comparison on two packages. Return -1 if ver1 < ver2, 0 if ver1 == ver2, and 1 if ver1 > ver2. Return None if there was a problem making the comparison.
salt '*' pkg.version_cmp '0.2-001' '0.2.0.1-002'
salt.modules.rpmbuild_pkgbuild RPM Package builder system
This system allows for all of the components to build rpms safely in chrooted environments. This also provides a function to generate yum repositories
salt.modules.rpmbuild_pkgbuild.build(runas, tgt, dest_dir, spec, sources, deps, env, template, saltenv='base', log_dir='/var/log/salt/pkgbuild') Given the package destination directory, the spec file source and package sources, use mock to safely build the rpm defined in the spec file
salt '*' pkgbuild.build mock epel-7-x86_64 /var/www/html https://raw.githubusercontent.com/saltstack/libnacl/master/pkg/rpm/python-libnacl.spec https://pypi.python.org/packages/source/l/libnacl/libnacl-1.3.5.tar.gz
This example command should build the libnacl package for rhel 7 using user mock and place it in /var/www/html/ on the minion
salt.modules.rpmbuild_pkgbuild.make_repo(repodir, keyid=None, env=None, use_passphrase=False, gnupghome='/etc/salt/gpgkeys', runas='root', timeout=15.0) Make a package repository and optionally sign packages present
Given the repodir, create a yum repository out of the rpms therein and optionally sign it and packages present, the name is directory to turn into a repo. This state is best used with onchanges linked to your package building states.
Optional Key ID to use in signing packages and repository. Utilizes Public and Private keys associated with keyid which have been loaded into the minion's Pillar data.
gpg_pkg_priv_key: | -----BEGIN PGP PRIVATE KEY BLOCK----- Version: GnuPG v1
lQO+BFciIfQBCADAPCtzx7I5Rl32escCMZsPzaEKWe7bIX1em4KCKkBoX47IG54b w82PCE8Y1jF/9Uk2m3RKVWp3YcLlc7Ap3gj6VO4ysvVz28UbnhPxsIkOlf2cq8qc . . Ebe+8JCQTwqSXPRTzXmy/b5WXDeM79CkLWvuGpXFor76D+ECMRPv/rawukEcNptn R5OmgHqvydEnO4pWbn8JzQO9YX/Us0SMHBVzLC8eIi5ZIopzalvX =JvW8 -----END PGP PRIVATE KEY BLOCK-----
gpg_pkg_priv_keyname: gpg_pkg_key.pem
gpg_pkg_pub_key: | -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1
mQENBFciIfQBCADAPCtzx7I5Rl32escCMZsPzaEKWe7bIX1em4KCKkBoX47IG54b w82PCE8Y1jF/9Uk2m3RKVWp3YcLlc7Ap3gj6VO4ysvVz28UbnhPxsIkOlf2cq8qc . . bYP7t5iwJmQzRMyFInYRt77wkJBPCpJc9FPNebL9vlZcN4zv0KQta+4alcWivvoP 4QIxE+/+trC6QRw2m2dHk6aAeq/J0Sc7ilZufwnNA71hf9SzRIwcFXMsLx4iLlki inNqW9c= =s1CX -----END PGP PUBLIC KEY BLOCK-----
gpg_pkg_pub_keyname: gpg_pkg_key.pub
NOTE: This parameter is not used for making yum repositories.
Use a passphrase with the signing key presented in keyid. Passphrase is received from Pillar data which could be passed on the command line with pillar parameter.
New in version 3001.1.
RHEL 8 and above leverages gpg-agent and gpg-preset-passphrase for caching keys, etc.
salt '*' pkgbuild.make_repo /var/www/html/
salt.modules.rpmbuild_pkgbuild.make_src_pkg(dest_dir, spec, sources, env=None, template=None, saltenv='base', runas='root') Create a source rpm from the given spec file and sources
salt '*' pkgbuild.make_src_pkg /var/www/html/ https://raw.githubusercontent.com/saltstack/libnacl/master/pkg/rpm/python-libnacl.spec https://pypi.python.org/packages/source/l/libnacl/libnacl-1.3.5.tar.gz
dest_dir The directory on the minion to place the built package(s)
spec   The location of the spec file (used for rpms)
sources The list of package sources
env    A dictionary of environment variables to be set prior to execution.
template Run the spec file through a templating engine Optional argument, allows for no templating engine used to be if none is desired.
saltenv The saltenv to use for files downloaded from the salt filesever
runas  The user to run the build process as
New in version 2018.3.3.
NOTE: using SHA256 as digest and minimum level dist el6
salt.modules.rsync Wrapper for rsync
This data can also be passed into pillar.  Options passed into opts will overwrite options passed into pillar.
salt.modules.rsync.config(conf_path='/etc/rsyncd.conf') Changed in version 2016.3.0: Return data now contains just the contents of the rsyncd.conf as a string, instead of a dictionary as returned from cmd.run_all.
Returns the contents of the rsync config file
conf_path /etc/rsyncd.conf Path to the config file
salt '*' rsync.config
salt.modules.rsync.rsync(src, dst, delete=False, force=False, update=False, passwordfile=None, exclude=None, excludefrom=None, dryrun=False, rsh=None, additional_opts=None, saltenv='base') Changed in version 2016.3.0: Return data now contains just the output of the rsync command, instead of a dictionary as returned from cmd.run_all.
Rsync files from src to dst
src    The source location where files will be rsynced from.
dst    The destination location where files will be rsynced to.
delete False Whether to enable the rsync --delete flag, which will delete extraneous files from dest dirs
force  False Whether to enable the rsync --force flag, which will force deletion of dirs even if not empty.
update False Whether to enable the rsync --update flag, which forces rsync to skip any files which exist on the destination and have a modified time that is newer than the source file.
passwordfile A file that contains a password for accessing an rsync daemon.  The file should contain just the password.
exclude Whether to enable the rsync --exclude flag, which will exclude files matching a PATTERN.
excludefrom Whether to enable the rsync --excludefrom flag, which will read exclude patterns from a file.
dryrun False Whether to enable the rsync --dry-run flag, which will perform a trial run with no changes made.
rsh    Whether to enable the rsync --rsh flag, to specify the remote shell to use.
additional_opts Any additional rsync options, should be specified as a list.
saltenv Specify a salt fileserver environment to be used.
salt '*' rsync.rsync /path/to/src /path/to/dest delete=True update=True passwordfile=/etc/pass.crt exclude=exclude/dir salt '*' rsync.rsync /path/to/src delete=True excludefrom=/xx.ini salt '*' rsync.rsync /path/to/src delete=True exclude='[exclude1/dir,exclude2/dir]' additional_opts='["--partial", "--bwlimit=5000"]'
salt.modules.rsync.version() Changed in version 2016.3.0: Return data now contains just the version number as a string, instead of a dictionary as returned from cmd.run_all.
Returns rsync version
salt '*' rsync.version
salt.modules.runit runit service module (http://smarden.org/runit)
myservice: service: - running - provider: runit
Provides virtual service module on systems using runit as init.
Service management rules (sv command): service $n is ENABLED   if file SERVICE_DIR/$n/run exists service $n is AVAILABLE if ENABLED or if file AVAIL_SVR_DIR/$n/run exists service $n is DISABLED  if AVAILABLE but not ENABLED
SERVICE_DIR/$n is normally a symlink to a AVAIL_SVR_DIR/$n folder
Service auto-start/stop mechanism: sv (auto)starts/stops service as soon as SERVICE_DIR/<service> is created/deleted, both on service creation or a boot time.
autostart feature is disabled if file SERVICE_DIR/<n>/down exists. This does not affect the current's service status (if already running) nor manual service management.
Service's alias: Service sva is an alias of service svc when AVAIL_SVR_DIR/sva symlinks to folder AVAIL_SVR_DIR/svc. svc can't be enabled if it is already enabled through an alias already enabled, since sv files are stored in folder SERVICE_DIR/svc/.
XBPS package management uses a service's alias to provides service alternative(s), such as chrony and openntpd both aliased to ntpd.
salt.modules.runit.add_svc_avail_path(path) Add a path that may contain available services.  Return True if added (or already present), False on error.
path   directory to add to AVAIL_SVR_DIRS
salt.modules.runit.available(name) Returns True if the specified service is available, otherwise returns False.
name   the service's name
salt '*' runit.available <service name>
salt.modules.runit.disable(name, stop=False, **kwargs) Don't start service name at boot Returns True if operation is successful
stop   if True, also stops the service
salt '*' service.disable <name> [stop=True]
salt.modules.runit.disabled(name) Return True if the named service is disabled, False  otherwise
salt.modules.runit.enable(name, start=False, **kwargs) Start service name at boot.  Returns True if operation is successful
start  False If True, start the service once enabled.
salt '*' service.enable <name> [start=True]
salt.modules.runit.enabled(name) Return True if the named service is enabled, False otherwise
salt.modules.runit.full_restart(name) Calls runit.restart()
salt '*' runit.full_restart <service name>
salt.modules.runit.get_all() Return a list of all available services
salt '*' runit.get_all
salt.modules.runit.get_disabled() Return a list of all disabled services
salt.modules.runit.get_enabled() Return a list of all enabled services
salt.modules.runit.get_svc_alias() Returns the list of service's name that are aliased and their alias path(s)
salt.modules.runit.get_svc_avail_path() Return list of paths that may contain available services
salt.modules.runit.get_svc_broken_path(name='*') Return list of broken path(s) in SERVICE_DIR that match name
A path is broken if it is a broken symlink or can not be a runit service
name   a glob for service name. default is '*'
salt '*' runit.get_svc_broken_path <service name>
salt.modules.runit.missing(name) The inverse of runit.available.  Returns True if the specified service is not available, otherwise returns False.
salt '*' runit.missing <service name>
salt.modules.runit.reload_(name) Reload service
salt '*' runit.reload <service name>
salt.modules.runit.remove(name) Remove the service <name> from system.  Returns True if operation is successful.  The service will be also stopped.
salt '*' service.remove <name>
salt.modules.runit.restart(name) Restart service
salt '*' runit.restart <service name>
salt.modules.runit.show(name) Show properties of one or more units/jobs or the manager
salt '*' service.show <service name>
salt.modules.runit.start(name) Start service
salt '*' runit.start <service name>
salt.modules.runit.status(name, sig=None) Return True if service is running
sig    signature to identify with ps
salt '*' runit.status <service name>
salt.modules.runit.status_autostart(name) Return True if service <name> is autostarted by sv (file $service_folder/down does not exist) NB: return False if the service is not enabled.
salt '*' runit.status_autostart <service name>
salt.modules.runit.stop(name) Stop service
salt '*' runit.stop <service name>
salt.modules.rvm Manage ruby installations and gemsets with RVM, the Ruby Version Manager.
salt.modules.rvm.do(ruby, command, runas=None, cwd=None, env=None) Execute a command in an RVM controlled environment.
ruby   Which ruby to use
command The rvm command to execute
runas  The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running.
cwd    The directory from which to run the rvm command. Defaults to the user's home directory.
salt '*' rvm.do 2.0.0 <command>
salt.modules.rvm.gemset_copy(source, destination, runas=None) Copy all gems from one gemset to another.
source The name of the gemset to copy, complete with ruby version
destination The destination gemset
salt '*' rvm.gemset_copy foobar bazquo
salt.modules.rvm.gemset_create(ruby, gemset, runas=None) Creates a gemset.
ruby   The ruby version for which to create the gemset
gemset The name of the gemset to create
salt '*' rvm.gemset_create 2.0.0 foobar
salt.modules.rvm.gemset_delete(ruby, gemset, runas=None) Delete a gemset
ruby   The ruby version to which the gemset belongs
gemset The gemset to delete
salt '*' rvm.gemset_delete 2.0.0 foobar
salt.modules.rvm.gemset_empty(ruby, gemset, runas=None) Remove all gems from a gemset.
gemset The gemset to empty
salt '*' rvm.gemset_empty 2.0.0 foobar
salt.modules.rvm.gemset_list(ruby='default', runas=None) List all gemsets for the given ruby.
ruby   default The ruby version for which to list the gemsets
salt '*' rvm.gemset_list
salt.modules.rvm.gemset_list_all(runas=None) List all gemsets for all installed rubies.
Note that you must have set a default ruby before this can work.
salt '*' rvm.gemset_list_all
salt.modules.rvm.get(version='stable', runas=None) Update RVM
version stable Which version of RVM to install, (e.g. stable or head)
salt '*' rvm.get
salt.modules.rvm.install(runas=None) Install RVM system-wide
runas  The user under which to run the rvm installer script. If not specified, then it be run as the user under which Salt is running.
salt '*' rvm.install
salt.modules.rvm.install_ruby(ruby, runas=None, opts=None, env=None) Install a ruby implementation.
ruby   The version of ruby to install
env    Environment to set for the install command. Useful for exporting compilation flags such as RUBY_CONFIGURE_OPTS
opts   List of options to pass to the RVM installer (ie -C, --patch, etc)
salt '*' rvm.install_ruby 1.9.3-p385
salt.modules.rvm.is_installed(runas=None) Check if RVM is installed.
salt '*' rvm.is_installed
salt.modules.rvm.list_(runas=None) List all rvm-installed rubies
salt '*' rvm.list
salt.modules.rvm.reinstall_ruby(ruby, runas=None, env=None) Reinstall a ruby implementation
ruby   The version of ruby to reinstall
salt '*' rvm.reinstall_ruby 1.9.3-p385
salt.modules.rvm.rubygems(ruby, version, runas=None) Installs a specific rubygems version in the given ruby
ruby   The ruby for which to install rubygems
version The version of rubygems to install, or 'remove' to use the version that ships with 1.9
salt '*' rvm.rubygems 2.0.0 1.8.24
salt.modules.rvm.set_default(ruby, runas=None) Set the default ruby
ruby   The version of ruby to make the default
salt '*' rvm.set_default 2.0.0
salt.modules.rvm.wrapper(ruby_string, wrapper_prefix, runas=None, *binaries) Install RVM wrapper scripts
ruby_string Ruby/gemset to install wrappers for
wrapper_prefix What to prepend to the name of the generated wrapper binaries
binaries None The names of the binaries to create wrappers for. When nothing is given, wrappers for ruby, gem, rake, irb, rdoc, ri and testrb are generated.
salt '*' rvm.wrapper <ruby_string> <wrapper_prefix>
salt.modules.s3 Connection module for Amazon S3
configuration This module accepts explicit s3 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
WARNING: This is literally the pillar key s3.keyid or the config option s3.keyid, not:
s3: keyid: blah
A service_url may also be specified in the configuration:
s3.service_url: s3.amazonaws.com
A role_arn may also be specified in the configuration:
s3.role_arn: arn:aws:iam::111111111111:role/my-role-to-assume
If a service_url is not specified, the default is s3.amazonaws.com. This may appear in various documentation as an "endpoint". A comprehensive list for Amazon S3 may be found at: http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
The service_url will form the basis for the final endpoint that is used to query the service.
Path style can be enabled:
s3.path_style: True
This can be useful if you need to use Salt with a proxy for a S3 compatible storage.
You can use either HTTPS protocol or HTTP protocol:
s3.https_enable: True
SSL verification may also be turned off in the configuration:
s3.verify_ssl: False
This is required if using S3 bucket names that contain a period, as these will not match Amazon's S3 wildcard certificates. Certificate verification is enabled by default.
AWS region may be specified in the configuration:
s3.location: eu-central-1
Default is us-east-1.
This module should be usable to query other S3-like services, such as Eucalyptus.
salt.modules.s3.delete(bucket, path=None, action=None, key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None) Delete a bucket, or delete an object from a bucket.
CLI Example to delete a bucket:
salt myminion s3.delete mybucket
CLI Example to delete an object from a bucket:
salt myminion s3.delete mybucket remoteobject
salt.modules.s3.get(bucket='', path='', return_bin=False, action=None, local_file=None, key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None) List the contents of a bucket, or return an object from a bucket. Set return_bin to True in order to retrieve an object wholesale. Otherwise, Salt will attempt to parse an XML response.
CLI Example to list buckets: salt myminion s3.get
CLI Example to list the contents of a bucket: salt myminion s3.get mybucket
CLI Example to return the binary contents of an object: salt myminion s3.get mybucket myfile.png return_bin=True
CLI Example to save the binary contents of an object to a local file: salt myminion s3.get mybucket myfile.png local_file=/tmp/myfile.png
It is also possible to perform an action on a bucket. Currently, S3 supports the following actions:
acl cors lifecycle policy location logging notification tagging versions requestPayment versioning website
To perform an action on a bucket: salt myminion s3.get mybucket myfile.png action=acl
salt.modules.s3.head(bucket, path='', key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None) Return the metadata for a bucket, or an object in a bucket.
salt myminion s3.head mybucket salt myminion s3.head mybucket myfile.png
salt.modules.s3.put(bucket, path=None, return_bin=False, action=None, local_file=None, key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None) Create a new bucket, or upload an object to a bucket.
CLI Example to create a bucket: salt myminion s3.put mybucket
CLI Example to upload an object to a bucket: salt myminion s3.put mybucket remotepath local_file=/path/to/file
salt.modules.s6 s6 service module
myservice: service: - running - provider: s6
Note that the enabled argument is not available with this provider.
codeauthor Marek Skrobacki <skrobul@skrobul.com>
salt.modules.s6.available(name) Returns True if the specified service is available, otherwise returns False.
salt '*' s6.available foo
salt.modules.s6.full_restart(name) Calls s6.restart() function
salt '*' s6.full_restart <service name>
salt.modules.s6.get_all() Return a list of all available services
salt '*' s6.get_all
salt.modules.s6.missing(name) The inverse of s6.available.  Returns True if the specified service is not available, otherwise returns False.
salt '*' s6.missing foo
salt.modules.s6.reload_(name) Send a HUP to service via s6
salt '*' s6.reload <service name>
salt.modules.s6.restart(name) Restart service via s6. This will stop/start service
salt '*' s6.restart <service name>
salt.modules.s6.start(name) Starts service via s6
salt '*' s6.start <service name>
salt.modules.s6.status(name, sig=None) Return the status for a service via s6, return pid if running
salt '*' s6.status <service name>
salt.modules.s6.stop(name) Stops service via s6
salt '*' s6.stop <service name>
salt.modules.s6.term(name) Send a TERM to service via s6
salt '*' s6.term <service name>
salt.modules.salt_proxy Salt proxy module
Module to deploy and manage salt-proxy processes on a minion.
salt.modules.salt_proxy.configure_proxy(proxyname, start=True) Create the salt proxy file and start the proxy process if required
• proxyname -- Name to be used for this proxy (should match entries in pillar)
• start -- Boolean indicating if the process should be started default = True
salt deviceminion salt_proxy.configure_proxy p8000
salt.modules.salt_proxy.is_running(proxyname) Check if the salt-proxy process associated with this proxy (name) is running.
Returns True if the process is running False otherwise
Parameters proxyname -- String name of the proxy (p8000 for example)
salt deviceminion salt_proxy.is_running p8000
salt.modules.salt_version Access Salt's elemental release code-names.
Salt's feature release schedule is based on the Periodic Table, as described in the Version Numbers documentation.
When a feature was added (or removed) in a specific release, it can be difficult to build out future-proof functionality that is dependent on a naming scheme that moves.
For example, a state syntax needs to change to support an option that will be removed in the future, but there are many Minion versions in use across an infrastructure. It would be handy to use some Jinja syntax to check for these instances to perform one state syntax over another.
A simple example might be something like the following:
{# a boolean check #} {% set option_deprecated = salt['salt_version.less_than']("3001") %}
{% if option_deprecated %} <use old syntax> {% else %} <use new syntax> {% endif %}
salt.modules.salt_version.equal(name) Returns a boolean (True) if the minion's current version code name matches the named version.
name   The release code name to check the version against.
salt '*' salt_version.equal 'Oxygen'
salt.modules.salt_version.get_release_number(name) Returns the release number of a given release code name in a MAJOR.PATCH format.
If the release name has not been given an assigned release number, the function returns a string. If the release cannot be found, it returns None.
name   The release code name for which to find a release number.
salt '*' salt_version.get_release_number 'Oxygen'
salt.modules.salt_version.greater_than(name) Returns a boolean (True) if the minion's current version code name is greater than the named version.
salt '*' salt_version.greater_than 'Oxygen'
salt.modules.salt_version.less_than(name) Returns a boolean (True) if the minion's current version code name is less than the named version.
salt '*' salt_version.less_than 'Oxygen'
salt.modules.saltcheck A module for testing the logic of states and highstates on salt minions
codeauthor William Cannon <william.cannon@gmail.com>
Saltcheck provides unittest like functionality requiring only the knowledge of salt module execution and yaml. Saltcheck uses salt modules to return data, then runs an assertion against that return. This allows for testing with all the features included in salt modules.