text
stringlengths
81
112k
Ensure cache subnet group exists. name A name for the cache subnet group. This value is stored as a lowercase string. Constraints: Must contain no more than 255 alphanumeric characters or hyphens. subnets A list of VPC subnets (IDs, Names, or a mix) for the cache subnet group. Ca...
Ensure a given cache subnet group is deleted. name Name of the cache subnet group. CacheSubnetGroupName A name for the cache subnet group. Note: In general this parameter is not needed, as 'name' is used if it's not provided. region Region to connect to. key ...
Ensure cache parameter group exists. name A name for the cache parameter group. CacheParameterGroupName A name for the cache parameter group. Note: In general this parameter is not needed, as 'name' is used if it's not provided. CacheParameterGroupFamily The name of the ...
Given identity pool name (or optionally a pool_id and name will be ignored), find and return list of matching identity pool id's. def _find_identity_pool_ids(name, pool_id, conn): ''' Given identity pool name (or optionally a pool_id and name will be ignored), find and return list of matching identity ...
Given an identity pool name, (optionally if an identity pool id is given, the given name will be ignored) Returns a list of matched identity pool name's pool properties CLI Example: .. code-block:: bash salt myminion boto_cognitoidentity.describe_identity_pools my_id_pool_name salt m...
Creates a new identity pool. All parameters except for IdentityPoolName is optional. SupportedLoginProviders should be a dictionary mapping provider names to provider app IDs. OpenIdConnectProviderARNs should be a list of OpenID Connect provider ARNs. Returns the created identity pool if successful ...
Given an identity pool name, (optionally if an identity pool id is given, the given name will be ignored) Deletes all identity pools matching the given name, or the specific identity pool with the given identity pool id. CLI Example: .. code-block:: bash salt myminion boto_cognitoidentit...
Helper function to turn a name into an arn string, returns None if not able to resolve def _get_role_arn(name, **conn_params): ''' Helper function to turn a name into an arn string, returns None if not able to resolve ''' if name.startswith('arn:aws:iam'): return name role = __salt_...
Given an identity pool id, set the given AuthenticatedRole and UnauthenticatedRole (the Role can be an iam arn, or a role name) If AuthenticatedRole or UnauthenticatedRole is not given, the authenticated and/or the unauthenticated role associated previously with the pool will be cleared. Returns set T...
Updates the given IdentityPoolId's properties. All parameters except for IdentityPoolId, is optional. SupportedLoginProviders should be a dictionary mapping provider names to provider app IDs. OpenIdConnectProviderARNs should be a list of OpenID Connect provider ARNs. To clear SupportedLoginProvider...
Filter out the result: True + no changes data def _filter_running(runnings): ''' Filter out the result: True + no changes data ''' ret = dict((tag, value) for tag, value in six.iteritems(runnings) if not value['result'] or value['changes']) return ret
Set the return code based on the data back from the state system def _set_retcode(ret, highstate=None): ''' Set the return code based on the data back from the state system ''' # Set default retcode to 0 __context__['retcode'] = salt.defaults.exitcodes.EX_OK if isinstance(ret, list): ...
Create a snapper pre snapshot def _snapper_pre(opts, jid): ''' Create a snapper pre snapshot ''' snapper_pre = None try: if not opts['test'] and __opts__.get('snapper_states'): # Run the snapper pre snapshot snapper_pre = __salt__['snapper.create_snapshot']( ...
Create the post states snapshot def _snapper_post(opts, jid, pre_num): ''' Create the post states snapshot ''' try: if not opts['test'] and __opts__.get('snapper_states') and pre_num: # Run the snapper pre snapshot __salt__['snapper.create_snapshot']( ...
Return the pause information for a given jid def _get_pause(jid, state_id=None): ''' Return the pause information for a given jid ''' pause_dir = os.path.join(__opts__['cachedir'], 'state_pause') pause_path = os.path.join(pause_dir, jid) if not os.path.exists(pause_dir): try: ...
Get a report on all of the currently paused state runs and pause run settings. Optionally send in a jid if you only desire to see a single pause data set. def get_pauses(jid=None): ''' Get a report on all of the currently paused state runs and pause run settings. Optionally send in a jid if...
Set up a state run to die before executing the given state id, this instructs a running state to safely exit at a given state id. This needs to pass in the jid of the running state. If a state_id is not passed then the jid referenced will be safely exited at the beginning of the next state run. The...
Set up a state id pause, this instructs a running state to pause at a given state id. This needs to pass in the jid of the running state and can optionally pass in a duration in seconds. If a state_id is not passed then the jid referenced will be paused at the beginning of the next state run. The given...
Remove a pause from a jid, allowing it to continue. If the state_id is not specified then the a general pause will be resumed. The given state_id is the id got a given state execution, so given a state that looks like this: .. code-block:: yaml vim: pkg.installed: [] The state_...
.. versionadded:: 2016.11.0 Execute the orchestrate runner from a masterless minion. .. seealso:: More Orchestrate documentation * :ref:`Full Orchestrate Tutorial <orchestrate-runner>` * :py:mod:`Docs for the ``salt`` state module <salt.states.saltmod>` CLI Examples: .. code-block::...
Utility function to queue the state run if requested and to check for conflicts in currently running states def _check_queue(queue, kwargs): ''' Utility function to queue the state run if requested and to check for conflicts in currently running states ''' if queue: _wait(kwargs.get('__...
Execute a single low data call This function is mostly intended for testing the state system and is not likely to be needed in everyday usage. CLI Example: .. code-block:: bash salt '*' state.low '{"state": "pkg", "fun": "installed", "name": "vi"}' def low(data, queue=False, **kwargs): ...
Execute the compound calls stored in a single set of high data This function is mostly intended for testing the state system and is not likely to be needed in everyday usage. CLI Example: .. code-block:: bash salt '*' state.high '{"vim": {"pkg": ["installed"]}}' def high(data, test=None, qu...
Execute the information stored in a template file on the minion. This function does not ask a master for a SLS file to render but instead directly processes the file at the provided path on the minion. CLI Example: .. code-block:: bash salt '*' state.template '<Path to template on the minion...
Execute the information stored in a string from an sls template CLI Example: .. code-block:: bash salt '*' state.template_str '<Template String>' def template_str(tem, queue=False, **kwargs): ''' Execute the information stored in a string from an sls template CLI Example: .. code-b...
.. versionadded:: 2015.5.0 Return the state request information, if any CLI Example: .. code-block:: bash salt '*' state.check_request def check_request(name=None): ''' .. versionadded:: 2015.5.0 Return the state request information, if any CLI Example: .. code-block:: ba...
Retrieve the state data from the salt master for this minion and execute it test Run states in test-only (dry-run) mode pillar Custom Pillar values, passed as a dictionary of key-value pairs .. code-block:: bash salt '*' state.highstate stuff pillar='{"foo": "bar"}' ...
Execute the states in one or more SLS files test Run states in test-only (dry-run) mode pillar Custom Pillar values, passed as a dictionary of key-value pairs .. code-block:: bash salt '*' state.sls stuff pillar='{"foo": "bar"}' .. note:: Values passe...
Execute a specific top file instead of the default. This is useful to apply configurations from a different environment (for example, dev or prod), without modifying the default top file. queue : False Instead of failing immediately when another state run is in progress, queue the new state...
Retrieve the highstate data from the salt master and display it Custom Pillar data can be passed with the ``pillar`` kwarg. CLI Example: .. code-block:: bash salt '*' state.show_highstate def show_highstate(queue=False, **kwargs): ''' Retrieve the highstate data from the salt master and...
List out the low data that will be applied to this minion CLI Example: .. code-block:: bash salt '*' state.show_lowstate def show_lowstate(queue=False, **kwargs): ''' List out the low data that will be applied to this minion CLI Example: .. code-block:: bash salt '*' state...
Retrieve the highstate data from the salt master to analyse used and unused states Custom Pillar data can be passed with the ``pillar`` kwarg. CLI Example: .. code-block:: bash salt '*' state.show_state_usage def show_state_usage(queue=False, **kwargs): ''' Retrieve the highstate data f...
Returns the list of states that will be applied on highstate. CLI Example: .. code-block:: bash salt '*' state.show_states .. versionadded:: 2019.2.0 def show_states(queue=False, **kwargs): ''' Returns the list of states that will be applied on highstate. CLI Example: .. code-...
Call a single ID from the named module(s) and handle all requisites The state ID comes *before* the module ID(s) on the command line. id ID to call mods Comma-delimited list of modules to search for given id and its requisites .. versionadded:: 2014.7.0 saltenv : base Sp...
Display the low data from a specific sls. The default environment is ``base``, use ``saltenv`` to specify a different environment. saltenv Specify a salt fileserver environment to be used when applying states pillar Custom Pillar values, passed as a dictionary of key-value pairs ....
Tests for the existance the of a specific SLS or list of SLS files on the master. Similar to :py:func:`state.show_sls <salt.modules.state.show_sls>`, rather than returning state details, returns True or False. The default environment is ``base``, use ``saltenv`` to specify a different environment. .. v...
Tests for the existence of a specific ID or list of IDs within the specified SLS file(s). Similar to :py:func:`state.sls_exists <salt.modules.state.sls_exists>`, returns True or False. The default environment is base``, use ``saltenv`` to specify a different environment. .. versionadded:: 2019.2.0 ...
Return the top data that the minion will use for a highstate CLI Example: .. code-block:: bash salt '*' state.show_top def show_top(queue=False, **kwargs): ''' Return the top data that the minion will use for a highstate CLI Example: .. code-block:: bash salt '*' state.sho...
Execute a single state function with the named kwargs, returns False if insufficient data is sent to the command By default, the values of the kwargs will be parsed as YAML. So, you can specify lists values, or lists of single entry key-value maps, as you would in a YAML salt file. Alternatively, JSON ...
Clear out cached state files, forcing even cache runs to refresh the cache on the next state execution. Remember that the state cache is completely disabled by default, this execution only applies if cache=True is used in states CLI Example: .. code-block:: bash salt '*' state.clear_cach...
Execute a packaged state run, the packaged state run will exist in a tarball available locally. This packaged state can be generated using salt-ssh. CLI Example: .. code-block:: bash salt '*' state.pkg /tmp/salt_state.tgz 760a9353810e36f6d81416366fc426dc md5 def pkg(pkg_path, pkg_sum...
Disable state runs. CLI Example: .. code-block:: bash salt '*' state.disable highstate salt '*' state.disable highstate,test.succeed_without_changes .. note:: To disable a state file from running provide the same name that would be passed in a state.sls call. sa...
Enable state function or sls run CLI Example: .. code-block:: bash salt '*' state.enable highstate salt '*' state.enable test.succeed_without_changes .. note:: To enable a state file from running provide the same name that would be passed in a state.sls call. sa...
Return messages for disabled states that match state functions in funs. def _disabled(funs): ''' Return messages for disabled states that match state functions in funs. ''' ret = [] _disabled = __salt__['grains.get']('state_runs_disabled') for state in funs: for _state in _disab...
r''' Watch Salt's event bus and block until the given tag is matched .. versionadded:: 2016.3.0 .. versionchanged:: 2019.2.0 ``tagmatch`` can now be either a glob or regular expression. This is useful for utilizing Salt's event bus from shell scripts or for taking simple actions directly f...
Ensure that a grain is set name The grain name delimiter A delimiter different from the default can be provided. Check whether a grain exists. Does not attempt to check or set the value. def exists(name, delimiter=DEFAULT_TARGET_DELIM): ''' Ensure that a grain is set name ...
Ensure that a grain is set .. versionchanged:: v2015.8.2 name The grain name value The value to set on the grain force If force is True, the existing grain will be overwritten regardless of its existing or provided value type. Defaults to False .. versionadde...
.. versionadded:: 2014.1.0 Ensure the value is present in the list-type grain. Note: If the grain that is provided in ``name`` is not present on the system, this new grain will be created with the corresponding provided value. name The grain name. value The value is present in the...
Delete a value from a grain formed as a list. .. versionadded:: 2014.1.0 name The grain name. value The value to delete from the grain list. delimiter A delimiter different from the default ``:`` can be provided. .. versionadded:: v2015.8.2 The grain should be `l...
.. versionadded:: 2014.7.0 Delete a grain from the grains config file name The grain name destructive If destructive is True, delete the entire grain. If destructive is False, set the grain's value to None. Defaults to False. force If force is True, the existing grain...
.. versionadded:: 2014.7.0 Append a value to a list in the grains config file. The grain that is being appended to (name) must exist before the new value can be added. name The grain name value The value to append convert If convert is True, convert non-list contents into...
Clear variables stored in __context__. Run this function when a new version of chocolatey is installed. def _clear_context(context): ''' Clear variables stored in __context__. Run this function when a new version of chocolatey is installed. ''' for var in (x for x in __context__ if x.startswith...
Returns ['--yes'] if on v0.9.9.0 or later, otherwise returns an empty list def _yes(context): ''' Returns ['--yes'] if on v0.9.9.0 or later, otherwise returns an empty list ''' if 'chocolatey._yes' in __context__: return context['chocolatey._yes'] if _LooseVersion(chocolatey_version()) >= _...
Returns ['--no-progress'] if on v0.10.4 or later, otherwise returns an empty list def _no_progress(context): ''' Returns ['--no-progress'] if on v0.10.4 or later, otherwise returns an empty list ''' if 'chocolatey._no_progress' in __context__: return context['chocolatey._no_progress'] ...
Returns the full path to chocolatey.bat on the host. def _find_chocolatey(context, salt): ''' Returns the full path to chocolatey.bat on the host. ''' if 'chocolatey._path' in context: return context['chocolatey._path'] choc_defaults = ['C:\\Chocolatey\\bin\\chocolatey.bat', ...
Returns the version of Chocolatey installed on the minion. CLI Example: .. code-block:: bash salt '*' chocolatey.chocolatey_version def chocolatey_version(): ''' Returns the version of Chocolatey installed on the minion. CLI Example: .. code-block:: bash salt '*' chocolate...
Download and install the latest version of the Chocolatey package manager via the official bootstrap. Chocolatey requires Windows PowerShell and the .NET v4.0 runtime. Depending on the host's version of Windows, chocolatey.bootstrap will attempt to ensure these prerequisites are met by downloading and ...
Instructs Chocolatey to pull a vague package list from the repository. Args: narrow (str): Term used to narrow down results. Searches against name/description/tag. Default is None. all_versions (bool): Display all available package versions in results. Default ...
Instructs Chocolatey to pull a full package list from the Windows Features list, via the Deployment Image Servicing and Management tool. Returns: str: List of Windows Features CLI Example: .. code-block:: bash salt '*' chocolatey.list_windowsfeatures def list_windowsfeatures(): ...
Instructs Chocolatey to install a package via Cygwin. name The name of the package to be installed. Only accepts a single argument. install_args A list of install arguments you want to pass to the installation process i.e product key or feature list override_args Set to tr...
Instructs Chocolatey to install a package via Ruby's Gems. name The name of the package to be installed. Only accepts a single argument. version Install a specific version of the package. Defaults to latest version available. install_args A list of install arguments you wa...
Instructs Chocolatey to install a package if it doesn't already exist. .. versionchanged:: 2014.7.0 If the minion has Chocolatey >= 0.9.8.24 installed, this function calls :mod:`chocolatey.install <salt.modules.chocolatey.install>` instead, as ``installmissing`` is deprecated as of that ver...
Instructs Chocolatey to install a package via Python's easy_install. name The name of the package to be installed. Only accepts a single argument. version Install a specific version of the package. Defaults to latest version available. install_args A list of install argume...
Instructs Chocolatey to install a package via the Microsoft Web PI service. name The name of the package to be installed. Only accepts a single argument. install_args A list of install arguments you want to pass to the installation process i.e product key or feature list override_...
Instructs Chocolatey to uninstall a package. name The name of the package to be uninstalled. Only accepts a single argument. version Uninstalls a specific version of the package. Defaults to latest version installed. uninstall_args A list of uninstall arguments you...
.. versionadded:: 2016.3.4 Instructs Chocolatey to upgrade packages on the system. (update is being deprecated). This command will install the package if not installed. Args: name (str): The name of the package to update, or "all" to update everything installed on the syst...
Instructs Chocolatey to update packages on the system. name The name of the package to update, or "all" to update everything installed on the system. source Chocolatey repository (directory, share or remote URL feed) the package comes from. Defaults to the official Chocolatey f...
Instructs Chocolatey to check an installed package version, and optionally compare it to one available from a remote feed. Args: name (str): The name of the package to check. Required. check_remote (bool): Get the version number of the latest package from the remote fe...
Instructs Chocolatey to add a source. name The name of the source to be added as a chocolatey repository. source Location of the source you want to work with. username Provide username for chocolatey sources that need authentication credentials. password Provi...
Instructs Chocolatey to change the state of a source. name Name of the repository to affect. state State in which you want the chocolatey repository. def _change_source_state(name, state): ''' Instructs Chocolatey to change the state of a source. name Name of the reposito...
Add the given overlay from the cached remote list to your locally installed overlays. Specify 'ALL' to add all overlays from the remote list. Return a list of the new overlay(s) added: CLI Example: .. code-block:: bash salt '*' layman.add <overlay name> def add(overlay): ''' Add...
Remove the given overlay from the your locally installed overlays. Specify 'ALL' to remove all overlays. Return a list of the overlays(s) that were removed: CLI Example: .. code-block:: bash salt '*' layman.delete <overlay name> def delete(overlay): ''' Remove the given overlay from...
List the locally installed overlays. Return a list of installed overlays: CLI Example: .. code-block:: bash salt '*' layman.list_local def list_local(): ''' List the locally installed overlays. Return a list of installed overlays: CLI Example: .. code-block:: bash ...
Prepare the connection to the Django authentication framework def __django_auth_setup(): ''' Prepare the connection to the Django authentication framework ''' if django.VERSION >= (1, 7): django.setup() global DJANGO_AUTH_CLASS if DJANGO_AUTH_CLASS is not None: return # V...
Simple Django auth def auth(username, password): ''' Simple Django auth ''' django_auth_path = __opts__['django_auth_path'] if django_auth_path not in sys.path: sys.path.append(django_auth_path) os.environ.setdefault('DJANGO_SETTINGS_MODULE', __opts__['django_auth_settings']) __dja...
Takes the data passed to a top file environment and determines if the data matches this minion def confirm_top(match, data, nodegroups=None): ''' Takes the data passed to a top file environment and determines if the data matches this minion ''' matcher = 'compound' if not data: log....
List installed features. Supported on Windows Server 2008 and Windows 8 and newer. Returns: dict: A dictionary of installed features CLI Example: .. code-block:: bash salt '*' win_servermanager.list_installed def list_installed(): ''' List installed features. Supported on Wi...
r''' Install a feature .. note:: Some features require reboot after un/installation, if so until the server is restarted other features can not be installed! .. note:: Some features take a long time to complete un/installation, set -t with a long timeout Args: ...
r''' Remove an installed feature .. note:: Some features require a reboot after installation/uninstallation. If one of these features are modified, then other features cannot be installed until the server is restarted. Additionally, some features take a while to complete install...
List networks on a wireless interface CLI Examples: salt minion iwtools.scan wlp3s0 salt minion iwtools.scan wlp3s0 list def scan(iface, style=None): ''' List networks on a wireless interface CLI Examples: salt minion iwtools.scan wlp3s0 salt minion iwtools.scan wlp3...
List networks on a wireless interface CLI Example: salt minion iwtools.set_mode wlp3s0 Managed def set_mode(iface, mode): ''' List networks on a wireless interface CLI Example: salt minion iwtools.set_mode wlp3s0 Managed ''' if not _valid_iface(iface): raise SaltInvo...
List all of the wireless interfaces CLI Example: salt minion iwtools.list_interfaces def list_interfaces(style=None): ''' List all of the wireless interfaces CLI Example: salt minion iwtools.list_interfaces ''' ret = {} tmp = None iface = None out = __salt__['cmd...
Validate the beacon configuration def validate(config): ''' Validate the beacon configuration ''' vcfg_ret = True vcfg_msg = 'Valid beacon configuration' if not isinstance(config, list): vcfg_ret = False vcfg_msg = 'Configuration for vmadm beacon must be a list!' return vc...
Poll vmadm for changes def beacon(config): ''' Poll vmadm for changes ''' ret = [] # NOTE: lookup current images current_vms = __salt__['vmadm.list']( keyed=True, order='uuid,state,alias,hostname,dns_domain', ) # NOTE: apply configuration if VMADM_STATE['first_run'...
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. CLI Example: .. code-block:: bash salt minion mssql.tsql_query 'SELECT @@version as version' as_dict=True def tsql_query(query, **kwargs): ''' ...
Creates a new database. Does not update options of existing databases. new_database_options can only be a list of strings CLI Example: .. code-block:: bash salt minion mssql.db_create DB_NAME def db_create(database, containment='NONE', new_database_options=None, **kwargs): ''' Create...
Drops a specific database from the MS SQL server. It will not drop any of 'master', 'model', 'msdb' or 'tempdb'. CLI Example: .. code-block:: bash salt minion mssql.db_remove database_name='DBNAME' def db_remove(database_name, **kwargs): ''' Drops a specific database from the MS SQL serv...
Checks if a role exists. CLI Example: .. code-block:: bash salt minion mssql.role_exists db_owner def role_exists(role, **kwargs): ''' Checks if a role exists. CLI Example: .. code-block:: bash salt minion mssql.role_exists db_owner ''' # We should get one, and on...
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. CLI Example: .. code-block:: bash salt minion mssql.role_create role=product01 owner=sysdba gran...
Remove a database role. CLI Example: .. code-block:: bash salt minion mssql.role_create role=test_role01 def role_remove(role, **kwargs): ''' Remove a database role. CLI Example: .. code-block:: bash salt minion mssql.role_create role=test_role01 ''' try: c...
Find if a login exists in the MS SQL server. domain, if provided, will be prepended to login CLI Example: .. code-block:: bash salt minion mssql.login_exists 'LOGIN' def login_exists(login, domain='', **kwargs): ''' Find if a login exists in the MS SQL server. domain, if provided, wi...
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 considere...
Removes an login. CLI Example: .. code-block:: bash salt minion mssql.login_remove LOGINNAME def login_remove(login, **kwargs): ''' Removes an login. CLI Example: .. code-block:: bash salt minion mssql.login_remove LOGINNAME ''' try: conn = _get_connection(...
Find if an user exists in a specific database on the MS SQL server. domain, if provided, will be prepended to username CLI Example: .. code-block:: bash salt minion mssql.user_exists 'USERNAME' [database='DBNAME'] def user_exists(username, domain='', database=None, **kwargs): ''' Find if...
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 CLI Example: .. code-block:: bash salt minion mssql.user_create USERNAME database=DBNAME def user_create(userna...
Removes an user. CLI Example: .. code-block:: bash salt minion mssql.user_remove USERNAME database=DBNAME def user_remove(username, **kwargs): ''' Removes an user. CLI Example: .. code-block:: bash salt minion mssql.user_remove USERNAME database=DBNAME ''' # 'datab...
Ensure the cloudwatch alarm exists. name Name of the alarm attributes A dict of key/value cloudwatch alarm attributes. region Region to connect to. key Secret key to be used. keyid Access key to be used. profile A dict with region, key and ke...
DRY code for joining comments together and conditionally adding a period at the end, and adding this comment string to the state return dict. def _format_comments(ret, comments): ''' DRY code for joining comments together and conditionally adding a period at the end, and adding this comment string to t...
Check the diff for signs of incorrect argument handling in previous releases, as discovered here: https://github.com/saltstack/salt/pull/39996#issuecomment-288025200 def _check_diff(changes): ''' Check the diff for signs of incorrect argument handling in previous releases, as discovered here: ...
Common logic for parsing the networks def _parse_networks(networks): ''' Common logic for parsing the networks ''' networks = salt.utils.args.split_input(networks or []) if not networks: networks = {} else: # We don't want to recurse the repack, as the values of the kwargs ...