salt.modules.sdb
Module for Manipulating Data via the Salt DB API
-
Delete a value from a db, using a uri in the form of
sdb://<profile>/<key>
. If the uri provided does not start withsdb://
or the value is not successfully deleted, returnFalse
.CLI Example:
salt '*' sdb.delete sdb://mymemcached/foo
salt.modules.sdb.delete(uri)
-
Get a value from a db, using a uri in the form of
sdb://<profile>/<key>
. If the uri provided is not valid, then it will be returned as-is, unlessstrict=True
was passed.CLI Example:
salt '*' sdb.get sdb://mymemcached/foo strict=True
salt.modules.sdb.get(uri, strict=False)
-
Perform a one-time generation of a hash and write it to sdb. If that value has already been set return the value instead.
This is useful for generating passwords or keys that are specific to multiple minions that need to be stored somewhere centrally.
State Example:
some_mysql_user: mysql_user: - present - host: localhost - password: '{{ salt['sdb.get_or_set_hash']('some_mysql_user_pass') }}'
CLI Example:
salt '*' sdb.get_or_set_hash 'SECRET_KEY' 50
Warning
This function could return strings which may contain characters which are reserved as directives by the YAML parser, such as strings beginning with
%
. To avoid issues when using the output of this function in an SLS file containing YAML+Jinja, surround the call with single quotes.
salt.modules.sdb.get_or_set_hash(uri, length=8, chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)')
-
Set a value in a db, using a uri in the form of
sdb://<profile>/<key>
. If the uri provided does not start withsdb://
or the value is not successfully set, returnFalse
.CLI Example:
salt '*' sdb.set sdb://mymemcached/foo bar
salt.modules.sdb.set_(uri, value)
© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.sdb.html