INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
Activate wordpress plugins
name
name of plugin to activate
path
path to wordpress installation
user
user who should own the files in the wordpress installation
.. code-block:: yaml
HyperDB:
wordpress.activated:
- path: /var/www/html
... | def activated(name, path, user):
'''
Activate wordpress plugins
name
name of plugin to activate
path
path to wordpress installation
user
user who should own the files in the wordpress installation
.. code-block:: yaml
HyperDB:
wordpress.activated:
... |
Prepare the underlying SSH connection with the remote target. | def _prepare_connection(**kwargs):
'''
Prepare the underlying SSH connection with the remote target.
'''
paramiko_kwargs, scp_kwargs = _select_kwargs(**kwargs)
ssh = paramiko.SSHClient()
if paramiko_kwargs.pop('auto_add_policy', False):
ssh.set_missing_host_key_policy(paramiko.AutoAddPol... |
Transfer files and directories from remote host to the localhost of the
Minion.
remote_path
Path to retrieve from remote host. Since this is evaluated by scp on the
remote host, shell wildcards and environment variables may be used.
recursive: ``False``
Transfer files and directori... | def get(remote_path,
local_path='',
recursive=False,
preserve_times=False,
**kwargs):
'''
Transfer files and directories from remote host to the localhost of the
Minion.
remote_path
Path to retrieve from remote host. Since this is evaluated by scp on the
... |
Transfer files and directories to remote host.
files
A single path or a list of paths to be transferred.
remote_path
The path on the remote device where to store the files.
recursive: ``True``
Transfer files and directories recursively.
preserve_times: ``False``
Prese... | def put(files,
remote_path=None,
recursive=False,
preserve_times=False,
saltenv='base',
**kwargs):
'''
Transfer files and directories to remote host.
files
A single path or a list of paths to be transferred.
remote_path
The path on the remote dev... |
Create a session to be used when connecting to iControl REST. | def _build_session(username, password, trans_label=None):
'''
Create a session to be used when connecting to iControl REST.
'''
bigip = requests.session()
bigip.auth = (username, password)
bigip.verify = False
bigip.headers.update({'Content-Type': 'application/json'})
if trans_label:
... |
Load the response from json data, return the dictionary or raw text | def _load_response(response):
'''
Load the response from json data, return the dictionary or raw text
'''
try:
data = salt.utils.json.loads(response.text)
except ValueError:
data = response.text
ret = {'code': response.status_code, 'content': data}
return ret |
Format and Return a connection error | def _load_connection_error(hostname, error):
'''
Format and Return a connection error
'''
ret = {'code': None, 'content': 'Error: Unable to connect to the bigip device: {host}\n{error}'.format(host=hostname, error=error)}
return ret |
Pass in a dictionary of parameters, loop through them and build a payload containing,
parameters who's values are not None. | def _loop_payload(params):
'''
Pass in a dictionary of parameters, loop through them and build a payload containing,
parameters who's values are not None.
'''
#construct the payload
payload = {}
#set the payload
for param, value in six.iteritems(params):
if value is not None:
... |
pass in an option to check for a list of items, create a list of dictionary of items to set
for this option | def _build_list(option_value, item_kind):
'''
pass in an option to check for a list of items, create a list of dictionary of items to set
for this option
'''
#specify profiles if provided
if option_value is not None:
items = []
#if user specified none, return an empty list
... |
BigIP can't make up its mind if it likes yes / no or true or false.
Figure out what it likes to hear without confusing the user. | def _determine_toggles(payload, toggles):
'''
BigIP can't make up its mind if it likes yes / no or true or false.
Figure out what it likes to hear without confusing the user.
'''
for toggle, definition in six.iteritems(toggles):
#did the user specify anything?
if definition['value']... |
A function to detect if user is trying to pass a dictionary or list. parse it and return a
dictionary list or a string | def _set_value(value):
'''
A function to detect if user is trying to pass a dictionary or list. parse it and return a
dictionary list or a string
'''
#don't continue if already an acceptable data-type
if isinstance(value, bool) or isinstance(value, dict) or isinstance(value, list):
retu... |
A function to connect to a bigip device and start a new transaction.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
label
The name / alias for this transaction. The actual transaction
id will... | def start_transaction(hostname, username, password, label):
'''
A function to connect to a bigip device and start a new transaction.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
label
The na... |
A function to connect to a bigip device and list an existing transaction.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
label
the label of this transaction stored within the grain:
``bigip_f5... | def list_transaction(hostname, username, password, label):
'''
A function to connect to a bigip device and list an existing transaction.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
label
th... |
A function to connect to a bigip device and create a node.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the node
address
The address of the node
trans_label
... | def create_node(hostname, username, password, name, address, trans_label=None):
'''
A function to connect to a bigip device and create a node.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
... |
A function to connect to a bigip device and modify an existing node.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the node to modify
connection_limit
[integer]
descr... | def modify_node(hostname, username, password, name,
connection_limit=None,
description=None,
dynamic_ratio=None,
logging=None,
monitor=None,
rate_limit=None,
ratio=None,
session=None,
... |
A function to connect to a bigip device and create a pool.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the pool to create.
members
List of comma delimited pool members ... | def create_pool(hostname, username, password, name, members=None,
allow_nat=None,
allow_snat=None,
description=None,
gateway_failsafe_device=None,
ignore_persisted_weight=None,
ip_tos_to_client=None,
ip_tos_t... |
A function to connect to a bigip device and replace members of an existing pool with new members.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the pool to modify
members
... | def replace_pool_members(hostname, username, password, name, members):
'''
A function to connect to a bigip device and replace members of an existing pool with new members.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iContro... |
A function to connect to a bigip device and add a new member to an existing pool.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the pool to modify
member
The name of the ... | def add_pool_member(hostname, username, password, name, member):
'''
A function to connect to a bigip device and add a new member to an existing pool.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
na... |
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... | def create_virtual(hostname, username, password, name, destination,
pool=None,
address_status=None,
auto_lasthop=None,
bwc_policy=None,
cmp_enabled=None,
connection_limit=None,
dhcp_relay... |
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... | def list_profile(hostname, username, password, profile_type, name=None, ):
'''
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
... |
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... | def create_profile(hostname, username, password, profile_type, name, **kwargs):
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
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... | def delete_profile(hostname, username, password, profile_type, name):
'''
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... |
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... | def add(name, beacon_data, **kwargs):
'''
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 f... |
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... | def list_(return_yaml=True,
include_pillar=True,
include_opts=True,
**kwargs):
'''
List the beacons currently configured on the minion.
Args:
return_yaml (bool):
Whether to return YAML formatted output, default ``True``.
include_pillar (bool):
... |
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:
... | def modify(name, beacon_data, **kwargs):
'''
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 ... |
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: Boolean and status message on success or failure of save.
CLI Example:
.. code-block:: bash
salt '*' beacons.save
'''
ret = {'comment': [],
'result': True}
beacons = ... |
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):
'''
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
''... |
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('=')
key_vars[pair_key] = pair_val... |
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... | def send(name,
data=None,
preload=None,
with_env=False,
with_grains=False,
with_pillar=False,
show_changed=True,
**kwargs):
'''
Send an event to the Salt Master
.. versionadded:: 2014.7.0
Accepts the same arguments as the :py:func:`event.s... |
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]:
return False
return True |
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... | def present(name, auth=None, **kwargs):
'''
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 se... |
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
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
'''
rule_id = kwargs['rule_id']
ret = {'n... |
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... | def query(name, match=None, match_type='string', status=None, status_type='string', wait_for=None, **kwargs):
'''
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... |
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... | def wait_for_successful_query(name, wait_for=300, **kwargs):
'''
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.
... |
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:
if section in drac:
... |
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
# user to say ... |
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(module)
else:
... |
.. 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... | def get_property(host=None, admin_username=None, admin_password=None, property=None):
'''
.. 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 ... |
.. 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... | def set_property(host=None, admin_username=None, admin_password=None, property=None, value=None):
'''
.. versionadded:: Fluorine
Set specific property
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password used to ac... |
.. 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:... | def ensure_property_set(host=None, admin_username=None, admin_password=None, property=None, value=None):
'''
.. 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
... |
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 dell dracr.system_info
'''
cmd = __execute_ret('getsysinfo', host=host,
admin... |
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-block:: bash
salt dell dracr.network_info
'''
inv = inventory(host=host, admin_username=admin_u... |
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,
host=None,
admin_username=None,
admin_password=None,
module=None):
'''
Configure the nameservers on the DRAC
CLI Example:
.. code-block:: bash
salt dell dracr.nameservers [NAMESERVERS]
salt dell dracr.... |
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... | def syslog(server, enable=True, host=None,
admin_username=None, admin_password=None, module=None):
'''
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 b... |
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 email alerts
CLI Example:
.. code-block:: bash
salt dell dracr.email_alerts True
salt dell dracr.email_alerts False
'''
if acti... |
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 dell dracr.list_users
'''
users = {}
_username = ''
for idx in range(1, 17):
c... |
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):
'''
Delete a user
CLI Example:
.. code-block:: bash
salt dell dracr.delete_user [USERNAME] [UID - optional]
salt dell dracr.delete_... |
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... | def change_password(username, password, uid=None, host=None,
admin_username=None, admin_password=None,
module=None):
'''
Change user's password
CLI Example:
.. code-block:: bash
salt dell dracr.change_password [USERNAME] [PASSWORD] uid=[OPTIONAL]
... |
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... | def deploy_password(username, password, host=None, admin_username=None,
admin_password=None, module=None):
'''
Change the QuickDeploy password, used for switches as well
CLI Example:
.. code-block:: bash
salt dell dracr.deploy_password [USERNAME] [PASSWORD]
hos... |
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 | def deploy_snmp(snmp, host=None, admin_username=None,
admin_password=None, module=None):
'''
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> ... |
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, admin_password=None):
'''
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]
s... |
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... | def set_network(ip, netmask, gateway, host=None,
admin_username=None, admin_password=None):
'''
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] [NET... |
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 ... | def server_power(status, host=None,
admin_username=None,
admin_password=None,
module=None):
'''
status
One of 'powerup', 'powerdown', 'powercycle', 'hardreset',
'graceshutdown'
host
The chassis host.
admin_username
T... |
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... | def server_reboot(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
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 powe... |
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 ... | def server_poweroff(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
Powers down the managed server.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
... |
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... | def server_poweron(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
Powers up the managed server.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
Th... |
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
... | def server_hardreset(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
Performs a reset (reboot) operation on the managed server.
host
The chassis host.
admin_username
The username used to access the ch... |
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 power status for the passed module
CLI Example:
.. code-block:: bash
salt dell drac.server_powerstatus
'''
ret ... |
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:
.. code-block:: bash
salt dell dracr.server_pxe
'''
if __execute_cmd('config -g cfgServerInfo -o cfgServerFirstBootDev... |
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... | def list_slotnames(host=None,
admin_username=None,
admin_password=None):
'''
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... |
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... | def get_slotname(slot, host=None, admin_username=None, admin_password=None):
'''
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.
admi... |
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... | def set_slotname(slot, name, host=None,
admin_username=None, admin_password=None):
'''
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
... |
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... | def set_chassis_name(name,
host=None,
admin_username=None,
admin_password=None):
'''
Set the name of the chassis.
name
The name to be set on the chassis.
host
The chassis host.
admin_username
The username used ... |
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... | def get_chassis_name(host=None, admin_username=None, admin_password=None):
'''
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-b... |
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... | def set_chassis_location(location,
host=None,
admin_username=None,
admin_password=None):
'''
Set the location of the chassis.
location
The name of the location to be set on the chassis.
host
The chassis host.
... |
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
... | def get_chassis_location(host=None,
admin_username=None,
admin_password=None):
'''
Get the location of the chassis.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password ... |
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::... | def set_chassis_datacenter(location,
host=None,
admin_username=None,
admin_password=None):
'''
Set the location of the chassis.
location
The name of the datacenter to be set on the chassis.
host
The chassis host... |
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
... | def get_chassis_datacenter(host=None,
admin_username=None,
admin_password=None):
'''
Get the datacenter of the chassis.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The passw... |
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... | def idrac_general(blade_name, command, idrac_password=None,
host=None,
admin_username=None, admin_password=None):
'''
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... |
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 | def update_firmware(filename,
host=None,
admin_username=None,
admin_password=None):
'''
Updates firmware using local firmware file
.. code-block:: bash
salt dell dracr.update_firmware firmware.exe
This executes the following command... |
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... | def update_firmware_nfs_or_cifs(filename, share,
host=None,
admin_username=None,
admin_password=None):
'''
Executes the following for CIFS
(using username and password stored in the pillar data)
.. code-bloc... |
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
... | def post_card(name,
message,
hook_url=None,
title=None,
theme_color=None):
'''
Send a message to a Microsft Teams channel
.. code-block:: yaml
send-msteams-message:
msteams.post_card:
- message: 'This state was executed ... |
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
... | def accept_dict(match, include_rejected=False, include_denied=False):
'''
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``. Def... |
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 ... | def reject(match, include_accepted=False, include_denied=False):
'''
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 t... |
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... | def finger(match, hash_type=None):
'''
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', ['minio... |
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):
'''
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... |
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,
... | def gen(id_=None, keysize=2048):
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 f... |
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... | def gen_accept(id_, keysize=2048, force=False):
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... |
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 '*' moosefs.dirinfo /path/to/dir/ [-[n][h|H]]
'''
cmd = 'mfsdirinfo'
ret = {}
if opts:
cmd += ' -' + opts
cmd += ' ' + path
out = __s... |
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/
'''
cmd = 'mfsfileinfo ' + path
ret = {}
chunknum = ''
out = __salt__['cmd.run_all'](cmd, python_shell=False)
output = o... |
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__['cmd.run_all'](cmd)
output = out['stdout'].splitlines()
for line in output:
if not line:
c... |
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-block:: bash
salt '*' moosefs.getgoal /path/to/file [-[n][h|H]]
salt '*' moosefs.getgoal /path/to/dir/ [-[n][h|H][r]]
'''
cmd = 'mfsgetgoal'
ret = {}
if opts:
cmd += '... |
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 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
'''
ret... |
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... | def get_settings(category='All'):
'''
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:
... |
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... | def get_setting(name):
'''
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:... |
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 ... | def set_setting(name, value):
'''
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
... |
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... | def get_auditpol_dump():
'''
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
... |
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
ret['comment'] = 'Requested ruby exist... |
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, runas=user):
ret['result'] = True
... |
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... | def installed(name, default=False, user=None):
'''
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.
... |
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__['rbenv.uninstall_ruby'](ruby, runas=u... |
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 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
'''
ret =... |
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
ret['comment'] = 'Rbenv installed'
el... |
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... | def install_rbenv(name, user=None):
'''
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 conf... |
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... | def build_rule(table=None, chain=None, command=None, position='', full=None, family='ipv4',
**kwargs):
'''
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 req... |
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_saved_rules
'''
if _conf() and not conf_file:
conf_file = _conf()
with salt.utils.files.fopen(conf_file) as fp_:
... |
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-block:: bash
salt '*' nftables.get_rules
salt '*' nftables.get_rules family=ipv6
'''
nft_family = _NFTABLES_FAMILIES[family]
rules = []
cmd = '{0} --numeric... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.