neulab/tldr huggingface dataset:
salt '*' glusterfs.status myvolume
salt.modules.glusterfs.stop_volume(name, force=False) Stop a gluster volume
force  Force stop the volume
salt '*' glusterfs.stop_volume mycluster
salt.modules.glusterfs.unset_quota_volume(name, path) Unset quota on glusterfs volume
path   Folder path for restriction in volume
salt '*' glusterfs.unset_quota_volume <volume> <path>
salt.modules.gnomedesktop GNOME implementations
salt.modules.gnomedesktop.get(schema=None, key=None, user=None, **kwargs) Get key in a particular GNOME schema
salt '*' gnome.get user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled
salt.modules.gnomedesktop.getClockFormat(**kwargs) Return the current clock format, either 12h or 24h format.
salt '*' gnome.getClockFormat user=<username>
salt.modules.gnomedesktop.getClockShowDate(**kwargs) Return the current setting, if the date is shown in the clock
salt '*' gnome.getClockShowDate user=<username>
salt.modules.gnomedesktop.getIdleActivation(**kwargs) Get whether the idle activation is enabled
salt '*' gnome.getIdleActivation user=<username>
salt.modules.gnomedesktop.getIdleDelay(**kwargs) Return the current idle delay setting in seconds
salt '*' gnome.getIdleDelay user=<username>
salt.modules.gnomedesktop.ping(**kwargs) A test to ensure the GNOME module is loaded
salt '*' gnome.ping user=<username>
salt.modules.gnomedesktop.setClockFormat(clockFormat, **kwargs) Set the clock format, either 12h or 24h format.
salt '*' gnome.setClockFormat <12h|24h> user=<username>
salt.modules.gnomedesktop.setClockShowDate(kvalue, **kwargs) Set whether the date is visible in the clock
salt '*' gnome.setClockShowDate <True|False> user=<username>
salt.modules.gnomedesktop.setIdleActivation(kvalue, **kwargs) Set whether the idle activation is enabled
salt '*' gnome.setIdleActivation <True|False> user=<username>
salt.modules.gnomedesktop.setIdleDelay(delaySeconds, **kwargs) Set the current idle delay setting in seconds
salt '*' gnome.setIdleDelay <seconds> user=<username>
salt.modules.gnomedesktop.set_(schema=None, key=None, user=None, value=None, **kwargs) Set key in a particular GNOME schema
salt '*' gnome.set user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled value=False
salt.modules.google_chat Module for sending messages to google chat.
To use this module you need to configure a webhook in the google chat room where you would like the message to be sent, see: https://developers.google.com/hangouts/chat/how-tos/webhooks
salt.modules.google_chat.send_message(url, message) Send a message to the google chat room specified in the webhook url.
salt '*' google_chat.send_message "https://chat.googleapis.com/v1/spaces/example_space/messages?key=example_key" "This is a test message"
salt.modules.gpg Manage a GPG keychains, add keys, create keys, retrieve keys from keyservers.  Sign, encrypt and sign plus encrypt text and files.
NOTE: The python-gnupg library and gpg binary are required to be installed.
salt.modules.gpg.create_key(key_type='RSA', key_length=1024, name_real='Autogenerated Key', name_comment='Generated by SaltStack', name_email=None, subkey_type=None, subkey_length=None, expire_date=None, use_passphrase=False, user=None, gnupghome=None) Create a key in the GPG keychain
NOTE: GPG key generation requires a lot of entropy and randomness. Difficult to do over a remote connection, consider having another process available which is generating randomness for the machine.  Also especially difficult on virtual machines, consider the rng-tools package.
The create_key process takes awhile so increasing the timeout may be necessary, e.g. -t 15.
key_type The type of the primary key to generate. It must be capable of signing.  'RSA' or 'DSA'.
key_length The length of the primary key in bits.
name_real The real name of the user identity which is represented by the key.
name_comment A comment to attach to the user id.
name_email An email address for the user.
subkey_type The type of the secondary key to generate.
subkey_length The length of the secondary key in bits.
expire_date The expiration date for the primary and any secondary key. You can specify an ISO date, A number of days/weeks/months/years, an epoch value, or 0 for a non-expiring key.
use_passphrase Whether to use a passphrase with the signing key. Passphrase is received from Pillar.
user   Which user's keychain to access, defaults to user Salt is running as.  Passing the user as salt will set the GnuPG home directory to the /etc/salt/gpgkeys.
gnupghome Specify the location where GPG keyring and related files are stored.
salt -t 15 '*' gpg.create_key
salt.modules.gpg.decrypt(user=None, text=None, filename=None, output=None, use_passphrase=False, gnupghome=None, bare=False) Decrypt a message or file
text   The encrypted text to decrypt.
filename The encrypted filename to decrypt.
output The filename where the decrypted data will be written, default is standard out.
bare   If True, return the (armored) decrypted block as a string without the standard comment/res dict.
salt '*' gpg.decrypt filename='/path/to/important.file.gpg'
salt '*' gpg.decrypt filename='/path/to/important.file.gpg' use_passphrase=True
salt.modules.gpg.delete_key(keyid=None, fingerprint=None, delete_secret=False, user=None, gnupghome=None, use_passphrase=True) Get a key from the GPG keychain
keyid  The keyid of the key to be deleted.
fingerprint The fingerprint of the key to be deleted.
delete_secret Whether to delete a corresponding secret key prior to deleting the public key.  Secret keys must be deleted before deleting any corresponding public keys.
salt '*' gpg.delete_key keyid=3FAD9F1E
salt '*' gpg.delete_key fingerprint=53C96788253E58416D20BCD352952C84C3252192
salt '*' gpg.delete_key keyid=3FAD9F1E user=username
salt '*' gpg.delete_key keyid=3FAD9F1E user=username delete_secret=True
salt.modules.gpg.encrypt(user=None, recipients=None, text=None, filename=None, output=None, sign=None, use_passphrase=False, gnupghome=None, bare=False) Encrypt a message or file
recipients The fingerprints for those recipient whom the data is being encrypted for.
text   The text to encrypt.
filename The filename to encrypt.
output The filename where the signed file will be written, default is standard out.
sign   Whether to sign, in addition to encrypt, the data. True to use default key or fingerprint to specify a different key to sign with.
bare   If True, return the (armored) encrypted block as a string without the standard comment/res dict.
salt '*' gpg.encrypt text='Hello there.  How are you?' recipients=recipient@example.com
salt '*' gpg.encrypt filename='/path/to/important.file' recipients=recipient@example.com
salt '*' gpg.encrypt filename='/path/to/important.file' use_passphrase=True \ recipients=recipient@example.com
salt.modules.gpg.export_key(keyids=None, secret=False, user=None, gnupghome=None, use_passphrase=False) Export a key from the GPG keychain
keyids The key ID(s) of the key(s) to be exported. Can be specified as a comma separated string or a list. Anything which GnuPG itself accepts to identify a key - for example, the key ID or the fingerprint could be used.
secret Export the secret key identified by the keyids information passed.
salt '*' gpg.export_key keyids=3FAD9F1E
salt '*' gpg.export_key keyids=3FAD9F1E secret=True
salt '*' gpg.export_key keyids="['3FAD9F1E','3FBD8F1E']" user=username
salt.modules.gpg.get_key(keyid=None, fingerprint=None, user=None, gnupghome=None) Get a key from the GPG keychain
keyid  The key ID (short or long) of the key to be retrieved.
fingerprint The fingerprint of the key to be retrieved.
salt '*' gpg.get_key keyid=3FAD9F1E
salt '*' gpg.get_key fingerprint=53C96788253E58416D20BCD352952C84C3252192
salt '*' gpg.get_key keyid=3FAD9F1E user=username
salt.modules.gpg.get_secret_key(keyid=None, fingerprint=None, user=None, gnupghome=None) Get a key from the GPG keychain
salt '*' gpg.get_secret_key keyid=3FAD9F1E
salt '*' gpg.get_secret_key fingerprint=53C96788253E58416D20BCD352952C84C3252192
salt '*' gpg.get_secret_key keyid=3FAD9F1E user=username
salt.modules.gpg.import_key(text=None, filename=None, user=None, gnupghome=None) Import a key from text or file
text   The text containing to import.
filename The filename containing the key to import.
salt '*' gpg.import_key text='-----BEGIN PGP PUBLIC KEY BLOCK-----\n ... -----END PGP PUBLIC KEY BLOCK-----' salt '*' gpg.import_key filename='/path/to/public-key-file'
salt.modules.gpg.list_keys(user=None, gnupghome=None) List keys in GPG keychain
salt '*' gpg.list_keys
salt.modules.gpg.list_secret_keys(user=None, gnupghome=None) List secret keys in GPG keychain
salt '*' gpg.list_secret_keys
salt.modules.gpg.receive_keys(keyserver=None, keys=None, user=None, gnupghome=None) Receive key(s) from keyserver and add them to keychain
keyserver Keyserver to use for searching for GPG keys, defaults to pgp.mit.edu
keys   The keyID(s) to retrieve from the keyserver.  Can be specified as a comma separated string or a list.
salt '*' gpg.receive_keys keys='3FAD9F1E'
salt '*' gpg.receive_keys keys="['3FAD9F1E','3FBD9F2E']"
salt '*' gpg.receive_keys keys=3FAD9F1E user=username
salt.modules.gpg.search_keys(text, keyserver=None, user=None) Search keys from keyserver
text   Text to search the keyserver for, e.g. email address, keyID or fingerprint.
keyserver Keyserver to use for searching for GPG keys, defaults to pgp.mit.edu.
salt '*' gpg.search_keys user@example.com
salt '*' gpg.search_keys user@example.com keyserver=keyserver.ubuntu.com
salt '*' gpg.search_keys user@example.com keyserver=keyserver.ubuntu.com user=username
salt.modules.gpg.sign(user=None, keyid=None, text=None, filename=None, output=None, use_passphrase=False, gnupghome=None) Sign message or file
keyid  The keyid of the key to set the trust level for, defaults to first key in the secret keyring.
text   The text to sign.
filename The filename to sign.
salt '*' gpg.sign text='Hello there.  How are you?'
salt '*' gpg.sign filename='/path/to/important.file'
salt '*' gpg.sign filename='/path/to/important.file' use_passphrase=True
salt.modules.gpg.trust_key(keyid=None, fingerprint=None, trust_level=None, user=None) Set the trust level for a key in GPG keychain
keyid  The keyid of the key to set the trust level for.
fingerprint The fingerprint of the key to set the trust level for.
trust_level The trust level to set for the specified key, must be one of the following: expired, unknown, not_trusted, marginally, fully, ultimately
salt '*' gpg.trust_key keyid='3FAD9F1E' trust_level='marginally' salt '*' gpg.trust_key fingerprint='53C96788253E58416D20BCD352952C84C3252192' trust_level='not_trusted' salt '*' gpg.trust_key keys=3FAD9F1E trust_level='ultimately' user='username'
salt.modules.gpg.verify(text=None, user=None, filename=None, gnupghome=None, signature=None, trustmodel=None) Verify a message or file
text   The text to verify.
filename The filename to verify.
signature Specify the filename of a detached signature.
trustmodel
Explicitly define the used trust model. One of:
• pgp
• classic
• tofu
• tofu+pgp
• direct
• always
• auto
salt '*' gpg.verify text='Hello there.  How are you?' salt '*' gpg.verify filename='/path/to/important.file' salt '*' gpg.verify filename='/path/to/important.file' use_passphrase=True salt '*' gpg.verify filename='/path/to/important.file' trustmodel=direct
salt.modules.grafana4 Module for working with the Grafana v4 API
configuration This module requires a configuration profile to be configured in the minion config, minion pillar, or master config.  The module will use the 'grafana' key by default, if defined.
grafana: grafana_url: http://grafana.localhost grafana_user: admin grafana_password: admin grafana_timeout: 3
salt.modules.grafana4.create_datasource(orgname=None, profile='grafana', **kwargs) Create a new datasource in an organisation.
name   Name of the data source.
type   Type of the datasource ('graphite', 'influxdb' etc.).
access Use proxy or direct.
url    The URL to the data source API.
user   Optional - user to authenticate with the data source.
password Optional - password to authenticate with the data source.
database Optional - database to use with the data source.
basicAuth Optional - set to True to use HTTP basic auth to authenticate with the data source.
basicAuthUser Optional - HTTP basic auth username.
basicAuthPassword Optional - HTTP basic auth password.
jsonData Optional - additional json data to post (eg. "timeInterval").
isDefault Optional - set data source as default.
withCredentials Optional - Whether credentials such as cookies or auth headers should be sent with cross-site requests.
typeLogoUrl Optional - Logo to use for this datasource.
orgname Name of the organization in which the data source should be created.
profile Configuration profile used to connect to the Grafana instance.  Default is 'grafana'.
salt '*' grafana4.create_datasource
salt.modules.grafana4.create_org(profile='grafana', **kwargs) Create a new organization.
name   Name of the organization.
salt '*' grafana4.create_org <name>
salt.modules.grafana4.create_org_user(orgname=None, profile='grafana', **kwargs) Add user to the organization.
loginOrEmail Login or email of the user.
Role of the user for this organization. Should be one of:
• Editor
• Read Only Editor
• Viewer
orgname Name of the organization in which users are added.
salt '*' grafana4.create_org_user <orgname> loginOrEmail=<loginOrEmail> role=<role>
salt.modules.grafana4.create_update_dashboard(orgname=None, profile='grafana', **kwargs) Create or update a dashboard.
dashboard A dict that defines the dashboard to create/update.
overwrite Whether the dashboard should be overwritten if already existing.
orgname Name of the organization.
salt '*' grafana4.create_update_dashboard dashboard=<dashboard> overwrite=True orgname=<orgname>
salt.modules.grafana4.create_user(profile='grafana', **kwargs) Create a new user.
login  Login of the new user.
password Password of the new user.
email  Email of the new user.
name   Optional - Full name of the new user.
salt '*' grafana4.create_user login=<login> password=<password> email=<email>
salt.modules.grafana4.delete_dashboard(slug, orgname=None, profile='grafana') Delete a dashboard.
slug   Slug (name) of the dashboard.
salt '*' grafana4.delete_dashboard <slug>
salt.modules.grafana4.delete_datasource(datasourceid, orgname=None, profile='grafana') Delete a datasource.
datasourceid Id of the datasource.
salt '*' grafana4.delete_datasource <datasource_id>
salt.modules.grafana4.delete_org(orgid, profile='grafana') Delete an organization.
orgid  Id of the organization.
salt '*' grafana4.delete_org <org_id>
salt.modules.grafana4.delete_org_user(userid, orgname=None, profile='grafana') Remove user from the organization.
userid Id of the user.
orgname Name of the organization in which users are updated.
salt '*' grafana4.delete_org_user <user_id> <orgname>
salt.modules.grafana4.delete_user(userid, profile='grafana') Delete a user.
salt '*' grafana4.delete_user <user_id>
salt.modules.grafana4.delete_user_org(userid, orgid, profile='grafana') Remove a user from an organization.
salt '*' grafana4.delete_user_org <user_id> <org_id>
salt.modules.grafana4.get_dashboard(slug, orgname=None, profile='grafana') Get a dashboard.
salt '*' grafana4.get_dashboard <slug>
salt.modules.grafana4.get_datasource(name, orgname=None, profile='grafana') Show a single datasource in an organisation.
name   Name of the datasource.
salt '*' grafana4.get_datasource <name> <orgname>
salt.modules.grafana4.get_datasources(orgname=None, profile='grafana') List all datasources in an organisation.
salt '*' grafana4.get_datasources <orgname>
salt.modules.grafana4.get_org(name, profile='grafana') Show a single organization.
salt '*' grafana4.get_org <name>
salt.modules.grafana4.get_org_address(orgname=None, profile='grafana') Get the organization address.
salt '*' grafana4.get_org_address <orgname>
salt.modules.grafana4.get_org_prefs(orgname=None, profile='grafana') Get the organization preferences.
salt '*' grafana4.get_org_prefs <orgname>
salt.modules.grafana4.get_org_users(orgname=None, profile='grafana') Get the list of users that belong to the organization.
salt '*' grafana4.get_org_users <orgname>
salt.modules.grafana4.get_orgs(profile='grafana') List all organizations.
salt '*' grafana4.get_orgs
salt.modules.grafana4.get_user(login, profile='grafana') Show a single user.
login  Login of the user.
salt '*' grafana4.get_user <login>
salt.modules.grafana4.get_user_data(userid, profile='grafana') Get user data.
salt '*' grafana4.get_user_data <user_id>
salt.modules.grafana4.get_user_orgs(userid, profile='grafana') Get the list of organisations a user belong to.
salt '*' grafana4.get_user_orgs <user_id>
salt.modules.grafana4.get_users(profile='grafana') List all users.
salt '*' grafana4.get_users
salt.modules.grafana4.switch_org(orgname, profile='grafana') Switch the current organization.
name   Name of the organization to switch to.
salt '*' grafana4.switch_org <name>
salt.modules.grafana4.update_datasource(datasourceid, orgname=None, profile='grafana', **kwargs) Update a datasource.
salt '*' grafana4.update_datasource <datasourceid>
salt.modules.grafana4.update_org(orgid, profile='grafana', **kwargs) Update an existing organization.
name   New name of the organization.
salt '*' grafana4.update_org <org_id> name=<name>
salt.modules.grafana4.update_org_address(orgname=None, profile='grafana', **kwargs) Update the organization address.
address1 Optional - address1 of the org.
address2 Optional - address2 of the org.
city   Optional - city of the org.
zip_code Optional - zip_code of the org.
state  Optional - state of the org.
country Optional - country of the org.
salt '*' grafana4.update_org_address <orgname> country=<country>
salt.modules.grafana4.update_org_prefs(orgname=None, profile='grafana', **kwargs) Update the organization preferences.
theme  Selected theme for the org.
homeDashboardId Home dashboard for the org.
timezone Timezone for the org (one of: "browser", "utc", or "").
salt '*' grafana4.update_org_prefs <orgname> theme=<theme> timezone=<timezone>
salt.modules.grafana4.update_org_user(userid, orgname=None, profile='grafana', **kwargs) Update user role in the organization.
salt '*' grafana4.update_org_user <user_id> <orgname> loginOrEmail=<loginOrEmail> role=<role>
salt.modules.grafana4.update_user(userid, profile='grafana', **kwargs) Update an existing user.
login  Optional - Login of the user.
email  Optional - Email of the user.
name   Optional - Full name of the user.
salt '*' grafana4.update_user <user_id> login=<login> email=<email>
salt.modules.grafana4.update_user_password(userid, profile='grafana', **kwargs) Update a user password.
password New password of the user.
salt '*' grafana4.update_user_password <user_id> password=<password>
salt.modules.grafana4.update_user_permissions(userid, profile='grafana', **kwargs) Update a user password.
isGrafanaAdmin Whether user is a Grafana admin.
salt '*' grafana4.update_user_permissions <user_id> isGrafanaAdmin=<true|false>
salt.modules.grains Return/control aspects of the grains data
Grains set or altered with this module are stored in the 'grains' file on the minions. By default, this file is located at: /etc/salt/grains
NOTE: This does NOT override any grains set in the minion config file.
salt.modules.grains.append(key, val, convert=False, delimiter=':') New in version 0.17.0.
Append a value to a list in the grains config file. If the grain doesn't exist, the grain key is added and the value is appended to the new grain as a list item.
key    The grain key to be appended to
val    The value to append to the grain key
convert If convert is True, convert non-list contents into a list. If convert is False and the grain contains non-list contents, an error is given. Defaults to False.
delimiter The key can be a nested dict key. Use this parameter to specify the delimiter you use, instead of the default :. You can now append values to a list in nested dictionary grains. If the list doesn't exist at this level, it will be created.
New in version 2014.7.6.
salt '*' grains.append key val
salt.modules.grains.delkey(key, force=False) New in version 2017.7.0.
Remove a grain completely from the grain system, this will remove the grain key and value
key    The grain key from which to delete the value.
force  Force remove the grain even when it is a mapped value. Defaults to False
salt '*' grains.delkey key
salt.modules.grains.delval(key, destructive=False, force=False) New in version 0.17.0.
Delete a grain value from the grains config file. This will just set the grain value to None. To completely remove the grain, run grains.delkey or pass destructive=True to grains.delval.
destructive Delete the key, too. Defaults to False.
salt '*' grains.delval key
salt.modules.grains.equals(key, value) Used to make sure the minion's grain key/value matches.
Returns True if matches otherwise False.
salt '*' grains.equals fqdn <expected_fqdn> salt '*' grains.equals systemd:version 219
salt.modules.grains.fetch(key, default='', delimiter=':', ordered=True) Attempt to retrieve the named value from grains, if the named value is not available return the passed default. The default return is an empty string.
The value can also represent a value in a nested dict using a ":" delimiter for the dict. This means that if a dict in grains looks like this:
To retrieve the value associated with the apache key in the pkg dict this key can be passed:
pkg:apache
• delimiter --
Specify an alternate delimiter to use when traversing a nested dict.  This is useful for when the desired key contains a colon. See CLI example below for usage.
• ordered --
Outputs an ordered dict if applicable (default: True)
salt '*' grains.get pkg:apache salt '*' grains.get abc::def|ghi delimiter='|'
salt.modules.grains.filter_by(lookup_dict, grain='os_family', merge=None, default='default', base=None) New in version 0.17.0.
Look up the given grain in a given dictionary for the current OS and return the result
Although this may occasionally be useful at the CLI, the primary intent of this function is for use in Jinja to make short work of creating lookup tables for OS-specific data. For example:
{% set apache = salt['grains.filter_by']({ 'Debian': {'pkg': 'apache2', 'srv': 'apache2'}, 'RedHat': {'pkg': 'httpd', 'srv': 'httpd'}, }, default='Debian') %}
myapache: pkg.installed: - name: {{ apache.pkg }} service.running: - name: {{ apache.srv }}
Values in the lookup table may be overridden by values in Pillar. An example Pillar to override values in the example above could be as follows:
apache: lookup: pkg: apache_13 srv: apache
The call to filter_by() would be modified as follows to reference those Pillar values:
{% set apache = salt['grains.filter_by']({ ... }, merge=salt['pillar.get']('apache:lookup')) %}
• lookup_dict --
A dictionary, keyed by a grain, containing a value or values relevant to systems matching that grain. For example, a key could be the grain for an OS and the value could the name of a package on that particular OS.
Changed in version 2016.11.0: The dictionary key could be a globbing pattern. The function will return the corresponding lookup_dict value where grain value matches the pattern. For example:
# this will render 'got some salt' if Minion ID begins from 'salt' salt '*' grains.filter_by '{salt*: got some salt, default: salt is not here}' id
• grain --
The name of a grain to match with the current system's grains. For example, the value of the "os_family" grain for the current system could be used to pull values from the lookup_dict dictionary.
Changed in version 2016.11.0: The grain value could be a list. The function will return the lookup_dict value for a first found item in the list matching one of the lookup_dict keys.
• merge -- A dictionary to merge with the results of the grain selection from lookup_dict. This allows Pillar to override the values in the lookup_dict. This could be useful, for example, to override the values for non-standard package names such as when using a different Python version from the default Python version provided by the OS (e.g., python26-mysql instead of python-mysql).
• default --
default lookup_dict's key used if the grain does not exists or if the grain value has no match on lookup_dict. If unspecified the value is "default".
• base --
A lookup_dict key to use for a base dictionary.  The grain-selected lookup_dict is merged over this and then finally the merge dictionary is merged.  This allows common values for each case to be collected in the base and overridden by the grain selection dictionary and the merge dictionary.  Default is unset.
salt '*' grains.filter_by '{Debian: Debheads rule, RedHat: I love my hat}' # this one will render {D: {E: I, G: H}, J: K} salt '*' grains.filter_by '{A: B, C: {D: {E: F, G: H}}}' 'xxx' '{D: {E: I}, J: K}' 'C' # next one renders {A: {B: G}, D: J} salt '*' grains.filter_by '{default: {A: {B: C}, D: E}, F: {A: {B: G}}, H: {D: I}}' 'xxx' '{D: J}' 'F' 'default' # next same as above when default='H' instead of 'F' renders {A: {B: C}, D: J}
salt.modules.grains.get(key, default='', delimiter=':', ordered=True) Attempt to retrieve the named value from grains, if the named value is not available return the passed default. The default return is an empty string.
salt.modules.grains.get_or_set_hash(name, length=8, chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') Perform a one-time generation of a hash and write it to the local grains.  If that grain has already been set return the value instead.
This is useful for generating passwords or keys that are specific to a single minion that don't need to be stored somewhere centrally.
State Example:
some_mysql_user: mysql_user: - present - host: localhost - password: {{ salt['grains.get_or_set_hash']('mysql:some_mysql_user') }}
salt '*' grains.get_or_set_hash 'django: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.grains.has_value(key) Determine whether a key exists in the grains dictionary.
Given a grains dictionary that contains the following structure:
One would determine if the apache key in the pkg dict exists by:
salt '*' grains.has_value pkg:apache
salt.modules.grains.item(*args, **kwargs) Return one or more grains
salt '*' grains.item os salt '*' grains.item os osrelease oscodename
Sanitized CLI Example:
salt '*' grains.item host sanitize=True
salt.modules.grains.items(sanitize=False) Return all of the minion's grains
salt '*' grains.items sanitize=True
salt.modules.grains.ls() Return a list of all available grains
salt.modules.grains.remove(key, val, delimiter=':') New in version 0.17.0.
Remove a value from a list in the grains config file
key    The grain key to remove.
val    The value to remove.
salt '*' grains.remove key val
salt.modules.grains.set(key, val='', force=False, destructive=False, delimiter=':') Set a key to an arbitrary value. It is used like setval but works with nested keys.
This function is conservative. It will only overwrite an entry if its value and the given one are not a list or a dict. The force parameter is used to allow overwriting in all cases.
• force -- Force writing over existing entry if given or existing values are list or dict. Defaults to False.
• destructive -- If an operation results in a key being removed, delete the key, too. Defaults to False.
• delimiter -- Specify an alternate delimiter to use when traversing a nested dict, the default being :
salt '*' grains.set 'apps:myApp:port' 2209 salt '*' grains.set 'apps:myApp' '{port: 2209}'
salt.modules.grains.setval(key, val, destructive=False, refresh_pillar=True) Set a grains value in the grains config file
key    The grain key to be set.
val    The value to set the grain key to.
destructive If an operation results in a key being removed, delete the key, too.  Defaults to False.
refresh_pillar Whether pillar will be refreshed.  Defaults to True.
salt '*' grains.setval key val salt '*' grains.setval key "{'sub-key': 'val', 'sub-key2': 'val2'}"
salt.modules.grains.setvals(grains, destructive=False, refresh_pillar=True) Set new grains values in the grains config file
salt '*' grains.setvals "{'key1': 'val1', 'key2': 'val2'}"
salt.modules.groupadd Manage groups on Linux, OpenBSD and NetBSD
salt.modules.groupadd.add(name, gid=None, system=False, root=None) Add the specified group
name   Name of the new group
gid    Use GID for the new group
system Create a system account
root   Directory to chroot into
salt.modules.groupadd.adduser(name, username, root=None) Add a user in the group.
name   Name of the group to modify
username Username to add to the group
salt.modules.groupadd.chgid(name, gid, root=None) Change the gid for a named group
gid    Change the group ID to GID
salt.modules.groupadd.delete(name, root=None) Remove the named group
name   Name group to delete
salt.modules.groupadd.deluser(name, username, root=None) Remove a user from the group.
username Username to delete from the group
salt.modules.groupadd.getent(refresh=False, root=None) Return info on all groups
refresh Force a refresh of group information
salt.modules.groupadd.info(name, root=None) Return information about a group
name   Name of the group
salt.modules.groupadd.members(name, members_list, root=None) Replaces members of the group with a provided list.
members_list Username list to set into the group
salt.modules.grub_legacy Support for GRUB Legacy
salt.modules.grub_legacy.conf() Parse GRUB conf file
salt '*' grub.conf
salt.modules.grub_legacy.version() Return server version from grub --version
salt '*' grub.version
salt.modules.guestfs Interact with virtual machine images via libguestfs
• libguestfs
salt.modules.guestfs.mount(location, access='rw', root=None) Mount an image
salt '*' guest.mount /srv/images/fedora.qcow
salt.modules.guestfs.umount(name, disk=None) Unmount an image
salt '*' guestfs.umount /mountpoint disk=/srv/images/fedora.qcow
salt.modules.hadoop Support for hadoop
maintainer Yann Jouanin <yann.jouanin@intelunix.fr>
salt.modules.hadoop.dfs(command=None, *args) Execute a command on DFS
salt '*' hadoop.dfs ls /
salt.modules.hadoop.dfs_absent(path) Check if a file or directory is absent on the distributed FS.
salt '*' hadoop.dfs_absent /some_random_file
Returns True if the file is absent
salt.modules.hadoop.dfs_present(path) Check if a file or directory is present on the distributed FS.
salt '*' hadoop.dfs_present /some_random_file
Returns True if the file is present
salt.modules.hadoop.dfsadmin_report(arg=None) New in version 2019.2.0.
Reports basic filesystem information and statistics. Optional flags may be used to filter the list of displayed DataNodes.
arg    [live] [dead] [decommissioning]
salt '*' hadoop.dfsadmin -report
salt.modules.hadoop.namenode_format(force=None) Format a name node
salt '*' hadoop.namenode_format force=True
salt.modules.hadoop.version() Return version from hadoop version
salt '*' hadoop.version
salt.modules.haproxyconn Support for haproxy
salt.modules.haproxyconn.disable_server(name, backend, socket='/var/run/haproxy.sock') Disable server in haproxy.
name   Server to disable
backend haproxy backend, or all backends if "*" is supplied
socket haproxy stats socket, default /var/run/haproxy.sock
salt '*' haproxy.disable_server db1.example.com mysql
salt.modules.haproxyconn.enable_server(name, backend, socket='/var/run/haproxy.sock') Enable Server in haproxy
name   Server to enable
salt '*' haproxy.enable_server web1.example.com www
salt.modules.haproxyconn.get_backend(backend, socket='/var/run/haproxy.sock') Receive information about a specific backend.
backend haproxy backend
salt '*' haproxy.get_backend mysql
salt.modules.haproxyconn.get_sessions(name, backend, socket='/var/run/haproxy.sock') New in version 2016.11.0.
Get number of current sessions on server in backend (scur)
name   Server name
salt '*' haproxy.get_sessions web1.example.com www
salt.modules.haproxyconn.get_weight(name, backend, socket='/var/run/haproxy.sock') Get server weight
salt '*' haproxy.get_weight web1.example.com www
salt.modules.haproxyconn.list_backends(servers=True, socket='/var/run/haproxy.sock') List HaProxy Backends
servers list backends with servers
salt '*' haproxy.list_backends
salt.modules.haproxyconn.list_frontends(socket='/var/run/haproxy.sock') List HaProxy frontends
salt '*' haproxy.list_frontends
salt.modules.haproxyconn.list_servers(backend, socket='/var/run/haproxy.sock', objectify=False) List servers in haproxy backend.
salt '*' haproxy.list_servers mysql
salt.modules.haproxyconn.set_state(name, backend, state, socket='/var/run/haproxy.sock') Force a server's administrative state to a new state. This can be useful to disable load balancing and/or any traffic to a server. Setting the state to "ready" puts the server in normal mode, and the command is the equivalent of the "enable server" command. Setting the state to "maint" disables any traffic to the server as well as any health checks. This is the equivalent of the "disable server" command. Setting the mode to "drain" only removes the server from load balancing but still allows it to be checked and to accept new persistent connections. Changes are propagated to tracking servers if any.
state  A string of the state to set. Must be 'ready', 'drain', or 'maint'
salt '*' haproxy.set_state my_proxy_server my_backend ready
salt.modules.haproxyconn.set_weight(name, backend, weight=0, socket='/var/run/haproxy.sock') Set server weight
weight Server Weight
salt '*' haproxy.set_weight web1.example.com www 13
salt.modules.haproxyconn.show_backends(socket='/var/run/haproxy.sock') Show HaProxy Backends
salt '*' haproxy.show_backends
salt.modules.haproxyconn.show_frontends(socket='/var/run/haproxy.sock') Show HaProxy frontends
salt '*' haproxy.show_frontends
salt.modules.haproxyconn.wait_state(backend, server, value='up', timeout=300, socket='/var/run/haproxy.sock') Wait for a specific server state
server targeted server
value  state value
timeout timeout before giving up state value, default 5 min
salt '*' haproxy.wait_state mysql server01 up 60
salt.modules.hashutil A collection of hashing and encoding functions
salt.modules.hashutil.base64_b64decode(instr) Decode a base64-encoded string using the "modern" Python interface
salt '*' hashutil.base64_b64decode 'Z2V0IHNhbHRlZA=='
salt.modules.hashutil.base64_b64encode(instr) Encode a string as base64 using the "modern" Python interface.
Among other possible differences, the "modern" encoder does not include newline ('n') characters in the encoded output.
salt '*' hashutil.base64_b64encode 'get salted'
salt.modules.hashutil.base64_decodefile(instr, outfile) Decode a base64-encoded string and write the result to a file
salt '*' hashutil.base64_decodefile instr='Z2V0IHNhbHRlZAo=' outfile='/path/to/binary_file'
salt.modules.hashutil.base64_decodestring(instr) Decode a base64-encoded byte-like object using the "modern" Python interface
salt '*' hashutil.base64_decodestring instr='Z2V0IHNhbHRlZAo='
salt.modules.hashutil.base64_encodefile(fname) Read a file from the file system and return as a base64 encoded string
Pillar example:
path: to: data: | {{ salt.hashutil.base64_encodefile('/path/to/binary_file') | indent(6) }}
The file.decode state function can be used to decode this data and write it to disk.
salt '*' hashutil.base64_encodefile /path/to/binary_file
salt.modules.hashutil.base64_encodestring(instr) Encode a byte-like object as base64 using the "modern" Python interface.
Among other possible differences, the "modern" encoder includes a newline ('n') character after every 76 characters and always at the end of the encoded byte-like object.
salt '*' hashutil.base64_encodestring 'get salted'
salt.modules.hashutil.digest(instr, checksum='md5') Return a checksum digest for a string
instr  A string
checksum md5 The hashing algorithm to use to generate checksums. Valid options: md5, sha256, sha512.
salt '*' hashutil.digest 'get salted'
salt.modules.hashutil.digest_file(infile, checksum='md5') Return a checksum digest for a file
infile A file path
checksum md5 The hashing algorithm to use to generate checksums. Wraps the hashutil.digest execution function.
salt '*' hashutil.digest_file /path/to/file
salt.modules.hashutil.github_signature(string, shared_secret, challenge_hmac) Verify a challenging hmac signature against a string / shared-secret for github webhooks.
Returns a boolean if the verification succeeded or failed.
salt '*' hashutil.github_signature '{"ref":....} ' 'shared secret' 'sha1=bc6550fc290acf5b42283fa8deaf55cea0f8c206'
salt.modules.hashutil.hmac_compute(string, shared_secret) New in version 3000.
Compute a HMAC SHA256 digest using a string and secret.
salt '*' hashutil.hmac_compute 'get salted' 'shared secret'
salt.modules.hashutil.hmac_signature(string, shared_secret, challenge_hmac) Verify a challenging hmac signature against a string / shared-secret
salt '*' hashutil.hmac_signature 'get salted' 'shared secret' 'eBWf9bstXg+NiP5AOwppB5HMvZiYMPzEM9W5YMm/AmQ='
salt.modules.hashutil.md5_digest(instr) Generate an md5 hash of a given string
salt '*' hashutil.md5_digest 'get salted'
salt.modules.hashutil.sha256_digest(instr) Generate an sha256 hash of a given string
salt '*' hashutil.sha256_digest 'get salted'
salt.modules.hashutil.sha512_digest(instr) Generate an sha512 hash of a given string
salt '*' hashutil.sha512_digest 'get salted'
salt.modules.heat Module for handling OpenStack Heat calls
• heatclient Python module
configuration This module is not usable until the user, password, tenant, and auth URL are specified either in a pillar or in the minion's config file.  For example:
keystone.user: admin keystone.password: verybadpass keystone.tenant: admin keystone.insecure: False   #(optional) keystone.auth_url: 'http://127.0.0.1:5000/v2.0/' # Optional keystone.region_name: 'RegionOne'
If configuration for multiple OpenStack accounts is required, they can be set up as different configuration profiles: For example:
openstack1: keystone.user: admin keystone.password: verybadpass keystone.tenant: admin keystone.auth_url: 'http://127.0.0.1:5000/v2.0/'
openstack2: keystone.user: admin keystone.password: verybadpass keystone.tenant: admin keystone.auth_url: 'http://127.0.0.2:5000/v2.0/'
With this configuration in place, any of the heat functions can make use of a configuration profile by declaring it explicitly. For example:
salt '*' heat.flavor_list profile=openstack1
salt.modules.heat.create_stack(name=None, template_file=None, environment=None, parameters=None, poll=0, rollback=False, timeout=60, profile=None) Create a stack (heat stack-create)
name   Name of the new stack
template_file File of template
environment File of environment
parameters Parameter dict used to create the stack
poll   Poll and report events until stack complete
rollback Enable rollback on create failure
timeout Stack creation timeout in minutes
profile Profile to build on
salt '*' heat.create_stack name=mystack \ template_file=salt://template.yaml \ environment=salt://environment.yaml \ parameters="{"image": "Debian 8", "flavor": "m1.small"}" \ poll=5 rollback=False timeout=60 profile=openstack1
New in version 2017.7.5,2018.3.1: The spelling mistake in parameter enviroment was corrected to environment.  The enviroment spelling mistake has been removed in Salt 3000.
salt.modules.heat.delete_stack(name=None, poll=0, timeout=60, profile=None) Delete a stack (heat stack-delete)
name   Name of the stack
timeout Stack creation timeout in minute
profile Profile to use
salt '*' heat.delete_stack name=mystack poll=5 \ profile=openstack1
salt.modules.heat.list_stack(profile=None) Return a list of available stack (heat stack-list)
salt '*' heat.list_stack profile=openstack1
salt.modules.heat.show_stack(name=None, profile=None) Return details about a specific stack (heat stack-show)
salt '*' heat.show_stack name=mystack profile=openstack1
salt.modules.heat.template_stack(name=None, profile=None) Return template a specific stack (heat stack-template)
salt '*' heat.template_stack name=mystack profile=openstack1
salt.modules.heat.update_stack(name=None, template_file=None, environment=None, parameters=None, poll=0, rollback=False, timeout=60, profile=None) Update a stack (heat stack-template)
name   Name of the  stack
parameters Parameter dict used to update the stack
rollback Enable rollback on update failure
salt '*' heat.update_stack name=mystack \ template_file=salt://template.yaml \ environment=salt://environment.yaml \ parameters="{"image": "Debian 8", "flavor": "m1.small"}" \ poll=5 rollback=False timeout=60 profile=openstack1
salt.modules.helm Interface with Helm
depends pyhelm Python package
NOTE: This module use the helm-cli. The helm-cli binary have to be present in your Salt-Minion path.
Helm-CLI vs Salt-Modules This module is a wrapper of the helm binary.  All helm v3.0 command are implemented.
To install a chart with the helm-cli:
helm install grafana stable/grafana --wait --values /path/to/values.yaml
To install a chart with the Salt-Module:
salt '*' helm.install grafana stable/grafana values='/path/to/values.yaml' flags="['wait']"
Detailed Function Documentation salt.modules.helm.completion(shell, flags=None, kvflags=None) Generate auto-completions script for Helm for the specified shell (bash or zsh).  Return the shell auto-completion content.
shell  (string) One of ['bash', 'zsh'].
flags  (list) Flags in argument of the command without values. ex: ['help', '--help']
kvflags (dict) Flags in argument of the command with values. ex: {'v': 2, '--v': 4}
salt '*' helm.completion bash
salt.modules.helm.create(name, flags=None, kvflags=None) Creates a chart directory along with the common files and directories used in a chart.  Return True if succeed, else the error message.
name   (string) The chart name to create.
salt '*' helm.create NAME
salt.modules.helm.dependency_build(chart, flags=None, kvflags=None) Build out the charts/ directory from the Chart.lock file.  Return True if succeed, else the error message.
chart  (string) The chart name to build dependency.
salt '*' helm.dependency_build CHART
salt.modules.helm.dependency_list(chart, flags=None, kvflags=None) List all of the dependencies declared in a chart.  Return chart dependencies if succeed, else the error message.
chart  (string) The chart name to list dependency.
salt '*' helm.dependency_list CHART
salt.modules.helm.dependency_update(chart, flags=None, kvflags=None) Update the on-disk dependencies to mirror Chart.yaml.  Return True if succeed, else the error message.
chart  (string) The chart name to update dependency.
salt '*' helm.dependency_update CHART
salt.modules.helm.env(flags=None, kvflags=None) Prints out all the environment information in use by Helm.  Return Helm environments variables if succeed, else the error message.
salt '*' helm.env
salt.modules.helm.get_all(release, flags=None, kvflags=None) Prints a human readable collection of information about the notes, hooks, supplied values, and generated manifest file of the given release.  Return release information if succeed, else the error message.
release (string) Release name to get information from.
salt '*' helm.get_all RELEASE
salt.modules.helm.get_hooks(release, flags=None, kvflags=None) Prints a human readable collection of information about the hooks of the given release.  Return release hooks information if succeed, else the error message.
release (string) Release name to get hooks information from.
salt '*' helm.get_hooks RELEASE
salt.modules.helm.get_manifest(release, flags=None, kvflags=None) Prints a human readable collection of information about the manifest of the given release.  Return release manifest information if succeed, else the error message.
release (string) Release name to get manifest information from.
salt '*' helm.get_manifest RELEASE
salt.modules.helm.get_notes(release, flags=None, kvflags=None) Prints a human readable collection of information about the notes of the given release.  Return release notes information if succeed, else the error message.
release (string) Release name to get notes information from.
salt '*' helm.get_notes RELEASE
salt.modules.helm.get_values(release, flags=None, kvflags=None) Prints a human readable collection of information about the values of the given release.  Return release values information if succeed, else the error message.
release (string) Release name to get values information from.
salt '*' helm.get_values RELEASE
# In YAML format salt '*' helm.get_values RELEASE kvflags="{'output': 'yaml'}"
salt.modules.helm.help_(command, flags=None, kvflags=None) Provides help for any command in the application.  Return the full help if succeed, else the error message.
command (string) Command to get help. ex: 'get'
salt '*' helm.help COMMAND
salt.modules.helm.history(release, flags=None, kvflags=None) Prints historical revisions for a given release.  Return release historic if succeed, else the error message.
release (string) Release name to get history from.
salt '*' helm.history RELEASE
# In YAML format salt '*' helm.history RELEASE kvflags="{'output': 'yaml'}"
salt.modules.helm.install(release, chart, values=None, version=None, namespace=None, set=None, flags=None, kvflags=None) Installs a chart archive.  Return True if succeed, else the error message.
chart  (string) Chart name to install.
values (string) Absolute path to the values.yaml file.
version (string) The exact chart version to install. If this is not specified, the latest version is installed.
namespace (string) The namespace scope for this request.
set    (string or list) Set a values on the command line.
salt '*' helm.install RELEASE CHART
# With values file. salt '*' helm.install RELEASE CHART values='/path/to/values.yaml'
salt.modules.helm.lint(path, values=None, namespace=None, set=None, flags=None, kvflags=None) Takes a path to a chart and runs a series of tests to verify that the chart is well-formed.  Return True if succeed, else the error message.
path   (string) The path to the chart to lint.
salt '*' helm.lint PATH
salt.modules.helm.list_(namespace=None, flags=None, kvflags=None) Lists all of the releases. By default, it lists only releases that are deployed or failed.  Return the list of release if succeed, else the error message.
salt '*' helm.list
# In YAML format salt '*' helm.list kvflags="{'output': 'yaml'}"
salt.modules.helm.package(chart, flags=None, kvflags=None) Packages a chart into a versioned chart archive file. If a path is given, this will look at that path for a chart (which must contain a Chart.yaml file) and then package that directory.  Return True if succeed, else the error message.
chart  (string) Chart name to package. Can be an absolute path.
salt '*' helm.package CHART
# With destination path. salt '*' helm.package CHART kvflags="{'destination': '/path/to/the/package'}"
salt.modules.helm.plugin_install(path, flags=None, kvflags=None) Install a Helm plugin from a url to a VCS repo or a local path. Return True if succeed, else the error message.
path   (string) Path to the local plugin. Can be an url.
salt '*' helm.plugin_install PATH
salt.modules.helm.plugin_list(flags=None, kvflags=None) List installed Helm plugins.  Return the plugin list if succeed, else the error message.
salt '*' helm.plugin_list
salt.modules.helm.plugin_uninstall(plugin, flags=None, kvflags=None) Uninstall a Helm plugin.  Return True if succeed, else the error message.
plugin (string) The plugin to uninstall.
salt '*' helm.plugin_uninstall PLUGIN
salt.modules.helm.plugin_update(plugin, flags=None, kvflags=None) Update a Helm plugin.  Return True if succeed, else the error message.
plugin (string) The plugin to update.
salt '*' helm.plugin_update PLUGIN
salt.modules.helm.pull(pkg, flags=None, kvflags=None) Retrieve a package from a package repository, and download it locally.  Return True if succeed, else the error message.
pkg    (string) The package to pull. Can be url or repo/chartname.
salt '*' helm.pull PKG
# With destination path to write the chart. salt '*' helm.pull PKG kvflags="{'destination': '/path/to/the/chart'}"
salt.modules.helm.repo_add(name, url, namespace=None, flags=None, kvflags=None) Add a chart repository.  Return True if succeed, else the error message.
name   (string) The local name of the repository to install. Have to be unique.
url    (string) The url to the repository.
salt '*' helm.repo_add NAME URL
salt.modules.helm.repo_index(directory, namespace=None, flags=None, kvflags=None) Read the current directory and generate an index file based on the charts found.  Return True if succeed, else the error message.
directory (string) The path to the index.
salt '*' helm.index DIRECTORY