neulab/tldr huggingface dataset:
Using States to deploy a load balancer with extended arguments to specify region
lb_test: libcloud_loadbalancer.balancer_present: - name: example - port: 80 - protocol: http - profile: google - ex_region: us-east1
salt.states.libcloud_loadbalancer.balancer_absent(name, profile, **libcloud_kwargs) Ensures a load balancer is absent.
• name (str) -- Load Balancer name
salt.states.libcloud_loadbalancer.balancer_present(name, port, protocol, profile, algorithm=None, members=None, **libcloud_kwargs) Ensures a load balancer is present.
• members (list of dict (ip, port)) -- An optional list of members to create on deployment
salt.states.libcloud_loadbalancer.member_absent(ip, port, balancer_id, profile, **libcloud_kwargs) Ensure a load balancer member is absent, based on IP and Port
• ip (str) -- IP address for the member
• port (int) -- Port for the member
• balancer_id (str) -- id of a load balancer you want to detach the member from
salt.states.libcloud_loadbalancer.member_present(ip, port, balancer_id, profile, **libcloud_kwargs) Ensure a load balancer member is present
• balancer_id (str) -- id of a load balancer you want to attach the member to
salt.states.libcloud_loadbalancer.state_result(result, message, name, changes=None)
salt.states.libcloud_storage Apache Libcloud Storage State Manage cloud storage using libcloud
Apache Libcloud Storage (object/blob) management for a full list of supported clouds, see http://libcloud.readthedocs.io/en/latest/storage/supported_providers.html
Creating a container and uploading a file web_things: libcloud_storage.container_present: name: my_container_name profile: profile1 libcloud_storage.object_present: name: my_file.jpg container: my_container_name path: /path/to/local/file.jpg profile: profile1
Downloading a file This example will download the file from the remote cloud and keep it locally
web_things: libcloud_storage.file_present: name: my_file.jpg container: my_container_name path: /path/to/local/file.jpg profile: profile1
salt.states.libcloud_storage.container_absent(name, profile) Ensures a container is absent.
• name (str) -- Container name
salt.states.libcloud_storage.container_present(name, profile) Ensures a container is present.
salt.states.libcloud_storage.file_present(container, name, path, profile, overwrite_existing=False) Ensures a object is downloaded locally.
• container (str) -- Container name
• name (str) -- Object name in cloud
• path (str) -- Local path to file
• overwrite_existing (bool) -- Replace if already exists
salt.states.libcloud_storage.object_absent(container, name, profile) Ensures a object is absent.
salt.states.libcloud_storage.object_present(container, name, path, profile) Ensures a object is presnt.
salt.states.libcloud_storage.state_result(result, message, name, changes)
salt.states.linux_acl Linux File Access Control Lists
The Linux ACL state module requires the getfacl and setfacl binaries.
Ensure a Linux ACL is present
root: acl.present: - name: /root - acl_type: user - acl_name: damian - perms: rwx
Ensure a Linux ACL does not exist
root: acl.absent: - name: /root - acl_type: user - acl_name: damian - perms: rwx
Ensure a Linux ACL list is present
root: acl.list_present: - name: /root - acl_type: user - acl_names: - damian - homer - perms: rwx
Ensure a Linux ACL list does not exist
root: acl.list_absent: - name: /root - acl_type: user - acl_names: - damian - homer - perms: rwx
salt.states.linux_acl.absent(name, acl_type, acl_name='', perms='', recurse=False) Ensure a Linux ACL does not exist
name   The acl path
acl_type The type of the acl is used for, it can be 'user' or 'group'
acl_name The user or group
perms  Remove the permissions eg.: rwx
recurse Set the permissions recursive in the path
salt.states.linux_acl.list_absent(name, acl_type, acl_names=None, recurse=False) Ensure a Linux ACL list does not exist
Takes a list of acl names and remove them from the given path
acl_names The list of users or groups
salt.states.linux_acl.list_present(name, acl_type, acl_names=None, perms='', recurse=False, force=False) Ensure a Linux ACL list is present
Takes a list of acl names and add them to the given path
acl_type The type of the acl is used for it can be 'user' or 'group'
perms  Set the permissions eg.: rwx
force  Wipe out old permissions and ensure only the new permissions are set
salt.states.linux_acl.present(name, acl_type, acl_name='', perms='', recurse=False, force=False) Ensure a Linux ACL is present
acl_name The  user or group
salt.states.locale Management of languages/locales Manage the available locales and the system default:
us_locale: locale.present: - name: en_US.UTF-8
default_locale: locale.system: - name: en_US.UTF-8 - require: - locale: us_locale
salt.states.locale.present(name) Generate a locale if it is not present
name   The name of the locale to be present. Some distributions require the charmap to be specified as part of the locale at this point.
salt.states.locale.system(name) Set the locale for the system
name   The name of the locale to use
salt.states.logadm Management of logs using Solaris logadm.
depends salt.modulus.logadm
platform Oracle Solaris, Sun Solaris, illumos
.. note:: TODO
salt.states.logadm.remove(name, log_file=None) Remove a log from the logadm configuration
name   string entryname
log_file string (optional) log file path
NOTE: If log_file is specified it will be used instead of the entry name.
salt.states.logadm.rotate(name, **kwargs) Add a log to the logadm configuration
salt.states.logrotate Module for managing logrotate.
salt.states.logrotate.set_(name, key, value, setting=None, conf_file='/etc/logrotate.conf') Set a new value for a specific configuration line.
Example of usage with only the required arguments:
logrotate-rotate: logrotate.set: - key: rotate - value: 2
Example of usage specifying all available arguments:
logrotate-wtmp-rotate: logrotate.set: - key: /var/log/wtmp - value: rotate - setting: 2 - conf_file: /etc/logrotate.conf
salt.states.loop Loop state
Allows for looping over execution modules.
In both examples below, the execution module function boto_elb.get_instance_health returns a list of dicts. The condition checks the state-key of the first dict in the returned list and compares its value to the string InService.
wait_for_service_to_be_healthy: loop.until: - name: boto_elb.get_instance_health - condition: m_ret[0]['state'] == 'InService' - period: 5 - timeout: 20 - m_args: - {{ elb }} - m_kwargs: keyid: {{ access_key }} key: {{ secret_key }} instances: "{{ instance }}"
WARNING: This state allows arbitrary python code to be executed through the condition parameter which is literally evaluated within the state. Please use caution.
A version that does not use eval is now available. It uses either the python operator to compare the result of the function called in name, which can be one of the following: lt, le, eq (default), ne, ge, gt. Alternatively, compare_operator can be filled with a function from an execution module in __salt__ or __utils__ like the example below.  The function data.subdict_match checks if the expected expression matches the data returned by calling the name function (with passed args and kwargs).
Wait for service to be healthy: loop.until_no_eval: - name: boto_elb.get_instance_health - expected: '0:state:InService' - compare_operator: data.subdict_match - period: 5 - timeout: 20 - args: - {{ elb }} - kwargs: keyid: {{ access_key }} key: {{ secret_key }} instances: "{{ instance }}"
salt.states.loop.until(name, m_args=None, m_kwargs=None, condition=None, period=1, timeout=60) Loop over an execution module until a condition is met.
• name (str) -- The name of the execution module
• m_args (list) -- The execution module's positional arguments
• m_kwargs (dict) -- The execution module's keyword arguments
• condition (str) -- The condition which must be met for the loop to break.  This should contain m_ret which is the return from the execution module.
• period (int or float) -- The number of seconds to wait between executions
• timeout (int or float) -- The timeout in seconds
salt.states.loop.until_no_eval(name, expected, compare_operator='eq', timeout=60, period=1, init_wait=0, args=None, kwargs=None) Generic waiter state that waits for a specific salt function to produce an expected result.  The state fails if the function does not exist or raises an exception, or does not produce the expected result within the allotted retries.
• name (str) -- Name of the module.function to call
• expected -- Expected return value. This can be almost anything.
• compare_operator (str) -- Operator to use to compare the result of the module.function call with the expected value. This can be anything present in __salt__ or __utils__. Will be called with 2 args: result, expected.
• timeout (int or float) -- Abort after this amount of seconds (excluding init_wait).
• period (int or float) -- Time (in seconds) to wait between attempts.
• init_wait (int or float) -- Time (in seconds) to wait before trying anything.
• args (list) -- args to pass to the salt module.function.
• kwargs (dict) -- kwargs to pass to the salt module.function.
salt.states.lvm Management of Linux logical volumes A state module to manage LVMs
/dev/sda: lvm.pv_present
my_vg: lvm.vg_present: - devices: /dev/sda
lvroot: lvm.lv_present: - vgname: my_vg - size: 10G - stripes: 5 - stripesize: 8K
salt.states.lvm.lv_absent(name, vgname=None) Remove a given existing Logical Volume from a named existing volume group
name   The Logical Volume to remove
vgname The name of the Volume Group on which the Logical Volume resides
salt.states.lvm.lv_present(name, vgname=None, size=None, extents=None, snapshot=None, pv='', thinvolume=False, thinpool=False, force=False, resizefs=False, **kwargs) Ensure that a Logical Volume is present, creating it if absent.
name   The name of the Logical Volume
size   The size of the Logical Volume in megabytes, or use a suffix such as S, M, G, T, P for 512 byte sectors, megabytes, gigabytes or terabytes respectively. The suffix is case insensitive.
extents The number of logical extents allocated to the Logical Volume It can be a percentage allowed by lvcreate's syntax, in this case it will set the Logical Volume initial size and won't be resized.
snapshot The name of the snapshot
pv     The Physical Volume to use
kwargs Any supported options to lvcreate. See linux_lvm for more details.
thinvolume Logical Volume is thinly provisioned
thinpool Logical Volume is a thin pool
force  Assume yes to all prompts
New in version 3002.0.
resizefs Use fsadm to resize the logical volume filesystem if needed
salt.states.lvm.pv_absent(name) Ensure that a Physical Device is not being used by lvm
name   The device name to initialize.
salt.states.lvm.pv_present(name, **kwargs) Set a Physical Device to be used as an LVM Physical Volume
kwargs Any supported options to pvcreate. See linux_lvm for more details.
salt.states.lvm.vg_absent(name) Remove an LVM volume group
name   The volume group to remove
salt.states.lvm.vg_present(name, devices=None, **kwargs) Create an LVM Volume Group
name   The Volume Group name to create
devices A list of devices that will be added to the Volume Group
kwargs Any supported options to vgcreate. See linux_lvm for more details.
salt.states.lvs_server Management of LVS (Linux Virtual Server) Real Server salt.states.lvs_server.absent(name, protocol=None, service_address=None, server_address=None) Ensure the LVS Real Server in specified service is absent.
name   The name of the LVS server.
server_address The LVS real server address.
salt.states.lvs_server.present(name, protocol=None, service_address=None, server_address=None, packet_forward_method='dr', weight=1) Ensure that the named service is present.
name   The LVS server name
protocol The service protocol
service_address The LVS service address
lvsrs: lvs_server.present: - protocol: tcp - service_address: 1.1.1.1:80 - server_address: 192.168.0.11:8080 - packet_forward_method: dr - weight: 10
salt.states.lvs_service Management of LVS (Linux Virtual Server) Service salt.states.lvs_service.absent(name, protocol=None, service_address=None) Ensure the LVS service is absent.
name   The name of the LVS service
salt.states.lvs_service.present(name, protocol=None, service_address=None, scheduler='wlc') Ensure that the named service is present.
name   The LVS service name
lvstest: lvs_service.present: - service_address: 1.1.1.1:80 - protocol: tcp - scheduler: rr
salt.states.lxc Manage Linux Containers salt.states.lxc.absent(name, stop=False, path=None) Ensure a container is not present, destroying it if present
name   Name of the container to destroy
stop   stop before destroying default: false
web01: lxc.absent
salt.states.lxc.edited_conf(name, lxc_conf=None, lxc_conf_unset=None)
WARNING: This state is unsuitable for setting parameters that appear more than once in an LXC config file, or parameters which must appear in a certain order (such as when configuring more than one network interface).
Issue #35523 was opened to track the addition of a suitable replacement or fix.
Edit LXC configuration options
Deprecated since version 2015.5.0.
setconf: lxc.edited_conf: - name: ubuntu - lxc_conf: - network.ipv4.ip: 10.0.3.6 - lxc_conf_unset: - lxc.utsname
salt.states.lxc.frozen(name, start=True, path=None) New in version 2015.5.0.
Ensure that a container is frozen
NOTE: This state does not enforce the existence of the named container, it just freezes the container if it is running. To ensure that the named container exists, use lxc.present.
start  True Start container first, if necessary. If False, then this state will fail if the container is not running.
web01: lxc.frozen
web02: lxc.frozen: - start: False
salt.states.lxc.present(name, running=None, clone_from=None, snapshot=False, profile=None, network_profile=None, template=None, options=None, image=None, config=None, fstype=None, size=None, backing=None, vgname=None, lvname=None, thinpool=None, path=None) Changed in version 2015.8.0: The lxc.created state has been renamed to lxc.present, and the lxc.cloned state has been merged into this state.
Create the named container if it does not exist
name   The name of the container to be created
running False.INDENT 7.0
• If True, ensure that the container is running
• If False, ensure that the container is stopped
• If None, do nothing with regards to the running state of the container
clone_from Create named container as a clone of the specified container
snapshot False Use Copy On Write snapshots (LVM). Only supported with clone_from.
profile Profile to use in container creation (see the LXC Tutorial for more information). Values in a profile will be overridden by the parameters listed below.
network_profile Network Profile to use in container creation (see the LXC Tutorial for more information). Values in a profile will be overridden by the parameters listed below.
options New in version 2015.5.0.
Template-specific options to pass to the lxc-create command. These correspond to the long options (ones beginning with two dashes) that the template script accepts. For example:
web01: lxc.present: - template: download - options: dist: centos release: 6 arch: amd64
Remember to double-indent the options, due to how PyYAML works.
size   Size of the volume to create. Only applicable if backing is set to lvm.
vgname lxc Name of the LVM volume group in which to create the volume for this container. Only applicable if backing is set to lvm.
lvname Name of the LVM logical volume in which to create the volume for this container. Only applicable if backing is set to lvm.
thinpool Name of a pool volume that will be used for thin-provisioning this container. Only applicable if backing is set to lvm.
salt.states.lxc.running(name, restart=False, path=None) Changed in version 2015.5.0: The lxc.started state has been renamed to lxc.running
Ensure that a container is running
NOTE: This state does not enforce the existence of the named container, it just starts the container if it is not running. To ensure that the named container exists, use lxc.present.
restart False Restart container if it is already running
web01: lxc.running
web02: lxc.running: - restart: True
salt.states.lxc.set_pass(name, **kwargs) Deprecated since version 2015.5.0.
This state function has been disabled, as it did not conform to design guidelines. Specifically, due to the fact that lxc.set_password uses chpasswd(8) to set the password, there was no method to make this action idempotent (in other words, the password would be changed every time). This makes this state redundant, since the following state will do the same thing:
setpass: module.run: - name: set_pass - m_name: root - password: secret
salt.states.lxc.stopped(name, kill=False, path=None) Ensure that a container is stopped
NOTE: This state does not enforce the existence of the named container, it just stops the container if it running or frozen. To ensure that the named container exists, use lxc.present, or use the lxc.absent state to ensure that the container does not exist.
kill   False Do not wait for the container to stop, kill all tasks in the container.  Older LXC versions will stop containers like this irrespective of this argument.
web01: lxc.stopped
salt.states.lxd Manage LXD profiles.
salt.states.lxd.authenticate(name, remote_addr, password, cert, key, verify_cert=True) Authenticate with a remote peer.
remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr!
password : The PaSsW0rD
cert : PEM Formatted SSL Zertifikate.
Examples: /root/.config/lxc/client.crt
Examples: /root/.config/lxc/client.key
name:  Ignore this. This is just here for salt.
salt.states.lxd.config_managed(name, value, force_password=False) Manage a LXD Server config setting.
name : The name of the config key.
value : Its value.
force_password False Set this to True if you want to set the password on every run.
As we can't retrieve the password from LXD we can't check if the current one is the same as the given one.
salt.states.lxd.init(name, storage_backend='dir', trust_password=None, network_address=None, network_port=None, storage_create_device=None, storage_create_loop=None, storage_pool=None, done_file='%SALT_CONFIG_DIR%/lxd_initialized') Initializes the LXD Daemon, as LXD doesn't tell if its initialized we touch the done_file and check if it exist.
This can only be called once per host unless you remove the done_file.
name : Ignore this. This is just here for salt.
done_file : Path where we check that this method has been called, as it can run only once and there's currently no way to ask LXD if init has been called.
salt.states.lxd_container Manage LXD containers.
salt.states.lxd_container.absent(name, stop=False, remote_addr=None, cert=None, key=None, verify_cert=True) Ensure a LXD container is not present, destroying it if present
name : The name of the container to destroy
stop : stop before destroying default: false
salt.states.lxd_container.frozen(name, start=True, remote_addr=None, cert=None, key=None, verify_cert=True) Ensure a LXD container is frozen, start and freeze it if start is true
name : The name of the container to freeze
start : start and freeze it
salt.states.lxd_container.migrated(name, remote_addr, cert, key, verify_cert, src_remote_addr, stop_and_start=False, src_cert=None, src_key=None, src_verify_cert=None) Ensure a container is migrated to another host
For this operation both certs need to be authenticated, use lxd.authenticate <salt.states.lxd.authenticate to authenticate your cert(s).
name : The container to migrate
remote_addr : An URL to the destination remote Server
src_remote_addr : An URL to the source remote Server
stop_and_start: Stop before migrating and start after
src_cert : PEM Formatted SSL Zertifikate, if None we copy "cert"
src_key : PEM Formatted SSL Key, if None we copy "key"
src_verify_cert : Wherever to verify the cert, if None we copy "verify_cert"
salt.states.lxd_container.present(name, running=None, source=None, profiles=None, config=None, devices=None, architecture='x86_64', ephemeral=False, restart_on_change=False, remote_addr=None, cert=None, key=None, verify_cert=True) Create the named container if it does not exist
running None.INDENT 7.0
source None Can be either a string containing an image alias:
"xenial/amd64"
or an dict with type "image" with alias:
{"type": "image", "alias": "xenial/amd64"}
or image with "fingerprint":
{"type": "image", "fingerprint": "SHA-256"}
or image with "properties":
{"type": "image", "properties": { "os": "ubuntu", "release": "14.04", "architecture": "x86_64" }}
or none:
{"type": "none"}
{"type": "copy", "source": "my-old-container"}
architecture 'x86_64' Can be one of the following:
restart_on_change False Restart the container when we detect changes on the config or its devices?
salt.states.lxd_container.running(name, restart=False, remote_addr=None, cert=None, key=None, verify_cert=True) Ensure a LXD container is running and restart it if restart is True
name : The name of the container to start/restart.
restart : restart the container if it is already started.
salt.states.lxd_container.stopped(name, kill=False, remote_addr=None, cert=None, key=None, verify_cert=True) Ensure a LXD container is stopped, kill it if kill is true else stop it
name : The name of the container to stop
kill : kill if true
salt.states.lxd_image Manage LXD images.
salt.states.lxd_image.absent(name, remote_addr=None, cert=None, key=None, verify_cert=True)
name : An alias or fingerprint of the image to check and delete.
salt.states.lxd_image.present(name, source, aliases=None, public=None, auto_update=None, remote_addr=None, cert=None, key=None, verify_cert=True) Ensure an image exists, copy it else from source
name : An alias of the image, this is used to check if the image exists and it will be added as alias to the image on copy/create.
source : Source dict.
For an LXD to LXD copy:
source: type: lxd name: ubuntu/xenial/amd64  # This can also be a fingerprint. remote_addr: https://images.linuxcontainers.org:8443 cert: ~/.config/lxd/client.crt key: ~/.config/lxd/client.key verify_cert: False
From file:
source: type: file filename: salt://lxd/files/busybox.tar.xz saltenv: base
From simplestreams:
source: type: simplestreams server: https://cloud-images.ubuntu.com/releases name: xenial/amd64
From an URL:
source: type: url url: https://dl.stgraber.org/lxd
aliases : List of aliases to append, can be empty.
Make this image public available on this instance? None on source_type LXD means copy source None on source_type file means False
auto_update :
Try to auto-update from the original source? None on source_type LXD means copy source source_type file does not have auto-update.
salt.states.lxd_profile Manage LXD profiles.
salt.states.lxd_profile.absent(name, remote_addr=None, cert=None, key=None, verify_cert=True) Ensure a LXD profile is not present, removing it if present.
name : The name of the profile to remove.
salt.states.lxd_profile.present(name, description=None, config=None, devices=None, remote_addr=None, cert=None, key=None, verify_cert=True) Creates or updates LXD profiles
name : The name of the profile to create/update
description : A description string
See the lxd-docs for the details about the config and devices dicts.  See the requests-docs for the SSL stuff.
salt.states.mac_assistive Allows you to manage assistive access on macOS minions with 10.9+ Install, enable and disable assistive access on macOS minions
/usr/bin/osacript: assistive.installed: - enabled: True
salt.states.mac_assistive.installed(name, enabled=True) Make sure that we have the given bundle ID or path to command installed in the assistive access panel.
name   The bundle ID or path to command
enable Should assistive access be enabled on this application?
salt.states.mac_keychain Installing of certificates to the keychain Install certificats to the macOS keychain
/mnt/test.p12: keychain.installed: - password: test123
salt.states.mac_keychain.default_keychain(name, domain='user', user=None) Set the default keychain to use
name   The chain in which to use as the default
user   The user to run as
salt.states.mac_keychain.installed(name, password, keychain='/Library/Keychains/System.keychain', **kwargs) Install a p12 certificate file into the macOS keychain
name   The certificate to install
salt.states.mac_keychain.uninstalled(name, password, keychain='/Library/Keychains/System.keychain', keychain_password=None) Uninstall a p12 certificate file from the macOS keychain
name   The certificate to uninstall, this can be a path for a .p12 or the friendly name
cert_name The friendly name of the certificate, this can be used instead of giving a certificate
keychain The keychain to remove the certificate from, this defaults to /Library/Keychains/System.keychain
salt.states.mac_xattr Allows you to manage extended attributes on files or directories Install, enable and disable assistive access on macOS minions
/path/to/file: xattr.exists: - attributes: - com.file.attr=test - com.apple.quarantine=0x00001111
salt.states.mac_xattr.delete(name, attributes) Make sure the given attributes are deleted from the file/directory
name   The path to the file/directory
attributes The attributes that should be removed from the file/directory, this is accepted as an array.
salt.states.mac_xattr.exists(name, attributes) Make sure the given attributes exist on the file/directory
attributes The attributes that should exist on the file/directory, this is accepted as an array, with key and value split with an equals sign, if you want to specify a hex value then add 0x to the beginning of the value.
salt.states.macdefaults Writing/reading defaults from a macOS minion salt.states.macdefaults.absent(name, domain, user=None) Make sure the defaults value is absent
name   The key of the given domain to remove
domain The name of the domain to remove from
salt.states.macdefaults.write(name, domain, value, vtype='string', user=None) Write a default to the system
name   The key of the given domain to write to
vtype  The type of value to be written, valid types are string, data, int[eger], float, bool[ean], date, array, array-add, dict, dict-add
salt.states.macpackage Installing of mac pkg files Install any kind of pkg, dmg or app file on macOS:
/mnt/test.pkg: macpackage.installed: - store: True
/mnt/test.dmg: macpackage.installed: - dmg: True
/mnt/xcode.dmg: macpackage.installed: - dmg: True - app: True - target: /Applications/Xcode.app - version_check: xcodebuild -version=Xcode 7.1\n.*7B91b
salt.states.macpackage.installed(name, target='LocalSystem', dmg=False, store=False, app=False, mpkg=False, force=False, allow_untrusted=False, version_check=None) Install a Mac OS Package from a pkg or dmg file, if given a dmg file it will first be mounted in a temporary location
name   The pkg or dmg file to install
target The location in which to install the package. This can be a path or LocalSystem
dmg    Is the given file a dmg file?
store  Should the pkg be installed as if it was from the Mac OS Store?
app    Is the file a .app? If so then we'll just copy that to /Applications/ or the given target
mpkg   Is the file a .mpkg? If so then we'll check all of the .pkg files found are installed
force  Force the package to be installed even if its already been found installed
allow_untrusted Allow the installation of untrusted packages
version_check The command and version that we want to check against, the version number can use regex.
version_check: python --version_check=2.7.[0-9]
salt.states.makeconf Management of Gentoo make.conf A state module to manage Gentoo's make.conf file
makeopts: makeconf.present: - value: '-j3'
salt.states.makeconf.absent(name) Verify that the variable is not in the make.conf.
name   The variable name. This will automatically be converted to upper case since variables in make.conf are in upper case
salt.states.makeconf.present(name, value=None, contains=None, excludes=None) Verify that the variable is in the make.conf and has the provided settings. If value is set, contains and excludes will be ignored.
value  Enforce that the value of the variable is set to the provided value
contains Enforce that the value of the variable contains the provided value
excludes Enforce that the value of the variable does not contain the provided value.
salt.states.marathon_app Configure Marathon apps via a salt proxy.
my_app: marathon_app.config: - config: cmd: "while [ true ] ; do echo 'Hello Marathon' ; sleep 5 ; done" cpus: 0.1 mem: 10 instances: 3
salt.states.marathon_app.absent(name) Ensure that the marathon app with the given id is not present.
Parameters name -- The app name/id
salt.states.marathon_app.config(name, config) Ensure that the marathon app with the given id is present and is configured to match the given config values.
• name -- The app name/id
salt.states.marathon_app.running(name, restart=False, force=True) Ensure that the marathon app with the given id is present and restart if set.
salt.states.mdadm_raid Managing software RAID with mdadm depends mdadm
A state module for creating or destroying software RAID devices.
/dev/md0: raid.present: - level: 5 - devices: - /dev/xvdd - /dev/xvde - /dev/xvdf - chunk: 256 - run: True
salt.states.mdadm_raid.absent(name) Verify that the raid is absent
name   The name of raid device to be destroyed
/dev/md0: raid: - absent
salt.states.mdadm_raid.present(name, level, devices, **kwargs) Verify that the raid is present
name   The name of raid device to be created
salt.states.memcached States for Management of Memcached Keys New in version 2014.1.0.
salt.states.memcached.absent(name, value=None, host='127.0.0.1', port=11211, time=0) Ensure that a memcached key is not present.
name   The key
value  None If specified, only ensure that the key is absent if it matches the specified value.
host   The memcached server IP address
port   The memcached server port
foo: memcached.absent
bar: memcached.absent: - host: 10.0.0.1
salt.states.memcached.managed(name, value=None, host='127.0.0.1', port=11211, time=0, min_compress_len=0) Manage a memcached key.
name   The key to manage
value  The value to set for that key
foo: memcached.managed: - value: bar
salt.states.modjk State to control Apache modjk
salt.states.modjk.worker_activated(name, workers=None, profile='default') Activate all the workers in the modjk load balancer
loadbalancer: modjk.worker_activated: - workers: - app1 - app2
salt.states.modjk.worker_disabled(name, workers=None, profile='default') Disable all the workers in the modjk load balancer
loadbalancer: modjk.worker_disabled: - workers: - app1 - app2
salt.states.modjk.worker_recover(name, workers=None, profile='default') Recover all the workers in the modjk load balancer
loadbalancer: modjk.worker_recover: - workers: - app1 - app2
salt.states.modjk.worker_stopped(name, workers=None, profile='default') Stop all the workers in the modjk load balancer
loadbalancer: modjk.worker_stopped: - workers: - app1 - app2
salt.states.modjk_worker Manage modjk workers Send commands to a modjk load balancer via the peer system.
This module can be used with the prereq requisite to remove/add the worker from the load balancer before deploying/restarting service.
Mandatory Settings:
• The minion needs to have permission to publish the modjk.*  functions (see here for information on configuring peer publishing permissions)
• The modjk load balancer must be configured as stated in the modjk execution module documentation
salt.states.modjk_worker.activate(name, lbn, target, profile='default', tgt_type='glob') Changed in version 2017.7.0: The expr_form argument has been renamed to tgt_type, earlier releases must use expr_form.
Activate the named worker from the lbn load balancers at the targeted minions
disable-before-deploy: modjk_worker.activate: - name: {{ grains['id'] }} - lbn: application - target: 'roles:balancer' - tgt_type: grain
salt.states.modjk_worker.disable(name, lbn, target, profile='default', tgt_type='glob') Changed in version 2017.7.0: The expr_form argument has been renamed to tgt_type, earlier releases must use expr_form.
Disable the named worker from the lbn load balancers at the targeted minions. The worker will get traffic only for current sessions and won't get new ones.
disable-before-deploy: modjk_worker.disable: - name: {{ grains['id'] }} - lbn: application - target: 'roles:balancer' - tgt_type: grain
salt.states.modjk_worker.stop(name, lbn, target, profile='default', tgt_type='glob') Changed in version 2017.7.0: The expr_form argument has been renamed to tgt_type, earlier releases must use expr_form.
Stop the named worker from the lbn load balancers at the targeted minions The worker won't get any traffic from the lbn
disable-before-deploy: modjk_worker.stop: - name: {{ grains['id'] }} - lbn: application - target: 'roles:balancer' - tgt_type: grain
salt.states.module Execution of Salt modules from within states NOTE: There are two styles of calling module.run. The legacy style will no longer be available starting in the 3005 release. To opt-in early to the new style you must add the following to your /etc/salt/minion config file:
use_superseded: - module.run
With module.run these states allow individual execution module calls to be made via states. Here's a contrived example, to show you how it's done:
# New Style test.random_hash: module.run: - test.random_hash: - size: 42 - hash_type: sha256
# Legacy Style test.random_hash: module.run: - size: 42 - hash_type: sha256
In the new style, the state ID (test.random_hash, in this case) is irrelevant when using module.run. It could have very well been written:
Generate a random hash: module.run: - test.random_hash: - size: 42 - hash_type: sha256
For a simple state like that it's not a big deal, but if the module you're using has certain parameters, things can get cluttered, fast. Using the contrived custom module (stuck in /srv/salt/_modules/foo.py, or your configured file_roots):
def bar(name, names, fun, state, saltenv): return "Name: {name} Names: {names} Fun: {fun} State: {state} Saltenv: {saltenv}".format(**locals())
Your legacy state has to look like this:
# Legacy style Unfortunate example: module.run: - name: foo.bar - m_name: Some name - m_names: - Such names - very wow - m_state: Arkansas - m_fun: Such fun - m_saltenv: Salty
With the new style it's much cleaner:
# New style Better: module.run: - foo.bar: - name: Some name - names: - Such names - very wow - state: Arkansas - fun: Such fun - saltenv: Salty
The new style also allows multiple modules in one state. For instance, you can do this:
Do many things: module.run: - test.random_hash: - size: 10 - hash_type: md5 # Note the `:` at the end - test.true: - test.arg: - this - has - args - and: kwargs - isn't: that neat? # Note the `:` at the end, too - test.version: - test.fib: - 4
Where in the legacy style you would have had to split your states like this:
test.random_hash: module.run: - size: 10 - hash_type: md5
test.nop: module.run
test.arg: module.run: - args: - this - has - args - kwargs: and: kwargs isn't: that neat?
test.version: module.run
Another difference is that in the legacy style, unconsumed arguments to the module state were simply passed into the module function being executed:
show off module.run with args: module.run: - name: test.random_hash - size: 42 - hash_type: sha256
The new style is much more explicit, with the arguments and keyword arguments being nested under the name of the function:
show off module.run with args: module.run: # Note the lack of `name: `, and trailing `:` - test.random_hash: - size: 42 - hash_type: sha256
If the function takes *args, they can be passed in as well:
args and kwargs: module.run: - test.arg: - isn't - this - fun - this: that - salt: stack
Modern Examples Here are some other examples using the modern module.run:
fetch_out_of_band: module.run: - git.fetch: - cwd: /path/to/my/repo - user: myuser - opts: '--all'
A more complex example:
eventsviewer: module.run: - task.create_task: - name: events-viewer - user_name: System - action_type: Execute - cmd: 'c:\netops\scripts\events_viewer.bat' - trigger_type: 'Daily' - start_date: '2017-1-20' - start_time: '11:59PM'
It is sometimes desirable to trigger a function call after a state is executed, for this the module.wait state can be used:
add example to hosts: file.append: - name: /etc/hosts - text: 203.0.113.13     example.com
# New Style mine.send: module.wait: # Again, note the trailing `:` - hosts.list_hosts: - watch: - file: add example to hosts
Legacy (Default) Examples If you're using the legacy module.run, due to how the state system works, if a module function accepts an argument called, name, then m_name must be used to specify that argument, to avoid a collision with the name argument.
Here is a list of keywords hidden by the state system, which must be prefixed with m_:
• fun
• name
• names
• state
• saltenv
disable_nfs: module.run: - name: service.disable - m_name: nfs
Note that some modules read all or some of the arguments from a list of keyword arguments. For example:
mine.send: module.run: - func: network.ip_addrs - kwargs: interface: eth0
cloud.create: module.run: - func: cloud.create - provider: test-provider - m_names: - test-vlad - kwargs: { ssh_username: 'ubuntu', image: 'ami-8d6d9daa', securitygroup: 'default', size: 'c3.large', location: 'ap-northeast-1', delvol_on_destroy: 'True' }
Other modules take the keyword arguments using this style:
mac_enable_ssh: module.run: - name: system.set_remote_login - enable: True
Another example that creates a recurring task that runs a batch file on a Windows system:
eventsviewer: module.run: - name: task.create_task - m_name: 'events-viewer' - user_name: System - kwargs: { action_type: 'Execute', cmd: 'c:\netops\scripts\events_viewer.bat', trigger_type: 'Daily', start_date: '2017-1-20', start_time: '11:59PM' }
salt.states.module.run(**kwargs) Run a single module function or a range of module functions in a batch.  Supersedes module.run function, which requires m_ prefix to function-specific parameters.
• returner -- Specify a common returner for the whole batch to send the return data
• kwargs -- Pass any arguments needed to execute the function(s)
some_id_of_state: module.run: - network.ip_addrs: - interface: eth0 - cloud.create: - names: - test-isbm-1 - test-isbm-2 - ssh_username: sles - image: sles12sp2 - securitygroup: default - size: 'c3.large' - location: ap-northeast-1 - delvol_on_destroy: True
salt.states.module.wait(name, **kwargs) Run a single module function only if the watch statement calls it
name   The module function to execute
**kwargs Pass any arguments needed to execute the function
NOTE: Like the cmd.run state, this state will return True but not actually execute, unless one of the following two things happens:
1. The state has a watch requisite, and the state which it is watching changes.
2. Another state has a watch_in requisite which references this state, and the state wth the watch_in changes.
salt.states.module.watch(name, **kwargs) This function is an alias of wait. Run a single module function only if the watch statement calls it
salt.states.mongodb_database Management of MongoDB Databases depends
• pymongo Python module
Only deletion is supported, creation doesn't make sense and can be done using mongodb_user.present.
salt.states.mongodb_database.absent(name, user=None, password=None, host=None, port=None, authdb=None) Ensure that the named database is absent. Note that creation doesn't make sense in MongoDB.
authdb The database in which to authenticate
salt.states.mongodb_user Management of MongoDB Users depends
salt.states.mongodb_user.absent(name, user=None, password=None, host=None, port=None, database='admin', authdb=None) Ensure that the named user is absent
user   MongoDB user with sufficient privilege to create the user
password Password for the admin user specified by the user parameter
host   The hostname/IP address of the MongoDB server
port   The port on which MongoDB is listening
database The database from which to remove the user specified by the name parameter
salt.states.mongodb_user.present(name, passwd, database='admin', user=None, password=None, host='localhost', port=27017, authdb=None, roles=None) Ensure that the user is present with the specified properties
passwd The password of the user to manage
password Password for the admin user specified with the user parameter
database The database in which to create the user
NOTE: If the database doesn't exist, it will be created.
roles  The roles assigned to user specified with the name parameter
mongouser-myapp: mongodb_user.present: - name: myapp - passwd: password-of-myapp - database: admin # Connect as admin:sekrit - user: admin - password: sekrit - roles: - readWrite - userAdmin - dbOwner
salt.states.monit Monit state Manage monit states
monit_enable_service_monitoring: monit.monitor: - name: service
monit_disable_service_monitoring: monit.unmonitor: - name: service
NOTE: Use of these states require that the monit execution module is available.
salt.states.monit.monitor(name) Get the summary from module monit and try to see if service is being monitored. If not then monitor the service.
salt.states.monit.unmonitor(name) Get the summary from module monit and try to see if service is being monitored. If it is then stop monitoring the service.
salt.states.mount Mounting of filesystems Mount any type of mountable filesystem with the mounted function:
/mnt/sdb: mount.mounted: - device: /dev/sdb1 - fstype: ext4 - mkmnt: True - opts: - defaults
/srv/bigdata: mount.mounted: - device: UUID=066e0200-2867-4ebe-b9e6-f30026ca2314 - fstype: xfs - opts: nobootwait,noatime,nodiratime,nobarrier,logbufs=8 - dump: 0 - pass_num: 2 - persist: True - mkmnt: True
/var/lib/bigdata: mount.mounted: - device: /srv/bigdata - fstype: none - opts: bind - dump: 0 - pass_num: 0 - persist: True - mkmnt: True
salt.states.mount.fstab_absent(name, fs_file, mount_by=None, config='/etc/fstab') Makes sure that a fstab mount point is absent.
name   The name of block device. Can be any valid fs_spec value.
fs_file Mount point (target) for the filesystem.
mount_by Select the final value for fs_spec. Can be [None, device, label, uuid, partlabel, partuuid]. If None, the value for fs_spect will be the parameter name, in other case will search the correct value based on the device name. For example, for uuid, the value for fs_spec will be of type 'UUID=xxx' instead of the device name set in name.
config Place where the fstab file lives
salt.states.mount.fstab_present(name, fs_file, fs_vfstype, fs_mntops='defaults', fs_freq=0, fs_passno=0, mount_by=None, config='/etc/fstab', mount=True, match_on='auto', not_change=False, fs_mount=True) Makes sure that a fstab mount point is present.
fs_vfstype The type of the filesystem (e.g. ext4, xfs, btrfs, ...)
fs_mntops The mount options associated with the filesystem. Default is defaults.
fs_freq Field is used by dump to determine which fs need to be dumped. Default is 0
fs_passno Field is used by fsck to determine the order in which filesystem checks are done at boot time. Default is 0
fs_mount Field is used only in AIX systems to determine if the filesystem will be mounted by mount all
config Place where the fstab file lives. Default is /etc/fstab
mount  Set if the mount should be mounted immediately. Default is True
match_on A name or list of fstab properties on which this state should be applied.  Default is auto, a special value indicating to guess based on fstype.  In general, auto matches on name for recognized special devices and device otherwise.
not_change By default, if the entry is found in the fstab file but is different from the expected content (like different options), the entry will be replaced with the correct content. If this parameter is set to True and the line is found, the original content will be preserved.
salt.states.mount.mod_watch(name, user=None, **kwargs) The mounted watcher, called to invoke the watch command.
name   The name of the mount point
salt.states.mount.mounted(name, device, fstype, mkmnt=False, opts='defaults', dump=0, pass_num=0, config='/etc/fstab', persist=True, mount=True, user=None, match_on='auto', device_name_regex=None, extra_mount_invisible_options=None, extra_mount_invisible_keys=None, extra_mount_ignore_fs_keys=None, extra_mount_translate_options=None, hidden_opts=None, **kwargs) Verify that a device is mounted
name   The path to the location where the device is to be mounted
device The device name, typically the device node, such as /dev/sdb1 or UUID=066e0200-2867-4ebe-b9e6-f30026ca2314 or LABEL=DATA
fstype The filesystem type, this will be xfs, ext2/3/4 in the case of classic filesystems, fuse in the case of fuse mounts, and nfs in the case of nfs mounts
mkmnt  If the mount point is not present then the state will fail, set mkmnt: True to create the mount point if it is otherwise not present
dump   The dump value to be passed into the fstab, Default is 0
pass_num The pass value to be passed into the fstab, Default is 0
config Set an alternative location for the fstab, Default is /etc/fstab
persist Set if the mount should be saved in the fstab, Default is True
mount  Set if the mount should be mounted immediately, Default is True
user   The account used to execute the mount; this defaults to the user salt is running as on the minion
device_name_regex A list of device exact names or regular expressions which should not force a remount. For example, glusterfs may be mounted with a comma-separated list of servers in fstab, but the /proc/self/mountinfo will show only the first available server.
{% set glusterfs_ip_list = ['10.0.0.1', '10.0.0.2', '10.0.0.3'] %}
mount glusterfs volume: mount.mounted: - name: /mnt/glusterfs_mount_point - device: {{ glusterfs_ip_list|join(',') }}:/volume_name - fstype: glusterfs - opts: _netdev,rw,defaults,direct-io-mode=disable - mkmnt: True - persist: True - dump: 0 - pass_num: 0 - device_name_regex: - ({{ glusterfs_ip_list|join('|') }}):/volume_name
extra_mount_invisible_options A list of extra options that are not visible through the /proc/self/mountinfo interface.
If a option is not visible through this interface it will always remount the device. This option extends the builtin mount_invisible_options list.
extra_mount_invisible_keys A list of extra key options that are not visible through the /proc/self/mountinfo interface.
If a key option is not visible through this interface it will always remount the device. This option extends the builtin mount_invisible_keys list.
A good example for a key option is the password option:
password=badsecret
extra_mount_ignore_fs_keys A dict of filesystem options which should not force a remount. This will update the internal dictionary. The dict should look like this:
{ 'ramfs': ['size'] }
extra_mount_translate_options A dict of mount options that gets translated when mounted. To prevent a remount add additional options to the default dictionary. This will update the internal dictionary. The dictionary should look like this:
{ 'tcp': 'proto=tcp', 'udp': 'proto=udp' }
hidden_opts A list of mount options that will be ignored when considering a remount as part of the state application
salt.states.mount.swap(name, persist=True, config='/etc/fstab') Activates a swap device
/root/swapfile: mount.swap
NOTE: swap does not currently support LABEL
salt.states.mount.unmounted(name, device=None, config='/etc/fstab', persist=False, user=None, **kwargs) New in version 0.17.0.
Verify that a device is not mounted
name   The path to the location where the device is to be unmounted from
device The device to be unmounted.  This is optional because the device could be mounted in multiple places.
persist Set if the mount should be purged from the fstab, Default is False
user   The user to own the mount; this defaults to the user salt is running as on the minion
salt.states.mssql_database Management of Microsoft SQLServer Databases The mssql_database module is used to create and manage SQL Server Databases
yolo: mssql_database.present
salt.states.mssql_database.absent(name, **kwargs) Ensure that the named database is absent
salt.states.mssql_database.present(name, containment='NONE', options=None, **kwargs) Ensure that the named database is present with the specified options
containment Defaults to NONE
options Can be a list of strings, a dictionary, or a list of dictionaries
salt.states.mssql_login Management of Microsoft SQLServer Logins The mssql_login module is used to create and manage SQL Server Logins
frank: mssql_login.present - domain: mydomain
salt.states.mssql_login.absent(name, **kwargs) Ensure that the named login is absent
name   The name of the login to remove
salt.states.mssql_login.present(name, password=None, domain=None, server_roles=None, options=None, **kwargs) Checks existence of the named login.  If not present, creates the login with the specified roles and options.