text
stringlengths
81
112k
List all trails Returns list of trails CLI Example: .. code-block:: yaml policies: - {...} - {...} def list(region=None, key=None, keyid=None, profile=None): ''' List all trails Returns list of trails CLI Example: .. code-block:: yaml policies...
Given a valid config, update a trail. Returns {created: true} if the trail was created and returns {created: False} if the trail was not created. CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.update my_trail my_bucket def update(Name, S3BucketName, S3KeyPrefix=N...
Start logging for a trail Returns {started: true} if the trail was started and returns {started: False} if the trail was not started. CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.start_logging my_trail def start_logging(Name, region=None, key=None, keyid=None, ...
Add tags to a trail Returns {tagged: true} if the trail was tagged and returns {tagged: False} if the trail was not tagged. CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.add_tags my_trail tag_a=tag_value tag_b=tag_value def add_tags(Name, region=None, key=None, ...
List tags of a trail Returns: tags: - {...} - {...} CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.list_tags my_trail def list_tags(Name, region=None, key=None, keyid=None, profile=None): ''' List tags of a trail Returns: ...
Private function that returns an iterator over all CloudFront distributions. The caller is responsible for all boto-related error handling. name (Optional) Only yield the distribution with the given name def _list_distributions( conn, name=None, region=None, key=None, keyid=None, ...
Get information about a CloudFront distribution (configuration, tags) with a given name. name Name of the CloudFront distribution region Region to connect to key Secret key to use keyid Access key to use profile A dict with region, key, and keyid, ...
Get details of all CloudFront distributions. Produces results that can be used to create an SLS file. CLI Example: .. code-block:: bash salt-call boto_cloudfront.export_distributions --out=txt |\ sed "s/local: //" > cloudfront_distributions.sls def export_distributions(region=None, k...
Create a CloudFront distribution with the given name, config, and (optionally) tags. name Name for the CloudFront distribution config Configuration for the distribution tags Tags to associate with the distribution region Region to connect to key Secret ke...
Update the config (and optionally tags) for the CloudFront distribution with the given name. name Name of the CloudFront distribution config Configuration for the distribution tags Tags to associate with the distribution region Region to connect to key Se...
List, with moderate information, all CloudFront distributions in the bound account. region Region to connect to. key Secret key to use. keyid Access key to use. profile Dict, or pillar key pointing to a dict, containing AWS region/key/keyid. CLI Example: .. ...
Return True if a CloudFront distribution exists with the given Resource ID or False otherwise. Id Resource ID of the CloudFront distribution. region Region to connect to. key Secret key to use. keyid Access key to use. profile Dict, or pillar key pointing...
Find and return any CloudFront distributions which happen to have a Comment sub-field either exactly matching the given Comment, or beginning with it AND with the remainder separated by a colon. Comment The string to be matched when searching for the given Distribution. Note that this will...
Set a CloudFront distribution to be disabled. Id Id of the distribution to update. region Region to connect to. key Secret key to use. keyid Access key to use. profile Dict, or pillar key pointing to a dict, containing AWS region/key/keyid. CLI Examp...
Find and return any CloudFront Origin Access Identities which happen to have a Comment sub-field either exactly matching the given Comment, or beginning with it AND with the remainder separate by a colon. Comment The string to be matched when searching for the given Origin Access Identity. Note ...
Return True if a CloudFront origin access identity exists with the given Resource ID or False otherwise. Id Resource ID of the CloudFront origin access identity. region Region to connect to. key Secret key to use. keyid Access key to use. profile Dict...
Add tags to a CloudFront resource. Resource The ARN of the affected CloudFront resource. Tags Dict of {'Tag': 'Value', ...} providing the tags to be set. region Region to connect to. key Secret key to use. keyid Access key to use. profile Dic...
Enforce a given set of tags on a CloudFront resource: adding, removing, or changing them as necessary to ensure the resource's tags are exactly and only those specified. Resource The ARN of the affected CloudFront resource. Tags Dict of {'Tag': 'Value', ...} providing the tags to be enfor...
Read a file and return content def _file_read(path): ''' Read a file and return content ''' content = False if os.path.exists(path): with salt.utils.files.fopen(path, 'r+') as fp_: content = salt.utils.stringutils.to_unicode(fp_.read()) fp_.close() return content
Write content to a file def _file_write(path, content): ''' Write content to a file ''' with salt.utils.files.fopen(path, 'w+') as fp_: fp_.write(salt.utils.stringutils.to_str(content)) fp_.close()
Get the path to the directory on the minion where CIB's are saved def _get_cibpath(): ''' Get the path to the directory on the minion where CIB's are saved ''' cibpath = os.path.join(__opts__['cachedir'], 'pcs', __env__) log.trace('cibpath: %s', cibpath) return cibpath
Get the full path of a cached CIB-file with the name of the CIB def _get_cibfile(cibname): ''' Get the full path of a cached CIB-file with the name of the CIB ''' cibfile = os.path.join(_get_cibpath(), '{0}.{1}'.format(cibname, 'cib')) log.trace('cibfile: %s', cibfile) return cibfile
Get the full path of a temporary CIB-file with the name of the CIB def _get_cibfile_tmp(cibname): ''' Get the full path of a temporary CIB-file with the name of the CIB ''' cibfile_tmp = '{0}.tmp'.format(_get_cibfile(cibname)) log.trace('cibfile_tmp: %s', cibfile_tmp) return cibfile_tmp
Get the full path of the file containing a checksum of a CIB-file with the name of the CIB def _get_cibfile_cksum(cibname): ''' Get the full path of the file containing a checksum of a CIB-file with the name of the CIB ''' cibfile_cksum = '{0}.cksum'.format(_get_cibfile(cibname)) log.trace('cibfile...
Ensure that an item is created name Irrelevant, not used item config, property, resource, constraint etc. item_id id of the item item_type item type show show command (probably None, default: show) create create command (create or set f.e., defaul...
Ensure all nodes are authorized to the cluster name Irrelevant, not used (recommended: pcs_auth__auth) nodes a list of nodes which should be authorized to the cluster pcsuser user for communication with pcs (default: hacluster) pcspasswd password for pcsuser (default: ha...
Setup Pacemaker cluster on nodes. Should be run on one cluster node only (there may be races) name Irrelevant, not used (recommended: pcs_setup__setup) nodes a list of nodes which should be set up pcsclustername Name of the Pacemaker cluster extra_args list of ex...
Add a node to the Pacemaker cluster via PCS Should be run on one cluster node only (there may be races) Can only be run on a already setup/added node name Irrelevant, not used (recommended: pcs_setup__node_add_{{node}}) node node that should be added extra_args list of e...
Ensure that a CIB-file with the content of the current live CIB is created Should be run on one cluster node only (there may be races) name Irrelevant, not used (recommended: {{formulaname}}__cib_present_{{cibname}}) cibname name/path of the file containing the CIB scope sp...
Ensure that a CIB-file is pushed if it is changed since the creation of it with pcs.cib_present Should be run on one cluster node only (there may be races) name Irrelevant, not used (recommended: {{formulaname}}__cib_pushed_{{cibname}}) cibname name/path of the file containing the CIB ...
Ensure that a property in the cluster is set to a given value Should be run on one cluster node only (there may be races) name Irrelevant, not used (recommended: pcs_properties__prop_has_value_{{prop}}) prop name of the property value value of the property extra_args ...
Ensure a resource default in the cluster is set to a given value Should be run on one cluster node only (there may be races) Can only be run on a node with a functional pacemaker/corosync name Irrelevant, not used (recommended: pcs_properties__resource_defaults_to_{{default}}) default ...
Ensure a resource operation default in the cluster is set to a given value Should be run on one cluster node only (there may be races) Can only be run on a node with a functional pacemaker/corosync name Irrelevant, not used (recommended: pcs_properties__resource_op_defaults_to_{{op_default}}) ...
Ensure that a fencing resource is created Should be run on one cluster node only (there may be races) Can only be run on a node with a functional pacemaker/corosync name Irrelevant, not used (recommended: pcs_stonith__created_{{stonith_id}}) stonith_id name for the stonith resource...
Ensure that a resource is created Should be run on one cluster node only (there may be races) Can only be run on a node with a functional pacemaker/corosync name Irrelevant, not used (recommended: {{formulaname}}__resource_present_{{resource_id}}) resource_id name for the resource ...
Ensure that a constraint is created Should be run on one cluster node only (there may be races) Can only be run on a node with a functional pacemaker/corosync name Irrelevant, not used (recommended: {{formulaname}}__constraint_present_{{constraint_id}}) constraint_id name for the c...
Allow top_cfg to be YAML def _parse_top_cfg(content, filename): ''' Allow top_cfg to be YAML ''' try: obj = salt.utils.yaml.safe_load(content) if isinstance(obj, list): log.debug('MakoStack cfg `%s` parsed as YAML', filename) return obj except Exception as er...
See if jail service is actually enabled on boot CLI Example: .. code-block:: bash salt '*' jail.is_enabled <jail name> def is_enabled(): ''' See if jail service is actually enabled on boot CLI Example: .. code-block:: bash salt '*' jail.is_enabled <jail name> ''' c...
Return which jails are set to be run CLI Example: .. code-block:: bash salt '*' jail.get_enabled def get_enabled(): ''' Return which jails are set to be run CLI Example: .. code-block:: bash salt '*' jail.get_enabled ''' ret = [] for rconf in ('/etc/rc.conf', '...
Display specified jail's configuration CLI Example: .. code-block:: bash salt '*' jail.show_config <jail name> def show_config(jail): ''' Display specified jail's configuration CLI Example: .. code-block:: bash salt '*' jail.show_config <jail name> ''' ret = {} ...
Display contents of a fstab(5) file defined in specified jail's configuration. If no file is defined, return False. CLI Example: .. code-block:: bash salt '*' jail.fstab <jail name> def fstab(jail): ''' Display contents of a fstab(5) file defined in specified jail's configuration. If...
See if specified jail is currently running CLI Example: .. code-block:: bash salt '*' jail.status <jail name> def status(jail): ''' See if specified jail is currently running CLI Example: .. code-block:: bash salt '*' jail.status <jail name> ''' cmd = 'jls' fou...
Dump all jail related kernel states (sysctl) CLI Example: .. code-block:: bash salt '*' jail.sysctl def sysctl(): ''' Dump all jail related kernel states (sysctl) CLI Example: .. code-block:: bash salt '*' jail.sysctl ''' ret = {} sysctl_jail = __salt__['cmd.ru...
Execute the command passed with pecl def _pecl(command, defaults=False): ''' Execute the command passed with pecl ''' cmdline = 'pecl {0}'.format(command) if salt.utils.data.is_true(defaults): cmdline = 'yes ' "''" + ' | ' + cmdline ret = __salt__['cmd.run_all'](cmdline, python_shell=T...
.. versionadded:: 0.17.0 Installs one or several pecl extensions. pecls The pecl extensions to install. defaults Use default answers for extensions such as pecl_http which ask questions before installation. Without this option, the pecl.installed state will hang indefinite...
Uninstall one or several pecl extensions. pecls The pecl extensions to uninstall. CLI Example: .. code-block:: bash salt '*' pecl.uninstall fuse def uninstall(pecls): ''' Uninstall one or several pecl extensions. pecls The pecl extensions to uninstall. CLI Exam...
List installed pecl extensions. CLI Example: .. code-block:: bash salt '*' pecl.list def list_(channel=None): ''' List installed pecl extensions. CLI Example: .. code-block:: bash salt '*' pecl.list ''' pecl_channel_pat = re.compile('^([^ ]+)[ ]+([^ ]+)[ ]+([^ ]+)'...
Return cloud client def _get_client(): ''' Return cloud client ''' client = salt.cloud.CloudClient( os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud') ) return client
Create a cloud vm with the given profile and instances, instances can be a list or comma-delimited string CLI Example: .. code-block:: bash salt-run cloud.profile prof=my-ec2 instances=node1,node2,node3 def profile(prof=None, instances=None, opts=None, **kwargs): ''' Create a cloud vm wi...
Execute a salt cloud map file def map_run(path=None, opts=None, **kwargs): ''' Execute a salt cloud map file ''' client = _get_client() if isinstance(opts, dict): client.opts.update(opts) info = client.map_run(path, **salt.utils.args.clean_kwargs(**kwargs)) return info
Destroy the named vm(s) def destroy(instances, opts=None): ''' Destroy the named vm(s) ''' client = _get_client() if isinstance(opts, dict): client.opts.update(opts) info = client.destroy(instances) return info
Execute a single action on the given map/provider/instance CLI Example: .. code-block:: bash salt-run cloud.action start my-salt-vm def action(func=None, cloudmap=None, instances=None, provider=None, instance=None, opts=None, **kwargs...
Create an instance using Salt Cloud CLI Example: .. code-block:: bash salt-run cloud.create my-ec2-config myinstance \ image=ami-1624987f size='t1.micro' ssh_username=ec2-user \ securitygroup=default delvol_on_destroy=True def create(provider, instances, opts=None, **kwargs):...
Get splunk search properties from an object def _get_splunk_search_props(search): ''' Get splunk search properties from an object ''' props = search.content props["app"] = search.access.app props["sharing"] = search.access.sharing return props
Get a splunk search CLI Example: splunk_search.get 'my search name' def get(name, profile="splunk"): ''' Get a splunk search CLI Example: splunk_search.get 'my search name' ''' client = _get_splunk(profile) search = None # uglyness of splunk lib try: sear...
Update a splunk search CLI Example: splunk_search.update 'my search name' sharing=app def update(name, profile="splunk", **kwargs): ''' Update a splunk search CLI Example: splunk_search.update 'my search name' sharing=app ''' client = _get_splunk(profile) search = client...
Create a splunk search CLI Example: splunk_search.create 'my search name' search='error msg' def create(name, profile="splunk", **kwargs): ''' Create a splunk search CLI Example: splunk_search.create 'my search name' search='error msg' ''' client = _get_splunk(profile) s...
Delete a splunk search CLI Example: splunk_search.delete 'my search name' def delete(name, profile="splunk"): ''' Delete a splunk search CLI Example: splunk_search.delete 'my search name' ''' client = _get_splunk(profile) try: client.saved_searches.delete(name) ...
List splunk searches (names only) CLI Example: splunk_search.list def list_(profile="splunk"): ''' List splunk searches (names only) CLI Example: splunk_search.list ''' client = _get_splunk(profile) searches = [x['name'] for x in client.saved_searches] return searches
Get all splunk search details. Produces results that can be used to create an sls file. if app or owner are specified, results will be limited to matching saved searches. if description_contains is specified, results will be limited to those where "description_contains in description" is true if n...
.. versionadded:: 2014.7.0 Verify the set exists. name A user-defined set name. set_type The type for the set. family Networking family, either ipv4 or ipv6 def set_present(name, set_type, family='ipv4', **kwargs): ''' .. versionadded:: 2014.7.0 Verify the set e...
.. versionadded:: 2014.7.0 Verify the set is absent. family Networking family, either ipv4 or ipv6 def set_absent(name, family='ipv4', **kwargs): ''' .. versionadded:: 2014.7.0 Verify the set is absent. family Networking family, either ipv4 or ipv6 ''' ret = {'name'...
.. versionadded:: 2014.7.0 Remove a entry or entries from a chain name A user-defined name to call this entry by in another part of a state or formula. This should not be an actual entry. family Network family, ipv4 or ipv6. def absent(name, entry=None, entries=None, family='ipv4...
.. versionadded:: 2014.7.0 Flush current ipset set family Networking family, either ipv4 or ipv6 def flush(name, family='ipv4', **kwargs): ''' .. versionadded:: 2014.7.0 Flush current ipset set family Networking family, either ipv4 or ipv6 ''' ret = {'name': name, ...
Make sure that a gem is installed. name The name of the gem to install ruby: None Only for RVM or rbenv installations: the ruby version and gemset to target. gem_bin: None Custom ``gem`` command to run instead of the default. Use this to install gems to a non-defau...
Make sure that a gem is not installed. name The name of the gem to uninstall gem_bin : None Full path to ``gem`` binary to use. ruby : None If RVM or rbenv are installed, the ruby version and gemset to use. Ignored if ``gem_bin`` is specified. user: None The u...
Make sure that a gem source is added. name The URL of the gem source to be added ruby: None For RVM or rbenv installations: the ruby version and gemset to target. user: None The user under which to run the ``gem`` command .. versionadded:: 0.17.0 def sources_add(name, ru...
Make sure that a gem source is removed. name The URL of the gem source to be removed ruby: None For RVM or rbenv installations: the ruby version and gemset to target. user: None The user under which to run the ``gem`` command .. versionadded:: 0.17.0 def sources_remove(n...
Ensure the current node joined to a cluster with node user@host name Irrelevant, not used (recommended: user@host) user The user of node to join to (default: rabbit) host The host of node to join to ram_node Join node as a RAM node runas The user to run the r...
Create an image CLI Example: .. code-block:: bash salt '*' glanceng.image_create name=cirros file=cirros.raw disk_format=raw salt '*' glanceng.image_create name=cirros file=cirros.raw disk_format=raw hw_scsi_model=virtio-scsi hw_disk_bus=scsi def image_create(auth=None, **kwargs): ''' ...
Delete an image CLI Example: .. code-block:: bash salt '*' glanceng.image_delete name=image1 salt '*' glanceng.image_delete name=0e4febc2a5ab4f2c8f374b054162506d def image_delete(auth=None, **kwargs): ''' Delete an image CLI Example: .. code-block:: bash salt '*' g...
List images CLI Example: .. code-block:: bash salt '*' glanceng.image_list salt '*' glanceng.image_list def image_list(auth=None, **kwargs): ''' List images CLI Example: .. code-block:: bash salt '*' glanceng.image_list salt '*' glanceng.image_list ''' ...
Search for images CLI Example: .. code-block:: bash salt '*' glanceng.image_search name=image1 salt '*' glanceng.image_search def image_search(auth=None, **kwargs): ''' Search for images CLI Example: .. code-block:: bash salt '*' glanceng.image_search name=image1 ...
Get a single image CLI Example: .. code-block:: bash salt '*' glanceng.image_get name=image1 salt '*' glanceng.image_get name=0e4febc2a5ab4f2c8f374b054162506d def image_get(auth=None, **kwargs): ''' Get a single image CLI Example: .. code-block:: bash salt '*' glan...
Update properties for an image CLI Example: .. code-block:: bash salt '*' glanceng.update_image_properties name=image1 hw_scsi_model=virtio-scsi hw_disk_bus=scsi salt '*' glanceng.update_image_properties name=0e4febc2a5ab4f2c8f374b054162506d min_ram=1024 def update_image_properties(auth=None...
Deletes a device from Vistara based on DNS name or partial name. By default, delete_device will only perform the delete if a single host is returned. Set safety_on=False to delete all matches (up to default API search page size) CLI Example: .. code-block:: bash salt-run vistara.delete_device...
Query the vistara API and get an access_token def _get_oath2_access_token(client_key, client_secret): ''' Query the vistara API and get an access_token ''' if not client_key and not client_secret: log.error( "client_key and client_secret have not been specified " "and a...
Return server version (``apachectl -v``) CLI Example: .. code-block:: bash salt '*' apache.version def version(): ''' Return server version (``apachectl -v``) CLI Example: .. code-block:: bash salt '*' apache.version ''' cmd = '{0} -v'.format(_detect_os()) out ...
Return server version (``apachectl -V``) CLI Example: .. code-block:: bash salt '*' apache.fullversion def fullversion(): ''' Return server version (``apachectl -V``) CLI Example: .. code-block:: bash salt '*' apache.fullversion ''' cmd = '{0} -V'.format(_detect_os...
Return list of static and shared modules (``apachectl -M``) CLI Example: .. code-block:: bash salt '*' apache.modules def modules(): ''' Return list of static and shared modules (``apachectl -M``) CLI Example: .. code-block:: bash salt '*' apache.modules ''' cmd = ...
Return list of modules compiled into the server (``apachectl -l``) CLI Example: .. code-block:: bash salt '*' apache.servermods def servermods(): ''' Return list of modules compiled into the server (``apachectl -l``) CLI Example: .. code-block:: bash salt '*' apache.server...
Return list of directives together with expected arguments and places where the directive is valid (``apachectl -L``) CLI Example: .. code-block:: bash salt '*' apache.directives def directives(): ''' Return list of directives together with expected arguments and places where the dir...
Show the settings as parsed from the config file (currently only shows the virtualhost settings) (``apachectl -S``). Because each additional virtual host adds to the execution time, this command may require a long timeout be specified by using ``-t 10``. CLI Example: .. code-block:: bash ...
Signals httpd to start, restart, or stop. CLI Example: .. code-block:: bash salt '*' apache.signal restart def signal(signal=None): ''' Signals httpd to start, restart, or stop. CLI Example: .. code-block:: bash salt '*' apache.signal restart ''' no_extra_args = ('...
Add HTTP user using the ``htpasswd`` command. If the ``htpasswd`` file does not exist, it will be created. Valid options that can be passed are: .. code-block:: text n Don't update file; display results on stdout. m Force MD5 hashing of the password (default). d Force CRYPT(3) hashi...
Get Information from the Apache server-status handler .. note:: The server-status handler is disabled by default. In order for this function to work it needs to be enabled. See http://httpd.apache.org/docs/2.2/mod/mod_status.html The following configuration needs to exists in pillar/g...
Recursively goes through config structure and builds final Apache configuration :param conf: defined config structure :param slot: name of section container if needed def _parse_config(conf, slot=None): ''' Recursively goes through config structure and builds final Apache configuration :param con...
Create VirtualHost configuration files name File for the virtual host config VirtualHost configurations .. note:: This function is not meant to be used from the command line. Config is meant to be an ordered dict of all of the apache configs. CLI Example: .. code...
Ensure the SQS queue exists. name Name of the SQS queue. attributes A dict of key/value SQS 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 keyid, or a pilla...
Ensure the named sqs queue is deleted. name Name of the SQS queue. region Region to connect to. key Secret key to be used. keyid Access key to be used. profile A dict with region, key and keyid, or a pillar key (string) that contains a dict with r...
Determine if the groups need to be changed def _group_changes(cur, wanted, remove=False): ''' Determine if the groups need to be changed ''' old = set(cur) new = set(wanted) if (remove and old != new) or (not remove and not new.issubset(old)): return True return False
Return a dict of the changes required for a user if the user is present, otherwise return False. Updated in 2015.8.0 to include support for windows homedrive, profile, logonscript, and description fields. Updated in 2014.7.0 to include support for shadow attributes, all attributes supported as int...
Ensure that the named user is present with the specified properties name The name of the user to manage uid The user id to assign. If not specified, and the user does not exist, then the next available uid will be assigned. gid The id of the default group to assign to the ...
Ensure that the named user is absent name The name of the user to remove purge Set purge to True to delete all of the user's files as well as the user, Default is ``False``. force If the user is logged in, the absent state will fail. Set the force option to True to...
Parse a salt:// URL; return the path and a possible saltenv query. def parse(url): ''' Parse a salt:// URL; return the path and a possible saltenv query. ''' if not url.startswith('salt://'): return url, None # urlparse will split on valid filename chars such as '?' and '&' resource = ...
join `path` and `saltenv` into a 'salt://' URL. def create(path, saltenv=None): ''' join `path` and `saltenv` into a 'salt://' URL. ''' if salt.utils.platform.is_windows(): path = salt.utils.path.sanitize_win_path(path) path = salt.utils.data.decode(path) query = 'saltenv={0}'.format(s...
test whether `url` is escaped with `|` def is_escaped(url): ''' test whether `url` is escaped with `|` ''' scheme = urlparse(url).scheme if not scheme: return url.startswith('|') elif scheme == 'salt': path, saltenv = parse(url) if salt.utils.platform.is_windows() and '|...
add escape character `|` to `url` def escape(url): ''' add escape character `|` to `url` ''' if salt.utils.platform.is_windows(): return url scheme = urlparse(url).scheme if not scheme: if url.startswith('|'): return url else: return '|{0}'.forma...
remove escape character `|` from `url` def unescape(url): ''' remove escape character `|` from `url` ''' scheme = urlparse(url).scheme if not scheme: return url.lstrip('|') elif scheme == 'salt': path, saltenv = parse(url) if salt.utils.platform.is_windows() and '|' in u...
append `saltenv` to `url` as a query parameter to a 'salt://' url def add_env(url, saltenv): ''' append `saltenv` to `url` as a query parameter to a 'salt://' url ''' if not url.startswith('salt://'): return url path, senv = parse(url) return create(path, saltenv)