text
stringlengths
81
112k
Return what services are available but not enabled to start at boot .. versionchanged:: 2016.3.4 Support for jail (representing jid or jail name) keyword argument in kwargs CLI Example: .. code-block:: bash salt '*' service.get_disabled def get_disabled(jail=None): ''' Return what ...
Switch on/off service start at boot. .. versionchanged:: 2016.3.4 Support for jail (representing jid or jail name) and chroot keyword argument in kwargs. chroot should be used when jail's /etc is mounted read-only and should point to a root directory where jail's /etc is mounted read-write. def _swit...
Return True if the named service is enabled, false otherwise name Service name .. versionchanged:: 2016.3.4 Support for jail (representing jid or jail name) keyword argument in kwargs CLI Example: .. code-block:: bash salt '*' service.enabled <service name> def enabled(name, *...
Return a list of all available services .. versionchanged:: 2016.3.4 jail: optional jid or jail name CLI Example: .. code-block:: bash salt '*' service.get_all def get_all(jail=None): ''' Return a list of all available services .. versionchanged:: 2016.3.4 jail: optional ...
Start the specified service .. versionchanged:: 2016.3.4 jail: optional jid or jail name CLI Example: .. code-block:: bash salt '*' service.start <service name> def start(name, jail=None): ''' Start the specified service .. versionchanged:: 2016.3.4 jail: optional jid or ...
Check to see if given python is installed. def _python_installed(ret, python, user=None): ''' Check to see if given python is installed. ''' default = __salt__['pyenv.default'](runas=user) for version in __salt__['pyenv.versions'](user): if version == python: ret['result'] = Tru...
Verify that python is installed, install if unavailable def _check_and_install_python(ret, python, default=False, user=None): ''' Verify that python is installed, install if unavailable ''' ret = _python_installed(ret, python, user=user) if not ret['result']: if __salt__['pyenv.install_pyth...
Verify that the specified python is installed with pyenv. pyenv is installed if necessary. name The version of python to install default : False Whether to make this python the default. user: None The user to run pyenv as. .. versionadded:: 0.17.0 .. versionadded...
Verify that python is uninstalled def _check_and_uninstall_python(ret, python, user=None): ''' Verify that python is uninstalled ''' ret = _python_installed(ret, python, user=user) if ret['result']: if ret['default']: __salt__['pyenv.default']('system', runas=user) if _...
Verify that the specified python is not installed with pyenv. pyenv is installed if necessary. name The version of python to uninstall user: None The user to run pyenv as. .. versionadded:: 0.17.0 .. versionadded:: 0.16.0 def absent(name, user=None): ''' Verify that ...
Install pyenv if not installed. Allows you to require pyenv be installed prior to installing the plugins. Useful if you want to install pyenv plugins via the git or file modules and need them installed before installing any rubies. Use the pyenv.root configuration option to set the path for pyenv if yo...
Send a message via SMTP .. code-block:: yaml server-warning-message: smtp.send_msg: - name: 'This is a server warning message' - profile: my-smtp-account - subject: 'Message from Salt' - recipient: admin@example.com - sender: admin@exam...
Answers to debconf questions for all packages in the following format:: {'package': [['question', 'type', 'value'], ...]} CLI Example: .. code-block:: bash salt '*' debconf.get_selections def get_selections(fetchempty=True): ''' Answers to debconf questions for all packages in the f...
Set answers to debconf questions for a package. CLI Example: .. code-block:: bash salt '*' debconf.set <package> <question> <type> <value> [<value> ...] def set_(package, question, type, value, *extra): ''' Set answers to debconf questions for a package. CLI Example: .. code-block:...
Set answers to debconf questions from a template. path location of the file containing the package selections template template format context variables to add to the template environment default default values for the template environment CLI Example: .. co...
Set answers to debconf questions from a file. CLI Example: .. code-block:: bash salt '*' debconf.set_file salt://pathto/pkg.selections def set_file(path, saltenv='base', **kwargs): ''' Set answers to debconf questions from a file. CLI Example: .. code-block:: bash salt '*'...
Call both with prep_jid on all returners in multi_returner TODO: finish this, what do do when you get different jids from 2 returners... since our jids are time based, this make this problem hard, because they aren't unique, meaning that we have to make sure that no one else got the jid and if they did...
Write return to all returners in multi_returner def returner(load): ''' Write return to all returners in multi_returner ''' for returner_ in __opts__[CONFIG_KEY]: _mminion().returners['{0}.returner'.format(returner_)](load)
Write load to all returners in multi_returner def save_load(jid, clear_load, minions=None): ''' Write load to all returners in multi_returner ''' for returner_ in __opts__[CONFIG_KEY]: _mminion().returners['{0}.save_load'.format(returner_)](jid, clear_load)
Merge the load data from all returners def get_load(jid): ''' Merge the load data from all returners ''' ret = {} for returner_ in __opts__[CONFIG_KEY]: ret.update(_mminion().returners['{0}.get_load'.format(returner_)](jid)) return ret
Return all job data from all returners def get_jids(): ''' Return all job data from all returners ''' ret = {} for returner_ in __opts__[CONFIG_KEY]: ret.update(_mminion().returners['{0}.get_jids'.format(returner_)]()) return ret
Clean out the old jobs from all returners (if you have it) def clean_old_jobs(): ''' Clean out the old jobs from all returners (if you have it) ''' for returner_ in __opts__[CONFIG_KEY]: fstr = '{0}.clean_old_jobs'.format(returner_) if fstr in _mminion().returners: _mminion(...
Ensure domain exists and is up-to-date name Name of the domain enabled Boolean to control if domain is enabled description An arbitrary description of the domain def present(name, auth=None, **kwargs): ''' Ensure domain exists and is up-to-date name Name of t...
Ensure domain does not exist name Name of the domain def absent(name, auth=None): ''' Ensure domain does not exist name Name of the domain ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} __salt__['keystoneng.setup_cl...
Runs the compound target check def match(tgt, opts=None): ''' Runs the compound target check ''' if not opts: opts = __opts__ nodegroups = opts.get('nodegroups', {}) matchers = salt.loader.matchers(opts) if not isinstance(tgt, six.string_types) and not isinstance(tgt, (list, tuple)...
Ensure that the marathon app with the given id is present and is configured to match the given config values. :param name: The app name/id :param config: The configuration to apply (dict) :return: A standard Salt changes dictionary def config(name, config): ''' Ensure that the marathon app wit...
Ensure that the marathon app with the given id is present and restart if set. :param name: The app name/id :param restart: Restart the app :param force: Override the current deployment :return: A standard Salt changes dictionary def running(name, restart=False, force=True): ''' Ensure that the...
Ensure cloud formation stack is present. name (string) - Name of the stack. template_body (string) – Structure containing the template body. Can also be loaded from a file by using salt://. template_url (string) – Location of file containing the template body. The URL must point to a template located in ...
Ensure cloud formation stack is absent. name (string) – The name of the stack to delete. region (string) - Region to connect to. key (string) - Secret key to be used. keyid (string) - Access key to be used. profile (dict) - A dict with region, key and keyid, or a pillar key (string) that contai...
Ensure that given continuous query is present. name Name of the continuous query to create. database Database to create continuous query on. query The query content resample_time : None Duration between continuous query resampling. coverage_period : None ...
Set the timezone for the system. name The name of the timezone to use (e.g.: America/Denver) utc Whether or not to set the hardware clock to UTC (default is True) def system(name, utc=True): ''' Set the timezone for the system. name The name of the timezone to use (e.g.: ...
Set up nova credentials def _auth(profile=None, **kwargs): ''' Set up nova credentials ''' keystone_api_args = None if kwargs is not None: if kwargs.get('keystone_api_args') is not None: keystone_api_args = kwargs['keystone_api_args'] if profile: credentials = __sal...
Boot (create) a new instance name Name of the new instance (must be first) flavor_id Unique integer ID for the flavor image_id Unique integer ID for the image timeout How long to wait, after creating the instance, for the provider to return information about i...
List storage volumes search_opts Dictionary of search options profile Profile to use CLI Example: .. code-block:: bash salt '*' nova.volume_list search_opts='{"display_name": "myblock"}' profile=openstack def volume_list(search_opts=None, profile=None, **kwargs): ''' ...
Create a block storage volume name Name of the volume profile Profile to use CLI Example: .. code-block:: bash salt '*' nova.volume_show myblock profile=openstack def volume_show(name, profile=None, **kwargs): ''' Create a block storage volume name Name...
Create a block storage volume name Name of the new volume (must be first) size Volume size snapshot Block storage snapshot id voltype Type of storage profile Profile to build on CLI Example: .. code-block:: bash salt '*' nova.volume_cre...
Destroy the volume name Name of the volume profile Profile to build on CLI Example: .. code-block:: bash salt '*' nova.volume_delete myblock profile=openstack def volume_delete(name, profile=None, **kwargs): ''' Destroy the volume name Name of the volum...
Attach a block storage volume name Name of the new volume to attach server_name Name of the server to detach from profile Profile to build on CLI Example: .. code-block:: bash salt '*' nova.volume_detach myblock profile=openstack def volume_detach(name, profile...
Attach a block storage volume name Name of the new volume to attach server_name Name of the server to attach to device Name of the device on the server profile Profile to build on CLI Example: .. code-block:: bash salt '*' nova.volume_attach myblock...
Suspend an instance instance_id ID of the instance to be suspended CLI Example: .. code-block:: bash salt '*' nova.suspend 1138 def suspend(instance_id, profile=None, **kwargs): ''' Suspend an instance instance_id ID of the instance to be suspended CLI Example:...
Resume an instance instance_id ID of the instance to be resumed CLI Example: .. code-block:: bash salt '*' nova.resume 1138 def resume(instance_id, profile=None, **kwargs): ''' Resume an instance instance_id ID of the instance to be resumed CLI Example: .....
Lock an instance instance_id ID of the instance to be locked CLI Example: .. code-block:: bash salt '*' nova.lock 1138 def lock(instance_id, profile=None, **kwargs): ''' Lock an instance instance_id ID of the instance to be locked CLI Example: .. code-bloc...
Delete an instance instance_id ID of the instance to be deleted CLI Example: .. code-block:: bash salt '*' nova.delete 1138 def delete(instance_id, profile=None, **kwargs): ''' Delete an instance instance_id ID of the instance to be deleted CLI Example: .....
Return a list of available flavors (nova flavor-list) CLI Example: .. code-block:: bash salt '*' nova.flavor_list def flavor_list(profile=None, **kwargs): ''' Return a list of available flavors (nova flavor-list) CLI Example: .. code-block:: bash salt '*' nova.flavor_list ...
Add a flavor to nova (nova flavor-create). The following parameters are required: name Name of the new flavor (must be first) flavor_id Unique integer ID for the new flavor ram Memory size in MB disk Disk size in GB vcpus Number of vcpus is_public ...
Delete a flavor from nova by id (nova flavor-delete) CLI Example: .. code-block:: bash salt '*' nova.flavor_delete 7 def flavor_delete(flavor_id, profile=None, **kwargs): # pylint: disable=C0103 ''' Delete a flavor from nova by id (nova flavor-delete) CLI Example: .. code-block:: ...
Return a list of project IDs assigned to flavor ID CLI Example: .. code-block:: bash salt '*' nova.flavor_access_list flavor_id=ID def flavor_access_list(flavor_id, profile=None, **kwargs): ''' Return a list of project IDs assigned to flavor ID CLI Example: .. code-block:: bash ...
Add a project to the flavor access list CLI Example: .. code-block:: bash salt '*' nova.flavor_access_add flavor_id=fID project_id=pID def flavor_access_add(flavor_id, project_id, profile=None, **kwargs): ''' Add a project to the flavor access list CLI Example: .. code-block:: bash...
Remove a project from the flavor access list CLI Example: .. code-block:: bash salt '*' nova.flavor_access_remove flavor_id=fID project_id=pID def flavor_access_remove(flavor_id, project_id, profile=None, **kwargs): ''' Remove a project from the flavor access list CLI Example: .. c...
Add a keypair to nova (nova keypair-add) CLI Examples: .. code-block:: bash salt '*' nova.keypair_add mykey pubfile='/home/myuser/.ssh/id_rsa.pub' salt '*' nova.keypair_add mykey pubkey='ssh-rsa <key> myuser@mybox' def keypair_add(name, pubfile=None, pubkey=None, profile=None, **kwargs): ...
Add a keypair to nova (nova keypair-delete) CLI Example: .. code-block:: bash salt '*' nova.keypair_delete mykey def keypair_delete(name, profile=None, **kwargs): ''' Add a keypair to nova (nova keypair-delete) CLI Example: .. code-block:: bash salt '*' nova.keypair_delete...
Return a list of available images (nova images-list + nova image-show) If a name is provided, only that image will be displayed. CLI Examples: .. code-block:: bash salt '*' nova.image_list salt '*' nova.image_list myimage def image_list(name=None, profile=None, **kwargs): ''' Ret...
Sets a key=value pair in the metadata for an image (nova image-meta set) CLI Examples: .. code-block:: bash salt '*' nova.image_meta_set 6f52b2ff-0b31-4d84-8fd1-af45b84824f6 cheese=gruyere salt '*' nova.image_meta_set name=myimage salad=pasta beans=baked def image_meta_set(image_id=None, ...
Delete a key=value pair from the metadata for an image (nova image-meta set) CLI Examples: .. code-block:: bash salt '*' nova.image_meta_delete 6f52b2ff-0b31-4d84-8fd1-af45b84824f6 keys=cheese salt '*' nova.image_meta_delete name=myimage keys=salad,beans def image_meta_delete(image_id=No...
Return detailed information for an active server CLI Example: .. code-block:: bash salt '*' nova.server_show <server_id> def server_show(server_id, profile=None, **kwargs): ''' Return detailed information for an active server CLI Example: .. code-block:: bash salt '*' nova...
Add a secgroup to nova (nova secgroup-create) CLI Example: .. code-block:: bash salt '*' nova.secgroup_create mygroup 'This is my security group' def secgroup_create(name, description, profile=None, **kwargs): ''' Add a secgroup to nova (nova secgroup-create) CLI Example: .. code-b...
Delete a secgroup to nova (nova secgroup-delete) CLI Example: .. code-block:: bash salt '*' nova.secgroup_delete mygroup def secgroup_delete(name, profile=None, **kwargs): ''' Delete a secgroup to nova (nova secgroup-delete) CLI Example: .. code-block:: bash salt '*' nova....
Return information about a server name Server Name CLI Example: .. code-block:: bash salt '*' nova.server_by_name myserver profile=openstack def server_by_name(name, profile=None, **kwargs): ''' Return information about a server name Server Name CLI Example: ...
Read list of models and returns a Root object with the proper models added. def _get_root_object(models): ''' Read list of models and returns a Root object with the proper models added. ''' root = napalm_yang.base.Root() for model in models: current = napalm_yang for part in model.s...
Returns the difference between two configuration entities structured according to the YANG model. .. note:: This function is recommended to be used mostly as a state helper. candidate First model to compare. running Second model to compare. models A list of models...
Parse configuration from the device. models A list of models to be used when parsing. config: ``False`` Parse config. state: ``False`` Parse state. profiles: ``None`` Use certain profiles to parse. If not specified, will use the device default profile(s). ...
Return the native config. data Dictionary structured with respect to the models referenced. models A list of models to be used when generating the config. profiles: ``None`` Use certain profiles to generate the config. If not specified, will use the platform default profil...
Generate and load the config on the device using the OpenConfig or IETF models and device profiles. data Dictionary structured with respect to the models referenced. models A list of models to be used when generating the config. profiles: ``None`` Use certain profiles to gener...
Return the compliance report using YANG objects. data Dictionary structured with respect to the models referenced. models A list of models to be used when generating the config. filepath The absolute path to the validation file. CLI Example: .. code-block:: bash ...
Ensure a specific value exists at a given path :param name: The name for this rule :type name: ``str`` :param datastore: The datastore, e.g. running, operational. One of the NETCONF store IETF types :type datastore: :class:`DatastoreType` (``str`` enum). :param path: The device path to ...
Manage RBAC properties for user name : string username roles : list list of roles for user profiles : list list of profiles for user authorizations : list list of authorizations for user .. warning:: All existing roles, profiles and authorizations will be re...
Return True if the minion matches the given pillar target. The ``delimiter`` argument can be used to specify a different delimiter. CLI Example: .. code-block:: bash salt '*' match.pillar 'cheese:foo' salt '*' match.pillar 'clone_url|https://github.com/saltstack/salt.git' delimiter='|' ...
Return True if the minion matches the given data target CLI Example: .. code-block:: bash salt '*' match.data 'spam:eggs' def data(tgt): ''' Return True if the minion matches the given data target CLI Example: .. code-block:: bash salt '*' match.data 'spam:eggs' ''' ...
Return True if the minion ID matches the given pcre target minion_id Specify the minion ID to match against the target expression .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' match.pcre '.*' def pcre(tgt, minion_id=None): ''' Return True if the ...
Return the first match in a dictionary of target patterns .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' match.filter_by '{foo*: Foo!, bar*: Bar!}' minion_id=bar03 Pillar Example: .. code-block:: jinja # Filter the data for the current minion into a vari...
Search a dictionary of target strings for matching targets This is the inverse of :py:func:`match.filter_by <salt.modules.match.filter_by>` and allows matching values instead of matching keys. A minion can be matched by multiple entries. .. versionadded:: 2017.7.0 CLI Example: .. code-block:...
Execute varnishadm command return the output of the command cmd The command to run in varnishadm params Any additional args to add to the command line kwargs Additional options to pass to the salt cmd.run_all function def _run_varnishadm(cmd, params=(), **kwargs): ''' ...
Return server version from varnishd -V CLI Example: .. code-block:: bash salt '*' varnish.version def version(): ''' Return server version from varnishd -V CLI Example: .. code-block:: bash salt '*' varnish.version ''' cmd = ['varnishd', '-V'] out = __salt__['c...
Show params of varnish cache CLI Example: .. code-block:: bash salt '*' varnish.param_show param def param_show(param=None): ''' Show params of varnish cache CLI Example: .. code-block:: bash salt '*' varnish.param_show param ''' ret = _run_varnishadm('param.show',...
Removes dirtyID tags from the candidate config result. Palo Alto devices will make the candidate configuration with a dirty ID after a change. This can cause unexpected results when parsing. def _strip_dirty(xmltree): ''' Removes dirtyID tags from the candidate config result. Palo Alto devices will make th...
This function gets called when the proxy starts up. For panos devices, a determination is made on the connection type and the appropriate connection details that must be cached. def init(opts): ''' This function gets called when the proxy starts up. For panos devices, a determination is made on the...
This function captures the query string and sends it to the Palo Alto device. def call(payload=None): ''' This function captures the query string and sends it to the Palo Alto device. ''' r = None try: if DETAILS['method'] == 'dev_key': # Pass the api key without the target decl...
Because different versions of Palo Alto support different command sets, this function will return true if the current version of Palo Alto supports the required command. def is_required_version(required_version='0.0.0'): ''' Because different versions of Palo Alto support different command sets, this funct...
Get the grains from the proxied device def grains(): ''' Get the grains from the proxied device ''' if not DETAILS.get('grains_cache', {}): DETAILS['grains_cache'] = GRAINS_CACHE try: query = {'type': 'op', 'cmd': '<show><system><info></info></system></show>'} DE...
append ``comment`` to ``ret['comment']`` def _append_comment(ret, comment): ''' append ``comment`` to ``ret['comment']`` ''' if ret['comment']: ret['comment'] = ret['comment'].rstrip() + '\n' + comment else: ret['comment'] = comment return ret
Ensure that the specified kernel module is loaded name The name of the kernel module to verify is loaded persist Also add module to ``/etc/modules`` mods A list of modules to verify are loaded. If this argument is used, the ``name`` argument, although still required, is n...
Verify that the named kernel module is not loaded name The name of the kernel module to verify is not loaded persist Remove module from ``/etc/modules`` comment Comment out module in ``/etc/modules`` rather than remove it mods A list of modules to verify are unloaded....
Invoke a function in the lxc module with no args path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 def _do(name, fun, path=None): ''' Invoke a function in the lxc module with no args path path to the container parent ...
Invoke a function in the lxc module with no args path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 def _do_names(names, fun, path=None): ''' Invoke a function in the lxc module with no args path path to the container p...
Returns the host for a container. path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 .. code-block:: bash salt-run lxc.find_guest name def find_guest(name, quiet=False, path=None): ''' Returns the host for a container...
Return a dict of hosts and named guests path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 def find_guests(names, path=None): ''' Return a dict of hosts and named guests path path to the container parent default...
Initialize a new container .. code-block:: bash salt-run lxc.init name host=minion_id [cpuset=cgroups_cpuset] \\ [cpushare=cgroups_cpushare] [memory=cgroups_memory] \\ [template=lxc_template_name] [clone=original name] \\ [profile=lxc_profile] [network_prof...
Wrapper for using lxc.init in saltcloud compatibility mode names Name of the containers, supports a single name or a comma delimited list of names. host Minion to start the container on. Required. path path to the container parent default: /var/lib/lxc (system defa...
Return a generator iterating over hosts path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 def _list_iter(host=None, path=None): ''' Return a generator iterating over hosts path path to the container parent defa...
List defined containers (running, stopped, and frozen) for the named (or all) host(s). path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 .. code-block:: bash salt-run lxc.list [host=minion_id] def list_(host=None, quiet=F...
Purge the named container and delete its minion key if present. WARNING: Destroys all data associated with the container. path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 .. code-block:: bash salt-run lxc.purge name def ...
Start the named container. path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 .. code-block:: bash salt-run lxc.start name def start(name, quiet=False, path=None): ''' Start the named container. path path ...
Return the location of the SELinux VFS directory CLI Example: .. code-block:: bash salt '*' selinux.selinux_fs_path def selinux_fs_path(): ''' Return the location of the SELinux VFS directory CLI Example: .. code-block:: bash salt '*' selinux.selinux_fs_path ''' # ...
Return the mode selinux is running in CLI Example: .. code-block:: bash salt '*' selinux.getenforce def getenforce(): ''' Return the mode selinux is running in CLI Example: .. code-block:: bash salt '*' selinux.getenforce ''' _selinux_fs_path = selinux_fs_path() ...
Return the selinux mode from the config file CLI Example: .. code-block:: bash salt '*' selinux.getconfig def getconfig(): ''' Return the selinux mode from the config file CLI Example: .. code-block:: bash salt '*' selinux.getconfig ''' try: config = '/etc/...
Set the SELinux enforcing mode CLI Example: .. code-block:: bash salt '*' selinux.setenforce enforcing def setenforce(mode): ''' Set the SELinux enforcing mode CLI Example: .. code-block:: bash salt '*' selinux.setenforce enforcing ''' if isinstance(mode, six.strin...
Set the value for a boolean CLI Example: .. code-block:: bash salt '*' selinux.setsebool virt_use_usb off def setsebool(boolean, value, persist=False): ''' Set the value for a boolean CLI Example: .. code-block:: bash salt '*' selinux.setsebool virt_use_usb off ''' ...
Set the value of multiple booleans CLI Example: .. code-block:: bash salt '*' selinux.setsebools '{virt_use_usb: on, squid_use_tproxy: off}' def setsebools(pairs, persist=False): ''' Set the value of multiple booleans CLI Example: .. code-block:: bash salt '*' selinux.sets...
Return a structure listing all of the selinux booleans on the system and what state they are in CLI Example: .. code-block:: bash salt '*' selinux.list_sebool def list_sebool(): ''' Return a structure listing all of the selinux booleans on the system and what state they are in C...
Enable or disable an SELinux module. CLI Example: .. code-block:: bash salt '*' selinux.setsemod nagios Enabled .. versionadded:: 2016.3.0 def setsemod(module, state): ''' Enable or disable an SELinux module. CLI Example: .. code-block:: bash salt '*' selinux.setsemod...