text stringlengths 81 112k |
|---|
Signal the minion to refresh the pillar data.
.. versionchanged:: Neon
The ``async`` argument has been added. The default value is True.
CLI Example:
.. code-block:: bash
salt '*' saltutil.refresh_pillar
salt '*' saltutil.refresh_pillar async=False
def refresh_pillar(**kwargs):
... |
If the named function is running return the data associated with it/them.
The argument can be a glob
CLI Example:
.. code-block:: bash
salt '*' saltutil.is_running state.highstate
def is_running(fun):
'''
If the named function is running return the data associated with it/them.
The a... |
Forcibly removes all caches on a minion.
.. versionadded:: 2014.7.0
WARNING: The safest way to clear a minion cache is by first stopping
the minion and then deleting the cache files before restarting it.
CLI Example:
.. code-block:: bash
salt '*' saltutil.clear_cache days=7
def clear_c... |
Forcibly removes job cache folders and files on a minion.
.. versionadded:: 2018.3.0
WARNING: The safest way to clear a minion cache is by first stopping
the minion and then deleting the cache files before restarting it.
CLI Example:
.. code-block:: bash
salt '*' saltutil.clear_job_cach... |
Return the data for a specific cached job id. Note this only works if
cache_jobs has previously been set to True on the minion.
CLI Example:
.. code-block:: bash
salt '*' saltutil.find_cached_job <job id>
def find_cached_job(jid):
'''
Return the data for a specific cached job id. Note th... |
Sends a signal to the named salt job's process
CLI Example:
.. code-block:: bash
salt '*' saltutil.signal_job <job id> 15
def signal_job(jid, sig):
'''
Sends a signal to the named salt job's process
CLI Example:
.. code-block:: bash
salt '*' saltutil.signal_job <job id> 15... |
Sends a termination signal (SIGTERM 15) to all currently running jobs
CLI Example:
.. code-block:: bash
salt '*' saltutil.term_all_jobs
def term_all_jobs():
'''
Sends a termination signal (SIGTERM 15) to all currently running jobs
CLI Example:
.. code-block:: bash
salt '*'... |
Sends a kill signal (SIGKILL 9) to all currently running jobs
CLI Example:
.. code-block:: bash
salt '*' saltutil.kill_all_jobs
def kill_all_jobs():
'''
Sends a kill signal (SIGKILL 9) to all currently running jobs
CLI Example:
.. code-block:: bash
salt '*' saltutil.kill_a... |
Used to regenerate the minion keys.
CLI Example:
.. code-block:: bash
salt '*' saltutil.regen_keys
def regen_keys():
'''
Used to regenerate the minion keys.
CLI Example:
.. code-block:: bash
salt '*' saltutil.regen_keys
'''
for fn_ in os.listdir(__opts__['pki_dir']... |
The minion sends a request to the master to revoke its own key.
Note that the minion session will be revoked and the minion may
not be able to return the result of this command back to the master.
If the 'preserve_minion_cache' flag is set to True, the master
cache for this minion will not be removed.
... |
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Assuming this minion is a master, execute a salt command
CLI Example:
.. code-block:: bash
salt '*' saltutil.cmd
def cmd(tgt,
fun,
a... |
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Assuming this minion is a master, execute a salt command
CLI Example:
.. code-block:: bash
salt '*' saltutil.cmd_iter
def cmd_iter(tgt,
... |
Execute a runner function. This function must be run on the master,
either by targeting a minion running on a master or by using
salt-call on a master.
.. versionadded:: 2014.7.0
name
The name of the function to run
kwargs
Any keyword arguments to pass to the runner function
... |
Execute a wheel module and function. This function must be run against a
minion that is local to the master.
.. versionadded:: 2014.7.0
name
The name of the function to run
args
Any positional arguments to pass to the wheel function. A common example
of this would be the ``mat... |
Loads minion modules from an environment so that they can be used in pillars
for that environment
CLI Example:
.. code-block:: bash
salt '*' saltutil.mmodule base test.ping
def mmodule(saltenv, fun, *args, **kwargs):
'''
Loads minion modules from an environment so that they can be used i... |
Create a session to be used when connecting to Zenoss.
def _session():
'''
Create a session to be used when connecting to Zenoss.
'''
config = __salt__['config.option']('zenoss')
session = requests.session()
session.auth = (config.get('username'), config.get('password'))
session.verify = F... |
Make a request to the Zenoss API router
def _router_request(router, method, data=None):
'''
Make a request to the Zenoss API router
'''
if router not in ROUTERS:
return False
req_data = salt.utils.json.dumps([dict(
action=router,
method=method,
data=data,
ty... |
Find a device in Zenoss. If device not found, returns None.
Parameters:
device: (Optional) Will use the grain 'fqdn' by default
CLI Example:
salt '*' zenoss.find_device
def find_device(device=None):
'''
Find a device in Zenoss. If device not found, returns None.
Parameter... |
A function to connect to a zenoss server and add a new device entry.
Parameters:
device: (Optional) Will use the grain 'fqdn' by default.
device_class: (Optional) The device class to use. If none, will determine based on kernel grain.
collector: (Optional) The collector to us... |
A function to set the prod_state in zenoss.
Parameters:
prod_state: (Required) Integer value of the state
device: (Optional) Will use the grain 'fqdn' by default.
CLI Example:
salt zenoss.set_prod_state 1000 hostname
def set_prod_state(prod_state, device=None):
'''
... |
Filters file path against unwanted directories and decides whether file is marked as deleted.
Returns:
True if file is desired deleted file, else False.
Args:
path: A string - path to file
def _valid_deleted_file(path):
'''
Filters file path against unwanted directories and decides wh... |
Iterates over /proc/PID/maps and /proc/PID/fd links and returns list of desired deleted files.
Returns:
List of deleted files to analyze, False on failure.
def _deleted_files():
'''
Iterates over /proc/PID/maps and /proc/PID/fd links and returns list of desired deleted files.
Returns:
... |
Formats the output of the restartcheck module.
Returns:
String - formatted output.
Args:
kernel_restart: indicates that newer kernel is instaled
packages: list of packages that should be restarted
verbose: enables extensive output
restartable: list of restartable packag... |
Last installed kernel name, for Debian based systems.
Returns:
List with possible names of last installed kernel
as they are probably interpreted in output of `uname -a` command.
def _kernel_versions_debian():
'''
Last installed kernel name, for Debian based systems.
Returns:
... |
Name of the last installed kernel, for Red Hat based systems.
Returns:
List with name of last installed kernel as it is interpreted in output of `uname -a` command.
def _kernel_versions_redhat():
'''
Name of the last installed kernel, for Red Hat based systems.
Returns:
List w... |
Last installed kernel name, for Debian based systems.
Returns:
List with possible names of last installed kernel
as they are probably interpreted in output of `uname -a` command.
def _kernel_versions_nilrt():
'''
Last installed kernel name, for Debian based systems.
Returns:
... |
Name of the last installed kernel, for Red Hat based systems.
Returns:
List with name of last installed kernel as it is interpreted in output of `uname -a` command.
def _check_timeout(start_time, timeout):
'''
Name of the last installed kernel, for Red Hat based systems.
Returns:
... |
Detect whether a file changed in an NILinuxRT system using md5sum and timestamp
files from a state directory.
Returns:
- False if md5sum/timestamp state files don't exist
- True/False depending if ``base_filename`` got modified/touched
def _file_changed_nilrt(full_filepath):
'''
... |
Besides the normal Linux kernel driver interfaces, NILinuxRT-supported hardware features an
extensible, plugin-based device enumeration and configuration interface named "System API".
When an installed package is extending the API it is very hard to know all repercurssions and
actions to be taken, so reboot... |
Analyzes files openeded by running processes and seeks for packages which need to be restarted.
Args:
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, ... |
Configures the default VSAN policy on a vCenter.
The state assumes there is only one default VSAN policy on a vCenter.
policy
Dict representation of a policy
def default_vsan_policy_configured(name, policy):
'''
Configures the default VSAN policy on a vCenter.
The state assumes there is on... |
Assigns a default storage policy to a datastore
policy
Name of storage policy
datastore
Name of datastore
def default_storage_policy_assigned(name, policy, datastore):
'''
Assigns a default storage policy to a datastore
policy
Name of storage policy
datastore
... |
Return a cloud client
def _get_client():
'''
Return a cloud client
'''
client = salt.cloud.CloudClient(
os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),
pillars=copy.deepcopy(__pillar__.get('cloud', {}))
)
return client |
Return true if the instance is found on a provider
CLI Example:
.. code-block:: bash
salt minionname cloud.has_instance myinstance
def has_instance(name, provider=None):
'''
Return true if the instance is found on a provider
CLI Example:
.. code-block:: bash
salt minionnam... |
Return details on an instance.
Similar to the cloud action show_instance
but returns only the instance details.
CLI Example:
.. code-block:: bash
salt minionname cloud.get_instance myinstance
SLS Example:
.. code-block:: bash
{{ salt['cloud.get_instance']('myinstance')['ma... |
Spin up an instance using Salt Cloud
CLI Example:
.. code-block:: bash
salt minionname cloud.profile my-gce-config myinstance
def profile_(profile, names, vm_overrides=None, opts=None, **kwargs):
'''
Spin up an instance using Salt Cloud
CLI Example:
.. code-block:: bash
sa... |
Execute a salt cloud map file
Cloud Map data can be retrieved from several sources:
- a local file (provide the path to the file to the 'path' argument)
- a JSON-formatted map directly (provide the appropriately formatted to using the 'map_data' argument)
- the Salt Pillar (provide the map name of und... |
Execute a single action on the given provider/instance
CLI Example:
.. code-block:: bash
salt minionname cloud.action start instance=myinstance
salt minionname cloud.action stop instance=myinstance
salt minionname cloud.action show_image provider=my-ec2-config image=ami-1624987f
def ... |
Create an instance using Salt Cloud
CLI Example:
.. code-block:: bash
salt minionname cloud.create my-ec2-config myinstance image=ami-1624987f size='t1.micro' ssh_username=ec2-user securitygroup=default delvol_on_destroy=True
def create(provider, names, opts=None, **kwargs):
'''
Create an in... |
List block storage volumes
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_list my-nova
def volume_list(provider):
'''
List block storage volumes
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_list my-nova
'''
client = _get_client()
... |
Attach volume to a server
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_attach my-nova myblock server_name=myserver device='/dev/xvdf'
def volume_attach(provider, names, **kwargs):
'''
Attach volume to a server
CLI Example:
.. code-block:: bash
salt minion... |
List private networks
CLI Example:
.. code-block:: bash
salt minionname cloud.network_list my-nova
def network_list(provider):
'''
List private networks
CLI Example:
.. code-block:: bash
salt minionname cloud.network_list my-nova
'''
client = _get_client()
ret... |
Create private network
CLI Example:
.. code-block:: bash
salt minionname cloud.network_create my-nova names=['salt'] cidr='192.168.100.0/24'
def network_create(provider, names, **kwargs):
'''
Create private network
CLI Example:
.. code-block:: bash
salt minionname cloud.ne... |
List virtual interfaces on a server
CLI Example:
.. code-block:: bash
salt minionname cloud.virtual_interface_list my-nova names=['salt-master']
def virtual_interface_list(provider, names, **kwargs):
'''
List virtual interfaces on a server
CLI Example:
.. code-block:: bash
... |
Attach private interfaces to a server
CLI Example:
.. code-block:: bash
salt minionname cloud.virtual_interface_create my-nova names=['salt-master'] net_name='salt'
def virtual_interface_create(provider, names, **kwargs):
'''
Attach private interfaces to a server
CLI Example:
.. co... |
Return a list of sysctl parameters for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.show
def show(config_file=False):
'''
Return a list of sysctl parameters for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.show
'''
roots = (
... |
Return a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.get hw.physmem
def get(name):
'''
Return a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.get hw.physmem
'''
cmd = 'sysctl ... |
Assign and persist a simple sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.persist net.inet.icmp.icmplim 50
def persist(name, value, config='/etc/sysctl.conf'):
'''
Assign and persist a simple sysctl parameter for this minion
CLI Example:
.. code... |
Send a message to a PushOver channel.
.. code-block:: yaml
pushover-message:
pushover.post_message:
- user: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- title: Salt Returner
- device: phone
- priority: -1
... |
Check if address is a valid IP. returns True if valid, otherwise False.
CLI Example:
.. code-block:: bash
salt ns1 dig.check_ip 127.0.0.1
salt ns1 dig.check_ip 1111:2222:3333:4444:5555:6666:7777:8888
def check_ip(addr):
'''
Check if address is a valid IP. returns True if valid, other... |
Return the AAAA record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.AAAA www.google.com
def AAAA(host, nameserver=None):
'''
Return the AAAA record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ... |
Return a list of IPs of the nameservers for ``domain``
If ``resolve`` is False, don't resolve names.
CLI Example:
.. code-block:: bash
salt ns1 dig.NS google.com
def NS(domain, resolve=True, nameserver=None):
'''
Return a list of IPs of the nameservers for ``domain``
If ``resolve``... |
Return the allowed IPv4 ranges in the SPF record for ``domain``.
If record is ``SPF`` and the SPF record is empty, the TXT record will be
searched automatically. If you know the domain uses TXT and not SPF,
specifying that will save a lookup.
CLI Example:
.. code-block:: bash
salt ns1 di... |
Return a list of lists for the MX of ``domain``.
If the ``resolve`` argument is True, resolve IPs for the servers.
It's limited to one IP, because although in practice it's very rarely a
round robin, it is an acceptable configuration and pulling just one IP lets
the data be similar to the non-resolved... |
Return the TXT record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.TXT google.com
def TXT(host, nameserver=None):
'''
Return the TXT record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.... |
Return a list of sysctl parameters for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.show
def show(config_file=False):
'''
Return a list of sysctl parameters for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.show
'''
roots = (
... |
Assign a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.assign net.inet.icmp.icmplim 50
def assign(name, value):
'''
Assign a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.assign net.ine... |
Assign and persist a simple sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.persist net.inet.icmp.icmplim 50
salt '*' sysctl.persist coretemp_load NO config=/boot/loader.conf
def persist(name, value, config='/etc/sysctl.conf'):
'''
Assign and persis... |
Recursively workout the file name from an augeas change
def _workout_filename(filename):
'''
Recursively workout the file name from an augeas change
'''
if os.path.isfile(filename) or filename == '/':
if filename == '/':
filename = None
return filename
else:
retu... |
Ensure all changes are fully qualified and affect only one file.
This ensures that the diff output works and a state change is not
incorrectly reported.
def _check_filepath(changes):
'''
Ensure all changes are fully qualified and affect only one file.
This ensures that the diff output works and a s... |
.. versionadded:: 2014.7.0
This state replaces :py:func:`~salt.states.augeas.setvalue`.
Issue changes to Augeas, optionally for a specific context, with a
specific lens.
name
State name
context
A file path, prefixed by ``/files``. Should resolve to an actual file
(not an ... |
Returns an instance of the redis client
def _connect(host=None, port=None, db=None, password=None):
'''
Returns an instance of the redis client
'''
if not host:
host = __salt__['config.option']('redis.host')
if not port:
port = __salt__['config.option']('redis.port')
if not db:
... |
Returns an instance of the redis client
def _sconnect(host=None, port=None, password=None):
'''
Returns an instance of the redis client
'''
if host is None:
host = __salt__['config.option']('redis_sentinel.host', 'localhost')
if port is None:
port = __salt__['config.option']('redis_... |
Asynchronously rewrite the append-only file
CLI Example:
.. code-block:: bash
salt '*' redis.bgrewriteaof
def bgrewriteaof(host=None, port=None, db=None, password=None):
'''
Asynchronously rewrite the append-only file
CLI Example:
.. code-block:: bash
salt '*' redis.bgrewr... |
Asynchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.bgsave
def bgsave(host=None, port=None, db=None, password=None):
'''
Asynchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.bgsave
'''
server ... |
Get redis server configuration values
CLI Example:
.. code-block:: bash
salt '*' redis.config_get
salt '*' redis.config_get port
def config_get(pattern='*', host=None, port=None, db=None, password=None):
'''
Get redis server configuration values
CLI Example:
.. code-block::... |
Set redis server configuration values
CLI Example:
.. code-block:: bash
salt '*' redis.config_set masterauth luv_kittens
def config_set(name, value, host=None, port=None, db=None, password=None):
'''
Set redis server configuration values
CLI Example:
.. code-block:: bash
s... |
Return the number of keys in the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.dbsize
def dbsize(host=None, port=None, db=None, password=None):
'''
Return the number of keys in the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.dbsi... |
Deletes the keys from redis, returns number of keys deleted
CLI Example:
.. code-block:: bash
salt '*' redis.delete foo
def delete(*keys, **connection_args):
'''
Deletes the keys from redis, returns number of keys deleted
CLI Example:
.. code-block:: bash
salt '*' redis.de... |
Return true if the key exists in redis
CLI Example:
.. code-block:: bash
salt '*' redis.exists foo
def exists(key, host=None, port=None, db=None, password=None):
'''
Return true if the key exists in redis
CLI Example:
.. code-block:: bash
salt '*' redis.exists foo
'''
... |
Set a keys time to live in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.expire foo 300
def expire(key, seconds, host=None, port=None, db=None, password=None):
'''
Set a keys time to live in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.expire foo 300... |
Set a keys expire at given UNIX time
CLI Example:
.. code-block:: bash
salt '*' redis.expireat foo 1400000000
def expireat(key, timestamp, host=None, port=None, db=None, password=None):
'''
Set a keys expire at given UNIX time
CLI Example:
.. code-block:: bash
salt '*' red... |
Remove all keys from all databases
CLI Example:
.. code-block:: bash
salt '*' redis.flushall
def flushall(host=None, port=None, db=None, password=None):
'''
Remove all keys from all databases
CLI Example:
.. code-block:: bash
salt '*' redis.flushall
'''
server = _c... |
Remove all keys from the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.flushdb
def flushdb(host=None, port=None, db=None, password=None):
'''
Remove all keys from the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.flushdb
'''
... |
Get redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.get_key foo
def get_key(key, host=None, port=None, db=None, password=None):
'''
Get redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.get_key foo
'''
server = _connect(host, port, d... |
Determine if a hash fields exists.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hexists foo_hash bar_field
def hexists(key, field, host=None, port=None, db=None, password=None):
'''
Determine if a hash fields exists.
.. versionadded:: 2017.7.0
CL... |
Get all fields and values from a redis hash, returns dict
CLI Example:
.. code-block:: bash
salt '*' redis.hgetall foo_hash
def hgetall(key, host=None, port=None, db=None, password=None):
'''
Get all fields and values from a redis hash, returns dict
CLI Example:
.. code-block:: bas... |
Increment the integer value of a hash field by the given number.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hincrby foo_hash bar_field 5
def hincrby(key, field, increment=1, host=None, port=None, db=None, password=None):
'''
Increment the integer value o... |
Returns number of fields of a hash.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hlen foo_hash
def hlen(key, host=None, port=None, db=None, password=None):
'''
Returns number of fields of a hash.
.. versionadded:: 2017.7.0
CLI Example:
.. co... |
Returns the values of all the given hash fields.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hmget foo_hash bar_field1 bar_field2
def hmget(key, *fields, **options):
'''
Returns the values of all the given hash fields.
.. versionadded:: 2017.7.0
... |
Sets multiple hash fields to multiple values.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hmset foo_hash bar_field1=bar_value1 bar_field2=bar_value2
def hmset(key, **fieldsvals):
'''
Sets multiple hash fields to multiple values.
.. versionadded:: 201... |
Set the value of a hash field.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hset foo_hash bar_field bar_value
def hset(key, field, value, host=None, port=None, db=None, password=None):
'''
Set the value of a hash field.
.. versionadded:: 2017.7.0
... |
Return all the values in a hash.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hvals foo_hash bar_field1 bar_value1
def hvals(key, host=None, port=None, db=None, password=None):
'''
Return all the values in a hash.
.. versionadded:: 2017.7.0
CLI E... |
Incrementally iterate hash fields and associated values.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hscan foo_hash match='field_prefix_*' count=1
def hscan(key, cursor=0, match=None, count=None, host=None, port=None, db=None, password=None):
'''
Incremen... |
Get information and statistics about the server
CLI Example:
.. code-block:: bash
salt '*' redis.info
def info(host=None, port=None, db=None, password=None):
'''
Get information and statistics about the server
CLI Example:
.. code-block:: bash
salt '*' redis.info
'''
... |
Get redis keys, supports glob style patterns
CLI Example:
.. code-block:: bash
salt '*' redis.keys
salt '*' redis.keys test*
def keys(pattern='*', host=None, port=None, db=None, password=None):
'''
Get redis keys, supports glob style patterns
CLI Example:
.. code-block:: ba... |
Get redis key type
CLI Example:
.. code-block:: bash
salt '*' redis.type foo
def key_type(key, host=None, port=None, db=None, password=None):
'''
Get redis key type
CLI Example:
.. code-block:: bash
salt '*' redis.type foo
'''
server = _connect(host, port, db, pass... |
Get the UNIX time in seconds of the last successful save to disk
CLI Example:
.. code-block:: bash
salt '*' redis.lastsave
def lastsave(host=None, port=None, db=None, password=None):
'''
Get the UNIX time in seconds of the last successful save to disk
CLI Example:
.. code-block:: b... |
Get the length of a list in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.llen foo_list
def llen(key, host=None, port=None, db=None, password=None):
'''
Get the length of a list in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.llen foo_list
'''
se... |
Ping the server, returns False on connection errors
CLI Example:
.. code-block:: bash
salt '*' redis.ping
def ping(host=None, port=None, db=None, password=None):
'''
Ping the server, returns False on connection errors
CLI Example:
.. code-block:: bash
salt '*' redis.ping
... |
Synchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.save
def save(host=None, port=None, db=None, password=None):
'''
Synchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.save
'''
server = _conne... |
Set redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.set_key foo bar
def set_key(key, value, host=None, port=None, db=None, password=None):
'''
Set redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.set_key foo bar
'''
server = _connec... |
Synchronously save the dataset to disk and then shut down the server
CLI Example:
.. code-block:: bash
salt '*' redis.shutdown
def shutdown(host=None, port=None, db=None, password=None):
'''
Synchronously save the dataset to disk and then shut down the server
CLI Example:
.. code-b... |
Make the server a slave of another instance, or promote it as master
CLI Example:
.. code-block:: bash
# 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 '*' r... |
Get members in a Redis set
CLI Example:
.. code-block:: bash
salt '*' redis.smembers foo_set
def smembers(key, host=None, port=None, db=None, password=None):
'''
Get members in a Redis set
CLI Example:
.. code-block:: bash
salt '*' redis.smembers foo_set
'''
server... |
Return the current server UNIX time in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.time
def time(host=None, port=None, db=None, password=None):
'''
Return the current server UNIX time in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.time
'''
... |
Get the length of a sorted set in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.zcard foo_sorted
def zcard(key, host=None, port=None, db=None, password=None):
'''
Get the length of a sorted set in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.zcard foo_so... |
Get a range of values from a sorted set in Redis by index
CLI Example:
.. code-block:: bash
salt '*' redis.zrange foo_sorted 0 10
def 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
CLI Example:
.... |
Get ip for sentinel master
.. versionadded: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' redis.sentinel_get_master_ip 'mymaster'
def sentinel_get_master_ip(master, host=None, port=None, password=None):
'''
Get ip for sentinel master
.. versionadded: 2016.3.0
CLI Example... |
Get host information about slave
.. versionadded: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' redis.get_master_ip
def get_master_ip(host=None, port=None, password=None):
'''
Get host information about slave
.. versionadded: 2016.3.0
CLI Example:
.. code-block:: ba... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.