text
stringlengths
81
112k
r''' A function to connect to a bigip device and create a virtual server. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the virtual to create destination [ [virtual_a...
A function to connect to a bigip device and list an existing profile. If no name is provided than all profiles of the specified type will be listed. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password profile...
r''' A function to connect to a bigip device and create a profile. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password profile_type The type of profile to create name The name of the profil...
A function to connect to a bigip device and delete an existing profile. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password profile_type The type of profile to delete name The name of the profi...
List the beacons currently configured on the minion. Args: return_yaml (bool): Whether to return YAML formatted output, default ``True``. include_pillar (bool): Whether to include beacons that are configured in pillar, default is ``True``. include_opts...
Add a beacon on the minion Args: name (str): Name of the beacon to configure beacon_data (dict): Dictionary or list containing configuration for beacon. Returns: dict: Boolean and status message on success or failure of add. CLI Example: .. code-bloc...
Modify an existing beacon. Args: name (str): Name of the beacon to configure. beacon_data (dict): Dictionary or list containing updated configuration for beacon. Returns: dict: Boolean and status message on success or failure of modify. CLI Example: ...
Save all configured beacons to the minion config. Returns: dict: Boolean and status message on success or failure of save. CLI Example: .. code-block:: bash salt '*' beacons.save def save(**kwargs): ''' Save all configured beacons to the minion config. Returns: dict...
Enable a beacon on the minion. Args: name (str): Name of the beacon to enable. Returns: dict: Boolean and status message on success or failure of enable. CLI Example: .. code-block:: bash salt '*' beacons.enable_beacon ps def enable_beacon(name, **kwargs): ''' Enabl...
Set a key/value pair in the REST interface def set_(key, value, service=None, profile=None): # pylint: disable=W0613 ''' Set a key/value pair in the REST interface ''' return query(key, value, service, profile)
Get a value from the REST interface def query(key, value=None, service=None, profile=None): # pylint: disable=W0613 ''' Get a value from the REST interface ''' comps = key.split('?') key = comps[0] key_vars = {} for pair in comps[1].split('&'): pair_key, pair_val = pair.split('=') ...
Send an event to the Salt Master .. versionadded:: 2014.7.0 Accepts the same arguments as the :py:func:`event.send <salt.modules.event.send>` execution module of the same name, with the additional argument: :param show_changed: If ``True``, state will show as changed with the data argumen...
Compare the common keys between security group rules against eachother def _rule_compare(rule1, rule2): ''' Compare the common keys between security group rules against eachother ''' commonkeys = set(rule1.keys()).intersection(rule2.keys()) for key in commonkeys: if rule1[key] != rule2[key...
Ensure a security group rule exists defaults: port_range_min=None, port_range_max=None, protocol=None, remote_ip_prefix=None, remote_group_id=None, direction='ingress', ethertype='IPv4', project_id=None name Name of the security group to associate with this rule projec...
Ensure a security group rule does not exist name name or id of the security group rule to delete rule_id uuid of the rule to delete project_id id of project to delete rule from def absent(name, auth=None, **kwargs): ''' Ensure a security group rule does not exist nam...
Perform an HTTP query and statefully return the result Passes through all the parameters described in the :py:func:`utils.http.query function <salt.utils.http.query>`: name The name of the query. match Specifies a pattern to look for in the return text. By default, this will p...
Like query but, repeat and wait until match/match_type or status is fulfilled. State returns result from last query state in case of success or if no successful query was made within wait_for timeout. name The name of the query. wait_for Total time to wait for requests that succeed. r...
Parse Dell DRAC output def __parse_drac(output): ''' Parse Dell DRAC output ''' drac = {} section = '' for i in output.splitlines(): if i.strip().endswith(':') and '=' not in i: section = i[0:-1] drac[section] = {} if i.rstrip() and '=' in i: ...
Execute rac commands def __execute_cmd(command, host=None, admin_username=None, admin_password=None, module=None): ''' Execute rac commands ''' if module: # -a takes 'server' or 'switch' to represent all servers # or all switches in a chassis. Allow ...
Execute rac commands def __execute_ret(command, host=None, admin_username=None, admin_password=None, module=None): ''' Execute rac commands ''' if module: if module == 'ALL': modswitch = '-a ' else: modswitch = '-m {0}'.format(...
.. versionadded:: Fluorine Return specific property host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. property: The property which should be get. CLI Example: .. code-b...
.. versionadded:: Fluorine Set specific property host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. property: The property which should be set. value: The value which...
.. versionadded:: Fluorine Ensure that property is set to specific value host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. property: The property which should be set. value:...
Return System information CLI Example: .. code-block:: bash salt dell dracr.system_info def system_info(host=None, admin_username=None, admin_password=None, module=None): ''' Return System information CLI Example: .. code-block:: bash salt d...
Return Network Configuration CLI Example: .. code-block:: bash salt dell dracr.network_info def network_info(host=None, admin_username=None, admin_password=None, module=None): ''' Return Network Configuration CLI Example: .. code-b...
Configure the nameservers on the DRAC CLI Example: .. code-block:: bash salt dell dracr.nameservers [NAMESERVERS] salt dell dracr.nameservers ns1.example.com ns2.example.com admin_username=root admin_password=calvin module=server-1 host=192.168.1.1 def nameservers(ns,...
Configure syslog remote logging, by default syslog will automatically be enabled if a server is specified. However, if you want to disable syslog you will need to specify a server followed by False CLI Example: .. code-block:: bash salt dell dracr.syslog [SYSLOG IP] [ENABLE/DISABLE] s...
Enable/Disable email alerts CLI Example: .. code-block:: bash salt dell dracr.email_alerts True salt dell dracr.email_alerts False def email_alerts(action, host=None, admin_username=None, admin_password=None): ''' Enable/Disable emai...
List all DRAC users CLI Example: .. code-block:: bash salt dell dracr.list_users def list_users(host=None, admin_username=None, admin_password=None, module=None): ''' List all DRAC users CLI Example: .. code-block:: bash salt de...
Delete a user CLI Example: .. code-block:: bash salt dell dracr.delete_user [USERNAME] [UID - optional] salt dell dracr.delete_user diana 4 def delete_user(username, uid=None, host=None, admin_username=None, admin_password=None)...
Change user's password CLI Example: .. code-block:: bash salt dell dracr.change_password [USERNAME] [PASSWORD] uid=[OPTIONAL] host=<remote DRAC> admin_username=<DRAC user> admin_password=<DRAC PW> salt dell dracr.change_password diana secret Note that if only a us...
Change the QuickDeploy password, used for switches as well CLI Example: .. code-block:: bash salt dell dracr.deploy_password [USERNAME] [PASSWORD] host=<remote DRAC> admin_username=<DRAC user> admin_password=<DRAC PW> salt dell dracr.change_password diana secret N...
Change the QuickDeploy SNMP community string, used for switches as well CLI Example: .. code-block:: bash salt dell dracr.deploy_snmp SNMP_STRING host=<remote DRAC or CMC> admin_username=<DRAC user> admin_password=<DRAC PW> salt dell dracr.deploy_password diana secret ...
Configure CMC or individual iDRAC SNMP community string. Use ``deploy_snmp`` for configuring chassis switch SNMP. CLI Example: .. code-block:: bash salt dell dracr.set_snmp [COMMUNITY] salt dell dracr.set_snmp public def set_snmp(community, host=None, admin_username=None, ad...
Configure Network on the CMC or individual iDRAC. Use ``set_niccfg`` for blade and switch addresses. CLI Example: .. code-block:: bash salt dell dracr.set_network [DRAC IP] [NETMASK] [GATEWAY] salt dell dracr.set_network 192.168.0.2 255.255.255.0 192.168.0.1 admin_username=roo...
status One of 'powerup', 'powerdown', 'powercycle', 'hardreset', 'graceshutdown' host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. module The element to reboot on the ...
Issues a power-cycle operation on the managed server. This action is similar to pressing the power button on the system's front panel to power down and then power up the system. host The chassis host. admin_username The username used to access the chassis. admin_password T...
Powers down the managed server. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. module The element to power off on the chassis such as a blade. If not provided, the chassis ...
Powers up the managed server. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. module The element to power on located on the chassis such as a blade. If not provided, the cha...
Performs a reset (reboot) operation on the managed server. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. module The element to hard reset on the chassis such as a blade. If ...
return the power status for the passed module CLI Example: .. code-block:: bash salt dell drac.server_powerstatus def server_powerstatus(host=None, admin_username=None, admin_password=None, module=None): ''' return the powe...
Configure server to PXE perform a one off PXE boot CLI Example: .. code-block:: bash salt dell dracr.server_pxe def server_pxe(host=None, admin_username=None, admin_password=None): ''' Configure server to PXE perform a one off PXE boot CLI Example: .. ...
List the names of all slots in the chassis. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. CLI Example: .. code-block:: bash salt-call --local dracr.list_slotnames host=111.2...
Get the name of a slot number in the chassis. slot The number of the slot for which to obtain the name. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. CLI Example: .. cod...
Set the name of a slot in a chassis. slot The slot number to change. name The name to set. Can only be 15 characters long. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassi...
Set the name of the chassis. name The name to be set on the chassis. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. CLI Example: .. code-block:: bash salt '*' dr...
Get the name of a chassis. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. CLI Example: .. code-block:: bash salt '*' dracr.get_chassis_name host=111.222.333.444 a...
Set the location of the chassis. location The name of the location to be set on the chassis. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. CLI Example: .. code-block:: b...
Get the location of the chassis. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. CLI Example: .. code-block:: bash salt '*' dracr.set_chassis_location host=111.222.333.444 ...
Set the location of the chassis. location The name of the datacenter to be set on the chassis. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. CLI Example: .. code-block::...
Get the datacenter of the chassis. host The chassis host. admin_username The username used to access the chassis. admin_password The password used to access the chassis. CLI Example: .. code-block:: bash salt '*' dracr.set_chassis_location host=111.222.333.444 ...
Run a generic racadm command against a particular blade in a chassis. Blades are usually named things like 'server-1', 'server-2', etc. If the iDRAC has a different password than the CMC, then you can pass it with the idrac_password kwarg. :param blade_name: Name of the blade to run the command o...
Updates firmware using local firmware file .. code-block:: bash salt dell dracr.update_firmware firmware.exe This executes the following command on your FX2 (using username and password stored in the pillar data) .. code-block:: bash racadm update –f firmware.exe -u user –p pass ...
Executes the following for CIFS (using username and password stored in the pillar data) .. code-block:: bash racadm update -f <updatefile> -u user –p pass -l //IP-Address/share Or for NFS (using username and password stored in the pillar data) .. code-block:: bash racadm upda...
Send a message to a Microsft Teams channel .. code-block:: yaml send-msteams-message: msteams.post_card: - message: 'This state was executed successfully.' - hook_url: https://outlook.office.com/webhook/837 The following parameters are required: message ...
Accept keys based on a dict of keys. Returns a dictionary. match The dictionary of keys to accept. include_rejected To include rejected keys in the match along with pending keys, set this to ``True``. Defaults to ``False``. .. versionadded:: 2016.3.4 include_denied ...
Reject keys based on a glob match. Returns a dictionary. match The glob match of keys to reject. include_accepted To include accepted keys in the match along with pending keys, set this to ``True``. Defaults to ``False``. include_denied To include denied keys in the match ...
Return the matching key fingerprints. Returns a dictionary. match The key for with to retrieve the fingerprint. hash_type The hash algorithm used to calculate the fingerprint .. code-block:: python >>> wheel.cmd('key.finger', ['minion1']) {'minions': {'minion1': '5d:f6:79...
Return the fingerprint of the master's public key hash_type The hash algorithm used to calculate the fingerprint .. code-block:: python >>> wheel.cmd('key.finger_master') {'local': {'master.pub': '5d:f6:79:43:5e:d4:42:3f:57:b8:45:a8:7e:a4:6e:ca'}} def finger_master(hash_type=None): ...
r''' Generate a key pair. No keys are stored on the master. A key pair is returned as a dict containing pub and priv keys. Returns a dictionary containing the the ``pub`` and ``priv`` keys with their generated values. id\_ Set a name to generate a key pair for use with salt. If not specified, ...
r''' Generate a key pair then accept the public key. This function returns the key pair in a dict, only the public key is preserved on the master. Returns a dictionary. id\_ The name of the minion for which to generate a key pair. keysize The size of the key pair to generate. The s...
Generate minion RSA public keypair def gen_keys(keydir=None, keyname=None, keysize=None, user=None): ''' Generate minion RSA public keypair ''' skey = get_key(__opts__) return skey.gen_keys(keydir, keyname, keysize, user)
Generate master public-key-signature def gen_signature(priv, pub, signature_path, auto_create=False, keysize=None): ''' Generate master public-key-signature ''' skey = get_key(__opts__) return skey.gen_keys_signature(priv, pub, signature_path, auto_create, keysize)
Return information on a directory located on the Moose CLI Example: .. code-block:: bash salt '*' moosefs.dirinfo /path/to/dir/ [-[n][h|H]] def dirinfo(path, opts=None): ''' Return information on a directory located on the Moose CLI Example: .. code-block:: bash salt '*' m...
Return information on a file located on the Moose CLI Example: .. code-block:: bash salt '*' moosefs.fileinfo /path/to/dir/ def fileinfo(path): ''' Return information on a file located on the Moose CLI Example: .. code-block:: bash salt '*' moosefs.fileinfo /path/to/dir/ ...
Return a list of current MooseFS mounts CLI Example: .. code-block:: bash salt '*' moosefs.mounts def mounts(): ''' Return a list of current MooseFS mounts CLI Example: .. code-block:: bash salt '*' moosefs.mounts ''' cmd = 'mount' ret = {} out = __salt__['...
Return goal(s) for a file or directory CLI Example: .. code-block:: bash salt '*' moosefs.getgoal /path/to/file [-[n][h|H]] salt '*' moosefs.getgoal /path/to/dir/ [-[n][h|H][r]] def getgoal(path, opts=None): ''' Return goal(s) for a file or directory CLI Example: .. code-bl...
Helper function for running the auditpol command Args: cmd (str): the auditpol command to run Returns: list: A list containing each line of the return (splitlines) Raises: CommandExecutionError: If the command encounters an error def _auditpol_cmd(cmd): ''' Helper functio...
Get the current configuration for all audit settings specified in the category Args: category (str): One of the nine categories to return. Can also be ``All`` to return the settings for all categories. Valid options are: - Account Logon - Account Managem...
Get the current configuration for the named audit setting Args: name (str): The name of the setting to retrieve Returns: str: The current configuration for the named setting Raises: KeyError: On invalid setting name CommandExecutionError: If an error is encountered retriev...
Set the configuration for the named audit setting Args: name (str): The name of the setting to configure value (str): The configuration for the named value. Valid options are: - No Auditing - Success - Failure - Success and ...
Gets the contents of an auditpol /backup. Used by the LGPO module to get fieldnames and GUIDs for Advanced Audit policies. Returns: list: A list of lines form the backup file Usage: .. code-block:: python import salt.utils.win_lgpo_auditpol dump = salt.utils.win_lgpo_auditpo...
Check to see if given ruby is installed. def _ruby_installed(ret, ruby, user=None): ''' Check to see if given ruby is installed. ''' default = __salt__['rbenv.default'](runas=user) for version in __salt__['rbenv.versions'](user): if version == ruby: ret['result'] = True ...
Verify that ruby is installed, install if unavailable def _check_and_install_ruby(ret, ruby, default=False, user=None): ''' Verify that ruby is installed, install if unavailable ''' ret = _ruby_installed(ret, ruby, user=user) if not ret['result']: if __salt__['rbenv.install_ruby'](ruby, run...
Verify that the specified ruby is installed with rbenv. Rbenv is installed if necessary. name The version of ruby to install default : False Whether to make this ruby the default. user: None The user to run rbenv as. .. versionadded:: 0.17.0 .. versionadded:: 0.1...
Verify that ruby is uninstalled def _check_and_uninstall_ruby(ret, ruby, user=None): ''' Verify that ruby is uninstalled ''' ret = _ruby_installed(ret, ruby, user=user) if ret['result']: if ret['default']: __salt__['rbenv.default']('system', runas=user) if __salt__['rbe...
Verify that the specified ruby is not installed with rbenv. Rbenv is installed if necessary. name The version of ruby to uninstall user: None The user to run rbenv as. .. versionadded:: 0.17.0 .. versionadded:: 0.16.0 def absent(name, user=None): ''' Verify that the ...
Verify that rbenv is installed, install if unavailable def _check_and_install_rbenv(ret, user=None): ''' Verify that rbenv is installed, install if unavailable ''' ret = _check_rbenv(ret, user) if ret['result'] is False: if __salt__['rbenv.install'](user): ret['result'] = True ...
Install rbenv if not installed. Allows you to require rbenv be installed prior to installing the plugins. Useful if you want to install rbenv plugins via the git or file modules and need them installed before installing any rubies. Use the rbenv.root configuration option to set the path for rbenv if yo...
Build a well-formatted nftables rule based on kwargs. A `table` and `chain` are not required, unless `full` is True. If `full` is `True`, then `table`, `chain` and `command` are required. `command` may be specified as either insert, append, or delete. This will return the nftables command, exactly as i...
Return a data structure of the rules in the conf file CLI Example: .. code-block:: bash salt '*' nftables.get_saved_rules def get_saved_rules(conf_file=None): ''' Return a data structure of the rules in the conf file CLI Example: .. code-block:: bash salt '*' nftables.get_...
Return a data structure of the current, in-memory rules CLI Example: .. code-block:: bash salt '*' nftables.get_rules salt '*' nftables.get_rules family=ipv6 def get_rules(family='ipv4'): ''' Return a data structure of the current, in-memory rules CLI Example: .. code-bloc...
Save the current in-memory rules to disk CLI Example: .. code-block:: bash salt '*' nftables.save /etc/nftables def save(filename=None, family='ipv4'): ''' Save the current in-memory rules to disk CLI Example: .. code-block:: bash salt '*' nftables.save /etc/nftables '...
Get the handle for a particular rule This function accepts a rule in a standard nftables command format, starting with the chain. Trying to force users to adapt to a new method of creating rules would be irritating at best, and we already have a parser that can handle it. CLI Example: ...
Check for the existence of a rule in the table and chain This function accepts a rule in a standard nftables command format, starting with the chain. Trying to force users to adapt to a new method of creating rules would be irritating at best, and we already have a parser that can handle it...
Check for the existence of a table CLI Example:: salt '*' nftables.check_table nat def check_table(table=None, family='ipv4'): ''' Check for the existence of a table CLI Example:: salt '*' nftables.check_table nat ''' ret = {'comment': '', 'result': False} if...
.. versionadded:: 2014.7.0 Create new chain to the specified table. CLI Example: .. code-block:: bash salt '*' nftables.new_chain filter input salt '*' nftables.new_chain filter input \\ table_type=filter hook=input priority=0 salt '*' nftables.new_chain filter ...
Flush the chain in the specified table, flush all chains in the specified table if chain is not specified. CLI Example: .. code-block:: bash salt '*' nftables.flush filter salt '*' nftables.flush filter input IPv6: salt '*' nftables.flush filter input family=ipv6 def fl...
Rewrite all state declarations that look like this:: state_id_decl: state.func into:: state_id_decl: state.func: [] def rewrite_single_shorthand_state_decl(data): # pylint: disable=C0103 ''' Rewrite all state declarations that look like this:: state_id_decl: s...
Convert ``relative`` sls reference into absolute, relative to ``sls``. def _relative_to_abs_sls(relative, sls): ''' Convert ``relative`` sls reference into absolute, relative to ``sls``. ''' levels, suffix = re.match(r'^(\.+)(.*)$', relative).groups() level_count = len(levels) p_comps = sls.spl...
Given a list of items:: - whatever - name1: value1 - name2: - key: value - key: value return a generator that yields each (item, key, value) tuple, skipping items that are not name-value's(dictionaries) or those not in the list of matching names. The item in the...
Like nvlist but applied one more time to each returned value. So, given a list, args, of arguments to a state like this:: - name: echo test - cwd: / - require: - file: test.sh nvlist2(args, ['require']) would yield the tuple, (dict_item, 'file', 'test.sh') where dict_item is the...
Retrieve the API params from the config file. def _get_api_params(api_url=None, page_id=None, api_key=None, api_version=None): ''' Retrieve the API params from the config file. ''' statuspage_cfg = __salt__['config.get']('statuspage') if n...
Validate the API params as specified in the config file. def _validate_api_params(params): ''' Validate the API params as specified in the config file. ''' # page_id and API key are mandatory and they must be string/unicode return (isinstance(params['api_page_id'], (six.string_types, six.text_type)...
Make the HTTP request and return the body as python object. def _http_request(url, method='GET', headers=None, data=None): ''' Make the HTTP request and return the body as python object. ''' req = requests.request(method, ...
Retrieve a specific endpoint from the Statuspage API. endpoint: incidents Request a specific endpoint. page_id Page ID. Can also be specified in the config file. api_key API key. Can also be specified in the config file. api_version: 1 API version. Can also be specifi...
Update attribute(s) of a specific endpoint. id The unique ID of the enpoint entry. endpoint: incidents Endpoint name. page_id Page ID. Can also be specified in the config file. api_key API key. Can also be specified in the config file. api_version: 1 API ...
Remove an entry from an endpoint. endpoint: incidents Request a specific endpoint. page_id Page ID. Can also be specified in the config file. api_key API key. Can also be specified in the config file. api_version: 1 API version. Can also be specified in the config fil...
Return a list of tuples to seed the "env" list, which is used to set environment variables for any pkg_add commands that are spawned. If ``fromrepo`` or ``packagesite`` are None, then their corresponding config parameter will be looked up with config.get. If both ``fromrepo`` and ``packagesite`` are N...
Since pkg_delete requires the full "pkgname-version" string, this function will attempt to match the package name with its version. Returns a list of partial matches and package names that match the "pkgname-version" string required by pkg_delete, and a list of errors encountered. def _match(names): ''...