neulab/tldr huggingface dataset:
salt '*' makeconf.trim_makeopts '-j3'
salt.modules.makeconf.trim_var(var, value) Remove a value from a variable in the make.conf
salt '*' makeconf.trim_var 'LINGUAS' 'en'
salt.modules.makeconf.var_contains(var, value) Verify if variable contains a value in make.conf
salt '*' makeconf.var_contains 'LINGUAS' 'en'
salt.modules.mandrill Mandrill Send out emails using the Mandrill API.
In the minion configuration file, the following block is required:
mandrill: key: <API_KEY>
salt.modules.mandrill.send(message, asynchronous=False, ip_pool=None, send_at=None, api_url=None, api_version=None, api_key=None) Send out the email using the details from the message argument.
message The information on the message to send. This argument must be sent as dictionary with at fields as specified in the Mandrill API documentation.
asynchronous: False Enable a background sending mode that is optimized for bulk sending.  In asynchronous mode, messages/send will immediately return a status of "queued" for every recipient. To handle rejections when sending in asynchronous mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of asynchronous.
ip_pool The name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead.
send_at When this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately. An additional fee applies for scheduled email, and this feature is only available to accounts with a positive balance.
NOTE: Fur further details please consult the API documentation.
salt '*' mandrill.send message="{'subject': 'Hi', 'from_email': 'test@example.com', 'to': [{'email': 'recv@example.com', 'type': 'to'}]}"
message structure example (as YAML for readability):
message: text: | This is the body of the email. This is the second line. subject: Email subject from_name: Test At Example Dot Com from_email: test@example.com to: - email: recv@example.com type: to name: Recv At Example Dot Com - email: cc@example.com type: cc name: CC At Example Dot Com important: true track_clicks: true track_opens: true attachments: - type: text/x-yaml name: yaml_file.yml content: aV9hbV9zdXBlcl9jdXJpb3VzOiB0cnVl
minion: ---------- comment: out: |_ ---------- _id: c4353540a3c123eca112bbdd704ab6 email: recv@example.com reject_reason: None status: sent result: True
salt.modules.marathon Module providing a simple management interface to a marathon cluster.
salt.modules.marathon.app(id) Return the current server configuration for the specified app.
salt marathon-minion-id marathon.app my-app
salt.modules.marathon.apps() Return a list of the currently installed app ids.
salt marathon-minion-id marathon.apps
salt.modules.marathon.has_app(id) Return whether the given app id is currently configured.
salt marathon-minion-id marathon.has_app my-app
salt.modules.marathon.info() Return configuration and status information about the marathon instance.
salt marathon-minion-id marathon.info
salt.modules.marathon.restart_app(id, restart=False, force=True) Restart the current server configuration for the specified app.
• restart -- Restart the app
• force -- Override the current deployment
salt marathon-minion-id marathon.restart_app my-app
By default, this will only check if the app exists in marathon. It does not check if there are any tasks associated with it or if the app is suspended.
salt marathon-minion-id marathon.restart_app my-app true true
The restart option needs to be set to True to actually issue a rolling restart to marathon.
The force option tells marathon to ignore the current app deployment if there is one.
salt.modules.marathon.rm_app(id) Remove the specified app from the server.
salt marathon-minion-id marathon.rm_app my-app
salt.modules.marathon.update_app(id, config) Update the specified app with the given configuration.
salt marathon-minion-id marathon.update_app my-app '<config yaml>'
salt.modules.match The match module allows for match routines to be run and determine target specs
salt.modules.match.compound(tgt, minion_id=None) Return True if the minion ID matches the given compound target
minion_id Specify the minion ID to match against the target expression
salt '*' match.compound 'L@cheese,foo and *'
salt.modules.match.data(tgt) Return True if the minion matches the given data target
salt '*' match.data 'spam:eggs'
salt.modules.match.filter_by(lookup, tgt_type='compound', minion_id=None, merge=None, merge_lists=False, default='default') Return the first match in a dictionary of target patterns
salt '*' match.filter_by '{foo*: Foo!, bar*: Bar!}' minion_id=bar03
Pillar Example:
# Filter the data for the current minion into a variable: {% set roles = salt['match.filter_by']({ 'web*': ['app', 'caching'], 'db*': ['db'], }, minion_id=grains['id'], default='web*') %}
# Make the filtered data available to Pillar: roles: {{ roles | yaml() }}
salt.modules.match.glob(tgt, minion_id=None) Return True if the minion ID matches the given glob target
salt '*' match.glob '*'
salt.modules.match.grain(tgt, delimiter=':') Return True if the minion matches the given grain target. The delimiter argument can be used to specify a different delimiter.
salt '*' match.grain 'os:Ubuntu' salt '*' match.grain 'ipv6|2001:db8::ff00:42:8329' delimiter='|'
delimiter Specify an alternate delimiter to use when traversing a nested dict
delim  Specify an alternate delimiter to use when traversing a nested dict
New in version 0.16.4.
Deprecated since version 2015.8.0.
salt.modules.match.grain_pcre(tgt, delimiter=':') Return True if the minion matches the given grain_pcre target. The delimiter argument can be used to specify a different delimiter.
salt '*' match.grain_pcre 'os:Fedo.*' salt '*' match.grain_pcre 'ipv6|2001:.*' delimiter='|'
salt.modules.match.ipcidr(tgt) Return True if the minion matches the given ipcidr target
salt '*' match.ipcidr '192.168.44.0/24'
delimiter Pillar Example:
'172.16.0.0/12': - match: ipcidr - nodeclass: internal
salt.modules.match.list_(tgt, minion_id=None) Return True if the minion ID matches the given list target
salt '*' match.list 'server1,server2'
salt.modules.match.pcre(tgt, minion_id=None) Return True if the minion ID matches the given pcre target
salt '*' match.pcre '.*'
salt.modules.match.pillar(tgt, delimiter=':') Return True if the minion matches the given pillar target. The delimiter argument can be used to specify a different delimiter.
salt '*' match.pillar 'cheese:foo' salt '*' match.pillar 'clone_url|https://github.com/saltstack/salt.git' delimiter='|'
salt.modules.match.pillar_pcre(tgt, delimiter=':') Return True if the minion matches the given pillar_pcre target. The delimiter argument can be used to specify a different delimiter.
salt '*' match.pillar_pcre 'cheese:(swiss|american)' salt '*' match.pillar_pcre 'clone_url|https://github\.com/.*\.git' delimiter='|'
salt.modules.match.search_by(lookup, tgt_type='compound', minion_id=None) Search a dictionary of target strings for matching targets
This is the inverse of match.filter_by and allows matching values instead of matching keys. A minion can be matched by multiple entries.
salt '*' match.search_by '{web: [node1, node2], db: [node2, node]}'
{% set roles = salt.match.search_by({ 'web': ['G@os_family:Debian not nodeX'], 'db': ['L@node2,node3 and G@datacenter:west'], 'caching': ['node3', 'node4'], }) %}
salt.modules.mattermost Module for sending messages to Mattermost
configuration This module can be used by either passing an api_url and hook directly or by specifying both in a configuration profile in the salt master/minion config. For example:
mattermost: hook: peWcBiMOS9HrZG15peWcBiMOS9HrZG15 api_url: https://example.com
salt.modules.mattermost.post_message(message, channel=None, username=None, api_url=None, hook=None) Send a message to a Mattermost channel.
• channel -- The channel name, either will work.
• username -- The username of the poster.
• message -- The message to send to the Mattermost channel.
• api_url -- The Mattermost api url, if not specified in the configuration.
• hook -- The Mattermost hook, if not specified in the configuration.
salt '*' mattermost.post_message message='Build is done'
salt.modules.mdadm_raid Salt module to manage RAID arrays with mdadm
salt.modules.mdadm_raid.add(name, device) Add new device to RAID array.
salt '*' raid.add /dev/md0 /dev/sda1
salt.modules.mdadm_raid.assemble(name, devices, test_mode=False, **kwargs) Assemble a RAID device.
salt '*' raid.assemble /dev/md0 ['/dev/xvdd', '/dev/xvde']
NOTE: Adding test_mode=True as an argument will print out the mdadm command that would have been run.
name   The name of the array to assemble.
devices The list of devices comprising the array to assemble.
kwargs Optional arguments to be passed to mdadm.
test_mode=True: Prints out the full command.
test_mode=False (Default): Executes command on the host(s) and prints out the mdadm output.
For more info, read the mdadm manpage.
salt.modules.mdadm_raid.create(name, level, devices, metadata='default', test_mode=False, **kwargs) Create a RAID device.
WARNING: Use with CAUTION, as this function can be very destructive if not used properly!
salt '*' raid.create /dev/md0 level=1 chunk=256 devices="['/dev/xvdd', '/dev/xvde']" test_mode=True
name   The name of the array to create.
level  The RAID level to use when creating the raid.
devices A list of devices used to build the array.
metadata Version of metadata to use when creating the array.
test_mode=False (Default): Executes command on remote the host(s) and Prints out the mdadm output.
NOTE: It takes time to create a RAID array. You can check the progress in "resync_status:" field of the results from the following command:
salt '*' raid.detail /dev/md0
For more info, read the mdadm(8) manpage
salt.modules.mdadm_raid.destroy(device) Destroy a RAID device.
WARNING This will zero the superblock of all members of the RAID array..
salt '*' raid.destroy /dev/md0
salt.modules.mdadm_raid.detail(device='/dev/md0') Show detail for a specified RAID device
salt '*' raid.detail '/dev/md0'
salt.modules.mdadm_raid.examine(device, quiet=False) Show detail for a specified RAID component device
device Device to examine, that is part of the RAID
quiet  If the device is not part of the RAID, do not show any error
salt '*' raid.examine '/dev/sda1'
salt.modules.mdadm_raid.list_() List the RAID devices.
salt '*' raid.list
salt.modules.mdadm_raid.save_config() Save RAID configuration to config file.
Same as: mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Fixes this issue with Ubuntu REF: http://askubuntu.com/questions/209702/why-is-my-raid-dev-md1-showing-up-as-dev-md126-is-mdadm-conf-being-ignored
salt '*' raid.save_config
salt.modules.mdadm_raid.stop() Shut down all arrays that can be shut down (i.e. are not currently in use).
salt '*' raid.stop
salt.modules.mdata Module for managaging metadata in SmartOS Zones
platform smartos
salt.modules.mdata.delete_(*keyname) Delete metadata
prop   string name of property
salt '*' mdata.get salt:role salt '*' mdata.get user-script salt:role
salt.modules.mdata.get_(*keyname) Get metadata
keyname string name of key
NOTE: If no keynames are specified, we get all (public) properties
salt.modules.mdata.list_() List available metadata
salt '*' mdata.list
salt.modules.mdata.put_(keyname, val) Put metadata
val    string value to set
salt.modules.memcached Module for Management of Memcached Keys
salt.modules.memcached.add(key, value, host='127.0.0.1', port=11211, time=0, min_compress_len=0) Add a key to the memcached server, but only if it does not exist. Returns False if the key already exists.
salt '*' memcached.add <key> <value>
salt.modules.memcached.decr(key, delta=1, host='127.0.0.1', port=11211) This function is an alias of decrement. Decrement the value of a key
salt '*' memcached.decrement <key> salt '*' memcached.decrement <key> 2
salt.modules.memcached.decrement(key, delta=1, host='127.0.0.1', port=11211) Decrement the value of a key
salt.modules.memcached.delete(key, host='127.0.0.1', port=11211, time=0) Delete a key from memcache server
salt '*' memcached.delete <key>
salt.modules.memcached.get(key, host='127.0.0.1', port=11211) Retrieve value for a key
salt '*' memcached.get <key>
salt.modules.memcached.incr(key, delta=1, host='127.0.0.1', port=11211) This function is an alias of increment. Increment the value of a key
salt '*' memcached.increment <key> salt '*' memcached.increment <key> 2
salt.modules.memcached.increment(key, delta=1, host='127.0.0.1', port=11211) Increment the value of a key
salt.modules.memcached.replace(key, value, host='127.0.0.1', port=11211, time=0, min_compress_len=0) Replace a key on the memcached server. This only succeeds if the key already exists. This is the opposite of memcached.add
salt '*' memcached.replace <key> <value>
salt.modules.memcached.set_(key, value, host='127.0.0.1', port=11211, time=0, min_compress_len=0) Set a key on the memcached server, overwriting the value if it exists.
salt '*' memcached.set <key> <value>
salt.modules.memcached.status(host='127.0.0.1', port=11211) Get memcached status
salt '*' memcached.status
salt.modules.mine The function cache system allows for data to be stored on the master so it can be easily read by other minions
salt.modules.mine.delete(fun) Remove specific function contents of minion.
Parameters fun (str) -- The name of the function.
Returns True on success.
salt '*' mine.delete 'network.interfaces'
salt.modules.mine.flush() Remove all mine contents of minion.
Returns True on success
salt '*' mine.flush
salt.modules.mine.get(tgt, fun, tgt_type='glob', exclude_minion=False) Get data from the mine.
• tgt (str) -- Target whose mine data to get.
• fun (str or list) -- Function to get the mine data of. You can specify multiple functions to retrieve using either a list or a comma-separated string of functions.
• tgt_type (str) -- Default glob. Target type to use with tgt.  See targeting for more information.  Note that all pillar matches, whether using the compound matching system or the pillar matching system, will be exact matches, with globbing disabled.
• exclude_minion (bool) -- Excludes the current minion from the result set.
salt '*' mine.get '*' network.interfaces salt '*' mine.get 'os:Fedora' network.interfaces grain salt '*' mine.get 'G@os:Fedora and S@192.168.5.0/24' network.ipaddrs compound
SEE ALSO: Retrieving Mine data from Pillar and Orchestrate
This execution module is intended to be executed on minions. Master-side operations such as Pillar or Orchestrate that require Mine data should use the Mine Runner module instead; it can be invoked from a Pillar SLS file using the saltutil.runner module. For example:
{% set minion_ips = salt.saltutil.runner('mine.get', tgt='*', fun='network.ip_addrs', tgt_type='glob') %}
salt.modules.mine.get_docker(interfaces=None, cidrs=None, with_container_id=False) Changed in version 2017.7.8,2018.3.3: When docker.update_mine is set to False for a given minion, no mine data will be populated for that minion, and thus none will be returned for it.
Changed in version 2019.2.0: docker.update_mine now defaults to False
Get all mine data for docker.ps and run an aggregation routine. The interfaces parameter allows for specifying the network interfaces from which to select IP addresses. The cidrs parameter allows for specifying a list of subnets which the IP address must match.
with_container_id Boolean, to expose container_id in the list of results
salt '*' mine.get_docker salt '*' mine.get_docker interfaces='eth0' salt '*' mine.get_docker interfaces='["eth0", "eth1"]' salt '*' mine.get_docker cidrs='107.170.147.0/24' salt '*' mine.get_docker cidrs='["107.170.147.0/24", "172.17.42.0/24"]' salt '*' mine.get_docker interfaces='["eth0", "eth1"]' cidrs='["107.170.147.0/24", "172.17.42.0/24"]'
salt.modules.mine.send(name, *args, **kwargs) Send a specific function and its result to the salt mine.  This gets stored in either the local cache, or the salt master's cache.
Parameters name (str) -- Name of the function to add to the mine.
The following pameters are extracted from kwargs if present:
• mine_function (str) -- The name of the execution_module.function to run and whose value will be stored in the salt mine. Defaults to name.
• allow_tgt (str) -- Targeting specification for ACL. Specifies which minions are allowed to access this function. Please note both your master and minion need to be on, at least, version 3000 for this to work properly.
• allow_tgt_type (str) -- Type of the targeting specification. This value will be ignored if allow_tgt is not specified. Please note both your master and minion need to be on, at least, version 3000 for this to work properly.
Remaining args and kwargs will be passed on to the function to run.
Returns Whether executing the function and storing the information was successful.
Changed in version 3000: Added allow_tgt- and allow_tgt_type-parameters to specify which minions are allowed to access this function.  See targeting for more information about targeting.
salt '*' mine.send network.ip_addrs eth0 salt '*' mine.send eth0_ip_addrs mine_function=network.ip_addrs eth0 salt '*' mine.send eth0_ip_addrs mine_function=network.ip_addrs eth0 allow_tgt='G@grain:value' allow_tgt_type=compound
salt.modules.mine.update(clear=False, mine_functions=None) Call the configured functions and send the data back up to the master.  The functions to be called are merged from the master config, pillar and minion config under the option mine_functions:
mine_functions: network.ip_addrs: - eth0 disk.usage: []
This function accepts the following arguments:
• clear (bool) -- Default: False Specifies whether updating will clear the existing values (True), or whether it will update them (False).
• mine_functions (dict) --
Update (or clear, see clear) the mine data on these functions only.  This will need to have the structure as defined on https://docs.saltproject.io/en/latest/topics/mine/index.html#mine-functions
This feature can be used when updating the mine for functions that require a refresh at different intervals than the rest of the functions specified under mine_functions in the minion/master config or pillar.  A potential use would be together with the scheduler, for example:
schedule: lldp_mine_update: function: mine.update kwargs: mine_functions: net.lldp: [] hours: 12
In the example above, the mine for net.lldp would be refreshed every 12 hours, while  network.ip_addrs would continue to be updated as specified in mine_interval.
The function cache will be populated with information from executing these functions
salt.modules.mine.valid() List valid entries in mine configuration.
salt '*' mine.valid
salt.modules.minion Module to provide information about minions
salt.modules.minion.kill(timeout=15) Kill the salt minion.
timeout int seconds to wait for the minion to die.
If you have a monitor that restarts salt-minion when it dies then this is a great way to restart after a minion upgrade.
salt minion[12] minion.kill
minion1: ---------- killed: 7874 retcode: 0 minion2: ---------- killed: 29071 retcode: 0
The result of the salt command shows the process ID of the minions and the results of a kill signal to the minion in as the retcode value: 0 is success, anything else is a failure.
salt.modules.minion.list_() Return a list of accepted, denied, unaccepted and rejected keys. This is the same output as salt-key -L
salt 'master' minion.list
salt.modules.minion.restart() Kill and restart the salt minion.
The configuration key minion_restart_command is an argv list for the command to restart the minion.  If minion_restart_command is not specified or empty then the argv of the current process will be used.
if the configuration value minion_restart_command is not set and the -d (daemonize) argument is missing from argv then the minion will be killed but will not be restarted and will require the parent process to perform the restart.  This behavior is intended for managed salt minion processes.
salt minion[12] minion.restart
minion1: ---------- comment: - Restart using process argv: -     /home/omniture/install/bin/salt-minion -     -d -     -c -     /home/omniture/install/etc/salt killed: 10070 restart: ---------- stderr: stdout: retcode: 0 minion2: ---------- comment: - Using configuration minion_restart_command: -     /home/omniture/install/bin/salt-minion -     --not-an-option -     -d -     -c -     /home/omniture/install/etc/salt - Restart failed killed: 10896 restart: ---------- stderr: Usage: salt-minion
salt-minion: error: no such option: --not-an-option stdout: retcode: 64
The result of the command shows the process ID of minion1 that is shutdown (killed) and the results of the restart.  If there is a failure in the restart it will be reflected in a non-zero retcode and possibly output in the stderr and/or stdout values along with addition information in the comment field as is demonstrated with minion2.
salt.modules.mod_random Provides access to randomness generators. New in version 2014.7.0.
salt.modules.mod_random.get_str(length=20, chars=None, lowercase=True, uppercase=True, digits=True, punctuation=True, whitespace=False, printable=False) New in version 2014.7.0.
Changed in version 3004.0: Changed the default character set used to include symbols and implemented arguments to control the used character set.
Returns a random string of the specified length.
length 20 Any valid number of bytes.
chars  None New in version 3004.0.
String with any character that should be used to generate random string.
This argument supersedes all other character controlling arguments.
lowercase True New in version 3004.0.
Use lowercase letters in generated random string.  (see string.ascii_lowercase)
This argument is superseded by chars.
uppercase True New in version 3004.0.
Use uppercase letters in generated random string.  (see string.ascii_uppercase)
digits True New in version 3004.0.
Use digits in generated random string.  (see string.digits)
printable False New in version 3004.0.
Use printable characters in generated random string and includes lowercase, uppercase, digits, punctuation and whitespace.  (see string.printable)
It is disabled by default as includes whitespace characters which some systems do not handle well in passwords.  This argument also supersedes all other classes because it includes them.
punctuation True New in version 3004.0.
Use punctuation characters in generated random string. (see string.punctuation)
whitespace False New in version 3004.0.
Use whitespace characters in generated random string.  (see string.whitespace)
It is disabled by default as some systems do not handle whitespace characters in passwords well.
salt '*' random.get_str 128 salt '*' random.get_str 128 chars='abc123.!()' salt '*' random.get_str 128 lowercase=False whitespace=True
salt.modules.mod_random.hash(value, algorithm='sha512') New in version 2014.7.0.
Encodes a value with the specified encoder.
value  The value to be hashed.
algorithm sha512 The algorithm to use. May be any valid algorithm supported by hashlib.
salt '*' random.hash 'I am a string' md5
salt.modules.mod_random.rand_int(start=1, end=10, seed=None) Returns a random integer number between the start and end number.
New in version 2015.5.3.
start  1 Any valid integer number
end    10 Any valid integer number
seed : Optional hashable object
Changed in version 2019.2.0: Added seed argument. Will return the same result when run with the same seed.
salt '*' random.rand_int 1 10
salt.modules.mod_random.seed(range=10, hash=None) Returns a random number within a range. Optional hash argument can be any hashable object. If hash is omitted or None, the id of the minion is used.
hash: None Any hashable object.
range: 10 Any valid integer number
salt '*' random.seed 10 hash=None
salt.modules.mod_random.shadow_hash(crypt_salt=None, password=None, algorithm='sha512') Generates a salted hash suitable for /etc/shadow.
crypt_salt None Salt to be used in the generation of the hash. If one is not provided, a random salt will be generated.
password None Value to be salted and hashed. If one is not provided, a random password will be generated.
algorithm sha512 Hash algorithm to use.
salt '*' random.shadow_hash 'My5alT' 'MyP@asswd' md5
salt.modules.mod_random.str_encode(value, encoder='base64') New in version 2014.7.0.
value  The value to be encoded.
encoder base64 The encoder to use on the subsequent string.
salt '*' random.str_encode 'I am a new string' base64
salt.modules.modjk Control Modjk via the Apache Tomcat "Status" worker (‐ http://tomcat.apache.org/connectors-doc/reference/status.html)
Below is an example of the configuration needed for this module. This configuration data can be placed either in grains or pillar.
If using grains, this can be accomplished statically or via a grain module.
If using pillar, the yaml configuration can be placed directly into a pillar SLS file, making this both the easier and more dynamic method of configuring this module.
modjk: default: url: http://localhost/jkstatus user: modjk pass: secret realm: authentication realm for digest passwords timeout: 5 otherVhost: url: http://otherVhost/jkstatus user: modjk pass: secret2 realm: authentication realm2 for digest passwords timeout: 600
salt.modules.modjk.bulk_activate(workers, lbn, profile='default') Activate all the given workers in the specific load balancer
salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1 other-profile
salt '*' modjk.bulk_activate ["node1","node2","node3"] loadbalancer1 salt '*' modjk.bulk_activate ["node1","node2","node3"] loadbalancer1 other-profile
salt.modules.modjk.bulk_disable(workers, lbn, profile='default') Disable all the given workers in the specific load balancer
salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1 other-profile
salt '*' modjk.bulk_disable ["node1","node2","node3"] loadbalancer1 salt '*' modjk.bulk_disable ["node1","node2","node3"] loadbalancer1 other-profile
salt.modules.modjk.bulk_recover(workers, lbn, profile='default') Recover all the given workers in the specific load balancer
salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1 other-profile
salt '*' modjk.bulk_recover ["node1","node2","node3"] loadbalancer1 salt '*' modjk.bulk_recover ["node1","node2","node3"] loadbalancer1 other-profile
salt.modules.modjk.bulk_stop(workers, lbn, profile='default') Stop all the given workers in the specific load balancer
salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1 other-profile
salt '*' modjk.bulk_stop ["node1","node2","node3"] loadbalancer1 salt '*' modjk.bulk_stop ["node1","node2","node3"] loadbalancer1 other-profile
salt.modules.modjk.dump_config(profile='default') Dump the original configuration that was loaded from disk
salt '*' modjk.dump_config salt '*' modjk.dump_config other-profile
salt.modules.modjk.get_running(profile='default') Get the current running config (not from disk)
salt '*' modjk.get_running salt '*' modjk.get_running other-profile
salt.modules.modjk.lb_edit(lbn, settings, profile='default') Edit the loadbalancer settings
Note: http://tomcat.apache.org/connectors-doc/reference/status.html Data Parameters for the standard Update Action
salt '*' modjk.lb_edit loadbalancer1 "{'vlr': 1, 'vlt': 60}" salt '*' modjk.lb_edit loadbalancer1 "{'vlr': 1, 'vlt': 60}" other-profile
salt.modules.modjk.list_configured_members(lbn, profile='default') Return a list of member workers from the configuration files
salt '*' modjk.list_configured_members loadbalancer1 salt '*' modjk.list_configured_members loadbalancer1 other-profile
salt.modules.modjk.recover_all(lbn, profile='default') Set the all the workers in lbn to recover and activate them if they are not
salt '*' modjk.recover_all loadbalancer1 salt '*' modjk.recover_all loadbalancer1 other-profile
salt.modules.modjk.reset_stats(lbn, profile='default') Reset all runtime statistics for the load balancer
salt '*' modjk.reset_stats loadbalancer1 salt '*' modjk.reset_stats loadbalancer1 other-profile
salt.modules.modjk.version(profile='default') Return the modjk version
salt '*' modjk.version salt '*' modjk.version other-profile
salt.modules.modjk.worker_activate(worker, lbn, profile='default') Set the worker to activate state in the lbn load balancer
salt '*' modjk.worker_activate node1 loadbalancer1 salt '*' modjk.worker_activate node1 loadbalancer1 other-profile
salt.modules.modjk.worker_disable(worker, lbn, profile='default') Set the worker to disable state in the lbn load balancer
salt '*' modjk.worker_disable node1 loadbalancer1 salt '*' modjk.worker_disable node1 loadbalancer1 other-profile
salt.modules.modjk.worker_edit(worker, lbn, settings, profile='default') Edit the worker settings
salt '*' modjk.worker_edit node1 loadbalancer1 "{'vwf': 500, 'vwd': 60}" salt '*' modjk.worker_edit node1 loadbalancer1 "{'vwf': 500, 'vwd': 60}" other-profile
salt.modules.modjk.worker_recover(worker, lbn, profile='default') Set the worker to recover this module will fail if it is in OK state
salt '*' modjk.worker_recover node1 loadbalancer1 salt '*' modjk.worker_recover node1 loadbalancer1 other-profile
salt.modules.modjk.worker_status(worker, profile='default') Return the state of the worker
salt '*' modjk.worker_status node1 salt '*' modjk.worker_status node1 other-profile
salt.modules.modjk.worker_stop(worker, lbn, profile='default') Set the worker to stopped state in the lbn load balancer
salt.modules.modjk.workers(profile='default') Return a list of member workers and their status
salt '*' modjk.workers salt '*' modjk.workers other-profile
salt.modules.mongodb Module to provide MongoDB functionality to Salt
configuration This module uses PyMongo, and accepts configuration details as parameters as well as configuration settings:
mongodb.host: 'localhost' mongodb.port: 27017 mongodb.user: '' mongodb.password: ''
salt.modules.mongodb.db_exists(name, user=None, password=None, host=None, port=None, authdb=None) Checks if a database exists in MongoDB
salt '*' mongodb.db_exists <name> <user> <password> <host> <port>
salt.modules.mongodb.db_list(user=None, password=None, host=None, port=None, authdb=None) List all MongoDB databases
salt '*' mongodb.db_list <user> <password> <host> <port>
salt.modules.mongodb.db_remove(name, user=None, password=None, host=None, port=None, authdb=None) Remove a MongoDB database
salt '*' mongodb.db_remove <name> <user> <password> <host> <port>
salt.modules.mongodb.find(collection, query=None, user=None, password=None, host=None, port=None, database='admin', authdb=None) Find an object or list of objects in a collection
salt '*' mongodb.find mycollection '[{"foo": "FOO", "bar": "BAR"}]' <user> <password> <host> <port> <database>
salt.modules.mongodb.insert(objects, collection, user=None, password=None, host=None, port=None, database='admin', authdb=None) Insert an object or list of objects into a collection
salt '*' mongodb.insert '[{"foo": "FOO", "bar": "BAR"}, {"foo": "BAZ", "bar": "BAM"}]' mycollection <user> <password> <host> <port> <database>
salt.modules.mongodb.remove(collection, query=None, user=None, password=None, host=None, port=None, database='admin', w=1, authdb=None) Remove an object or list of objects into a collection
salt '*' mongodb.remove mycollection '[{"foo": "FOO", "bar": "BAR"}, {"foo": "BAZ", "bar": "BAM"}]' <user> <password> <host> <port> <database>
salt.modules.mongodb.update_one(objects, collection, user=None, password=None, host=None, port=None, database='admin', authdb=None) Update an object into a collection http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_one
salt '*' mongodb.update_one '{"_id": "my_minion"} {"bar": "BAR"}' mycollection <user> <password> <host> <port> <database>
salt.modules.mongodb.user_create(name, passwd, user=None, password=None, host=None, port=None, database='admin', authdb=None, roles=None) Create a MongoDB user
salt '*' mongodb.user_create <user_name> <user_password> <roles> <user> <password> <host> <port> <database>
salt.modules.mongodb.user_exists(name, user=None, password=None, host=None, port=None, database='admin', authdb=None) Checks if a user exists in MongoDB
salt '*' mongodb.user_exists <name> <user> <password> <host> <port> <database>
salt.modules.mongodb.user_find(name, user=None, password=None, host=None, port=None, database='admin', authdb=None) Get single user from MongoDB
salt '*' mongodb.user_find <name> <user> <password> <host> <port> <database> <authdb>
salt.modules.mongodb.user_grant_roles(name, roles, database, user=None, password=None, host=None, port=None, authdb=None) Grant one or many roles to a MongoDB user
salt '*' mongodb.user_grant_roles johndoe '["readWrite"]' dbname admin adminpwd localhost 27017
salt '*' mongodb.user_grant_roles janedoe '[{"role": "readWrite", "db": "dbname" }, {"role": "read", "db": "otherdb"}]' dbname admin adminpwd localhost 27017
salt.modules.mongodb.user_list(user=None, password=None, host=None, port=None, database='admin', authdb=None) List users of a MongoDB database
salt '*' mongodb.user_list <user> <password> <host> <port> <database>
salt.modules.mongodb.user_remove(name, user=None, password=None, host=None, port=None, database='admin', authdb=None) Remove a MongoDB user
salt '*' mongodb.user_remove <name> <user> <password> <host> <port> <database>
salt.modules.mongodb.user_revoke_roles(name, roles, database, user=None, password=None, host=None, port=None, authdb=None) Revoke one or many roles to a MongoDB user
salt '*' mongodb.user_revoke_roles johndoe '["readWrite"]' dbname admin adminpwd localhost 27017
salt '*' mongodb.user_revoke_roles janedoe '[{"role": "readWrite", "db": "dbname" }, {"role": "read", "db": "otherdb"}]' dbname admin adminpwd localhost 27017
salt.modules.mongodb.user_roles_exists(name, roles, database, user=None, password=None, host=None, port=None, authdb=None) Checks if a user of a MongoDB database has specified roles
salt '*' mongodb.user_roles_exists johndoe '["readWrite"]' dbname admin adminpwd localhost 27017
salt '*' mongodb.user_roles_exists johndoe '[{"role": "readWrite", "db": "dbname" }, {"role": "read", "db": "otherdb"}]' dbname admin adminpwd localhost 27017
salt.modules.mongodb.version(user=None, password=None, host=None, port=None, database='admin', authdb=None) Get MongoDB instance version
salt '*' mongodb.version <user> <password> <host> <port> <database>
salt.modules.monit Monit service module. This module will create a monit type service watcher.
salt.modules.monit.configtest() New in version 2016.3.0.
Test monit configuration syntax
salt '*' monit.configtest
salt.modules.monit.id_(reset=False) New in version 2016.3.0.
Return monit unique id.
reset  False Reset current id and generate a new id when it's True.
salt '*' monit.id [reset=True]
salt.modules.monit.monitor(name) monitor service via monit
salt '*' monit.monitor <service name>
salt.modules.monit.reload_() New in version 2016.3.0.
Reload monit configuration
salt '*' monit.reload
salt.modules.monit.restart(name) Restart service via monit
salt '*' monit.restart <service name>
salt.modules.monit.start(name) CLI Example:
salt '*' monit.start <service name>
salt.modules.monit.status(svc_name='') Display a process status from monit
salt '*' monit.status salt '*' monit.status <service name>
salt.modules.monit.stop(name) Stops service via monit
salt '*' monit.stop <service name>
salt.modules.monit.summary(svc_name='') Display a summary from monit
salt '*' monit.summary salt '*' monit.summary <service name>
salt.modules.monit.unmonitor(name) Unmonitor service via monit
salt '*' monit.unmonitor <service name>
salt.modules.monit.validate() New in version 2016.3.0.
Check all services
salt '*' monit.validate
salt.modules.monit.version() New in version 2016.3.0.
Return version from monit -V
salt '*' monit.version
salt.modules.moosefs Module for gathering and managing information about MooseFS
salt.modules.moosefs.dirinfo(path, opts=None) Return information on a directory located on the Moose
salt '*' moosefs.dirinfo /path/to/dir/ [-[n][h|H]]
salt.modules.moosefs.fileinfo(path) Return information on a file located on the Moose
salt '*' moosefs.fileinfo /path/to/dir/
salt.modules.moosefs.getgoal(path, opts=None) Return goal(s) for a file or directory
salt '*' moosefs.getgoal /path/to/file [-[n][h|H]] salt '*' moosefs.getgoal /path/to/dir/ [-[n][h|H][r]]
salt.modules.moosefs.mounts() Return a list of current MooseFS mounts
salt '*' moosefs.mounts
salt.modules.mount Salt module to manage Unix mounts and the fstab file
salt.modules.mount.active(extended=False) List the active mounts.
salt '*' mount.active
salt.modules.mount.automaster(config='/etc/auto_salt') List the contents of the auto master
salt '*' mount.automaster
salt.modules.mount.delete_mount_cache(real_name) New in version 2018.3.0.
Provide information if the path is mounted
salt '*' mount.delete_mount_cache /mnt/share
salt.modules.mount.filesystems(config='/etc/filesystems') New in version 2018.3.3.
List the contents of the filesystems
salt '*' mount.filesystems
salt.modules.mount.fstab(config='/etc/fstab') Changed in version 2016.3.2.
List the contents of the fstab
salt '*' mount.fstab
salt.modules.mount.is_fuse_exec(cmd) Returns true if the command passed is a fuse mountable application.
salt '*' mount.is_fuse_exec sshfs
salt.modules.mount.is_mounted(name) New in version 2014.7.0.
salt '*' mount.is_mounted /mnt/share
salt.modules.mount.mount(name, device=False, mkmnt=False, fstype='', opts='defaults', user=None, util='mount') Mount a device
salt '*' mount.mount /mnt/foo /dev/sdz1 True
salt.modules.mount.read_mount_cache(name) New in version 2018.3.0.
salt '*' mount.read_mount_cache /mnt/share
salt.modules.mount.remount(name, device, mkmnt=False, fstype='', opts='defaults', user=None) Attempt to remount a device, if the device is not already mounted, mount is called
salt '*' mount.remount /mnt/foo /dev/sdz1 True
salt.modules.mount.rm_automaster(name, device, config='/etc/auto_salt') Remove the mount point from the auto_master
salt '*' mount.rm_automaster /mnt/foo /dev/sdg
salt.modules.mount.rm_filesystems(name, device, config='/etc/filesystems') New in version 2018.3.3.
Remove the mount point from the filesystems
salt '*' mount.rm_filesystems /mnt/foo /dev/sdg
salt.modules.mount.rm_fstab(name, device, config='/etc/fstab') Changed in version 2016.3.2.
Remove the mount point from the fstab
salt '*' mount.rm_fstab /mnt/foo /dev/sdg
salt.modules.mount.rm_vfstab(name, device, config='/etc/vfstab') New in version 2016.3.2.
Remove the mount point from the vfstab
salt '*' mount.rm_vfstab /mnt/foo /device/c0t0d0p0
salt.modules.mount.set_automaster(name, device, fstype, opts='', config='/etc/auto_salt', test=False, not_change=False, **kwargs) Verify that this mount is represented in the auto_salt, change the mount to match the data passed, or add the mount if it is not present.
salt '*' mount.set_automaster /mnt/foo /dev/sdz1 ext4
salt.modules.mount.set_filesystems(name, device, vfstype, opts='-', mount='true', config='/etc/filesystems', test=False, match_on='auto', not_change=False, **kwargs) New in version 2018.3.3.
Verify that this mount is represented in the filesystems, change the mount to match the data passed, or add the mount if it is not present on AIX
If the entry is found via match_on and not_change is True, the current line will be preserved. Provide information if the path is mounted
• name -- The name of the mount point where the device is mounted.
• device -- The device that is being mounted.
• vfstype -- The file system that is used (AIX has two fstypes, fstype and vfstype - similar to Linux fstype)
• opts -- Additional options used when mounting the device.
• mount -- Mount if not mounted, default True.
• config -- Configuration file, default /etc/filesystems.
• match -- File systems type to match on, default auto
salt '*' mount.set_filesystems /mnt/foo /dev/sdz1 jfs2
salt.modules.mount.set_fstab(name, device, fstype, opts='defaults', dump=0, pass_num=0, config='/etc/fstab', test=False, match_on='auto', not_change=False, **kwargs) Verify that this mount is represented in the fstab, change the mount to match the data passed, or add the mount if it is not present.
If the entry is found via match_on and not_change is True, the current line will be preserved.
salt '*' mount.set_fstab /mnt/foo /dev/sdz1 ext4
salt.modules.mount.set_vfstab(name, device, fstype, opts='-', device_fsck='-', pass_fsck='-', mount_at_boot='yes', config='/etc/vfstab', test=False, match_on='auto', not_change=False, **kwargs) New in version 2016.3.2.
Verify that this mount is represented in the fstab, change the mount to match the data passed, or add the mount if it is not present.
salt '*' mount.set_vfstab /mnt/foo /device/c0t0d0p0 ufs
salt.modules.mount.swapoff(name) Deactivate a named swap mount
Changed in version 2016.3.2.
salt '*' mount.swapoff /root/swapfile
salt.modules.mount.swapon(name, priority=None) Activate a swap disk
salt '*' mount.swapon /root/swapfile
salt.modules.mount.swaps() Return a dict containing information on active swap
salt '*' mount.swaps
salt.modules.mount.umount(name, device=None, user=None, util='mount') Attempt to unmount a device by specifying the directory it is mounted on
salt '*' mount.umount /mnt/foo
salt '*' mount.umount /mnt/foo /dev/xvdc1
salt.modules.mount.vfstab(config='/etc/vfstab') New in version 2016.3.2.
List the contents of the vfstab
salt '*' mount.vfstab
salt.modules.mount.write_mount_cache(real_name, device, mkmnt, fstype, mount_opts) New in version 2018.3.0.
• real_name -- The real name of the mount point where the device is mounted.
• mkmnt -- Whether or not the mount point should be created.
• fstype -- The file system that is used.
• mount_opts -- Additional options used when mounting the device.
salt '*' mount.write_mount_cache /mnt/share /dev/sda1 False ext4 defaults,nosuid
salt.modules.mssql Module to provide MS SQL Server compatibility to salt.
• FreeTDS
• pymssql Python module
configuration In order to connect to MS SQL Server, certain configuration is required in minion configs/pillars on the relevant minions. Some sample pillars might look like:
mssql.server: 'localhost' mssql.port:   1433 mssql.user:   'sysdba' mssql.password:   'Some preferable complex password' mssql.database: ''
The default for the port is '1433' and for the database is '' (empty string); in most cases they can be left at the default setting.  Options that are directly passed into functions will overwrite options from configs or pillars.
salt.modules.mssql.db_create(database, containment='NONE', new_database_options=None, **kwargs) Creates a new database.  Does not update options of existing databases.  new_database_options can only be a list of strings
salt minion mssql.db_create DB_NAME
salt.modules.mssql.db_exists(database_name, **kwargs) Find if a specific database exists on the MS SQL server.
salt minion mssql.db_exists database_name='DBNAME'
salt.modules.mssql.db_list(**kwargs) Return the database list created on a MS SQL server.
salt minion mssql.db_list
salt.modules.mssql.db_remove(database_name, **kwargs) Drops a specific database from the MS SQL server.  It will not drop any of 'master', 'model', 'msdb' or 'tempdb'.
salt minion mssql.db_remove database_name='DBNAME'
salt.modules.mssql.login_create(login, new_login_password=None, new_login_domain='', new_login_roles=None, new_login_options=None, **kwargs) Creates a new login.  Does not update password of existing logins. For Windows authentication, provide new_login_domain.  For SQL Server authentication, prvide new_login_password.  Since hashed passwords are varbinary values, if the new_login_password is 'int / long', it will be considered to be HASHED.
new_login_roles a list of SERVER roles
new_login_options a list of strings
salt minion mssql.login_create LOGIN_NAME database=DBNAME [new_login_password=PASSWORD]
salt.modules.mssql.login_exists(login, domain='', **kwargs) Find if a login exists in the MS SQL server.  domain, if provided, will be prepended to login
salt minion mssql.login_exists 'LOGIN'
salt.modules.mssql.login_remove(login, **kwargs) Removes an login.
salt minion mssql.login_remove LOGINNAME
salt.modules.mssql.role_create(role, owner=None, grants=None, **kwargs) Creates a new database role.  If no owner is specified, the role will be owned by the user that executes CREATE ROLE, which is the user argument or mssql.user option.  grants is list of strings.
salt minion mssql.role_create role=product01 owner=sysdba grants='["SELECT", "INSERT", "UPDATE", "DELETE", "EXECUTE"]'
salt.modules.mssql.role_exists(role, **kwargs) Checks if a role exists.
salt minion mssql.role_exists db_owner
salt.modules.mssql.role_list(**kwargs) Lists database roles.
salt minion mssql.role_list
salt.modules.mssql.role_remove(role, **kwargs) Remove a database role.
salt minion mssql.role_create role=test_role01
salt.modules.mssql.tsql_query(query, **kwargs) Run a SQL query and return query result as list of tuples, or a list of dictionaries if as_dict was passed, or an empty list if no data is available.
salt minion mssql.tsql_query 'SELECT @@version as version' as_dict=True
salt.modules.mssql.user_create(username, login=None, domain='', database=None, roles=None, options=None, **kwargs) Creates a new user.  If login is not specified, the user will be created without a login.  domain, if provided, will be prepended to username.  options can only be a list of strings
salt minion mssql.user_create USERNAME database=DBNAME
salt.modules.mssql.user_exists(username, domain='', database=None, **kwargs) Find if an user exists in a specific database on the MS SQL server.  domain, if provided, will be prepended to username
salt minion mssql.user_exists 'USERNAME' [database='DBNAME']
salt.modules.mssql.user_list(**kwargs) Get the user list for a specific database on the MS SQL server.
salt minion mssql.user_list [database='DBNAME']
salt.modules.mssql.user_remove(username, **kwargs) Removes an user.
salt minion mssql.user_remove USERNAME database=DBNAME
salt.modules.mssql.version(**kwargs) Return the version of a MS SQL server.
salt minion mssql.version
salt.modules.msteams Module for sending messages to MS Teams
configuration This module can be used by either passing a hook_url directly or by specifying it in a configuration profile in the salt master/minion config. For example:
msteams: hook_url: https://outlook.office.com/webhook/837
salt.modules.msteams.post_card(message, hook_url=None, title=None, theme_color=None) Send a message to an MS Teams channel.  :param message:     The message to send to the MS Teams channel.  :param hook_url:    The Teams webhook URL, if not specified in the configuration.  :param title:       Optional title for the posted card :param theme_color:  Optional hex color highlight for the posted card :return:            Boolean if message was sent successfully.
salt '*' msteams.post_card message="Build is done"
salt.modules.munin Run munin plugins/checks from salt and format the output as data.
salt.modules.munin.list_plugins() List all the munin plugins
salt '*' munin.list_plugins
salt.modules.munin.run(plugins) Run one or more named munin plugins
salt '*' munin.run uptime salt '*' munin.run uptime,cpu,load,memory
salt.modules.munin.run_all() Run all the munin plugins
salt '*' munin.run_all
salt.modules.mysql Module to provide MySQL compatibility to salt.
• MySQLdb Python module
NOTE: On CentOS 5 (and possibly RHEL 5) both MySQL-python and python26-mysqldb need to be installed.
configuration In order to connect to MySQL, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:
mysql.host: 'localhost' mysql.port: 3306 mysql.user: 'root' mysql.pass: '' mysql.db: 'mysql' mysql.unix_socket: '/tmp/mysql.sock' mysql.charset: 'utf8'
You can also use a defaults file:
mysql.default_file: '/etc/mysql/debian.cnf'
Changed in version 2014.1.0: 'charset' connection argument added. This is a MySQL charset, not a python one.
Changed in version 0.16.2: Connection arguments from the minion config file can be overridden on the CLI by using the arguments defined here. Additionally, it is now possible to setup a user with no password.
salt.modules.mysql.alter_db(name, character_set=None, collate=None, **connection_args) Modify database using ALTER DATABASE %(dbname)s CHARACTER SET %(charset)s COLLATE %(collation)s; query.
salt '*' mysql.alter_db testdb charset='latin1'