INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
Gather information about the system memory
def _memdata(osdata): ''' Gather information about the system memory ''' # Provides: # mem_total # swap_total, for supported systems. grains = {'mem_total': 0} if osdata['kernel'] == 'Linux': grains.update(_linux_memdata()) elif osdata['kernel'] in ('FreeBSD', 'OpenBSD', ...
Parse the output of lsattr -El sys0 for os_uuid
def _aix_get_machine_id(): ''' Parse the output of lsattr -El sys0 for os_uuid ''' grains = {} cmd = salt.utils.path.which('lsattr') if cmd: data = __salt__['cmd.run']('{0} -El sys0'.format(cmd)) + os.linesep uuid_regexes = [re.compile(r'(?im)^\s*os_uuid\s+(\S+)\s+(.*)')] ...
Returns what type of virtual hardware is under the hood, kvm or physical
def _windows_virtual(osdata): ''' Returns what type of virtual hardware is under the hood, kvm or physical ''' # Provides: # virtual # virtual_subtype grains = dict() if osdata['kernel'] != 'Windows': return grains grains['virtual'] = 'physical' # It is possible tha...
Returns what type of virtual hardware is under the hood, kvm or physical
def _virtual(osdata): ''' Returns what type of virtual hardware is under the hood, kvm or physical ''' # This is going to be a monster, if you are running a vm you can test this # grain with please submit patches! # Provides: # virtual # virtual_subtype grains = {'virtual': 'phys...
Returns detailed hypervisor information from sysfs Currently this seems to be used only by Xen
def _virtual_hv(osdata): ''' Returns detailed hypervisor information from sysfs Currently this seems to be used only by Xen ''' grains = {} # Bail early if we're not running on Xen try: if 'xen' not in osdata['virtual']: return grains except KeyError: return ...
Return the ps grain
def _ps(osdata): ''' Return the ps grain ''' grains = {} bsd_choices = ('FreeBSD', 'NetBSD', 'OpenBSD', 'MacOS') if osdata['os'] in bsd_choices: grains['ps'] = 'ps auxwww' elif osdata['os_family'] == 'Solaris': grains['ps'] = '/usr/ucb/ps auxwww' elif osdata['os'] == 'Win...
Clean out well-known bogus values. If it isn't clean (for example has value 'None'), return None. Otherwise, return the original value. NOTE: This logic also exists in the smbios module. This function is for use when not using smbios to retrieve the value.
def _clean_value(key, val): ''' Clean out well-known bogus values. If it isn't clean (for example has value 'None'), return None. Otherwise, return the original value. NOTE: This logic also exists in the smbios module. This function is for use when not using smbios to retrieve the value. ...
Use the platform module for as much as we can.
def _windows_platform_data(): ''' Use the platform module for as much as we can. ''' # Provides: # kernelrelease # kernelversion # osversion # osrelease # osservicepack # osmanufacturer # manufacturer # productname # biosversion # ser...
Does a binary exist in linux (depends on which, type, or whereis)
def _linux_bin_exists(binary): ''' Does a binary exist in linux (depends on which, type, or whereis) ''' for search_cmd in ('which', 'type -ap'): try: return __salt__['cmd.retcode']( '{0} {1}'.format(search_cmd, binary) ) == 0 except salt.exception...
Additional data for macOS systems Returns: A dictionary containing values for the following: - model_name - boot_rom_version - smc_version - system_serialnumber
def _osx_platform_data(): ''' Additional data for macOS systems Returns: A dictionary containing values for the following: - model_name - boot_rom_version - smc_version - system_serialnumber ''' cmd = 'system_profiler SPHardwareDataType' hardware = __salt__['cmd.r...
Parse os-release and return a parameter dictionary See http://www.freedesktop.org/software/systemd/man/os-release.html for specification of the file format.
def _parse_os_release(*os_release_files): ''' Parse os-release and return a parameter dictionary See http://www.freedesktop.org/software/systemd/man/os-release.html for specification of the file format. ''' ret = {} for filename in os_release_files: try: with salt.utils....
Parse CPE_NAME data from the os-release Info: https://csrc.nist.gov/projects/security-content-automation-protocol/scap-specifications/cpe :param cpe: :return:
def _parse_cpe_name(cpe): ''' Parse CPE_NAME data from the os-release Info: https://csrc.nist.gov/projects/security-content-automation-protocol/scap-specifications/cpe :param cpe: :return: ''' part = { 'o': 'operating system', 'h': 'hardware', 'a': 'application', ...
Return grains pertaining to the operating system
def os_data(): ''' Return grains pertaining to the operating system ''' grains = { 'num_gpus': 0, 'gpus': [], } # Windows Server 2008 64-bit # ('Windows', 'MINIONNAME', '2008ServerR2', '6.1.7601', 'AMD64', # 'Intel64 Fam ily 6 Model 23 Stepping 6, GenuineIntel') ...
Provides defaultlanguage defaultencoding
def locale_info(): ''' Provides defaultlanguage defaultencoding ''' grains = {} grains['locale_info'] = {} if salt.utils.platform.is_proxy(): return grains try: ( grains['locale_info']['defaultlanguage'], grains['locale_info']['defaul...
Return fqdn, hostname, domainname
def hostname(): ''' Return fqdn, hostname, domainname ''' # This is going to need some work # Provides: # fqdn # host # localhost # domain global __FQDN__ grains = {} if salt.utils.platform.is_proxy(): return grains grains['localhost'] = socket.getho...
Return append_domain if set
def append_domain(): ''' Return append_domain if set ''' grain = {} if salt.utils.platform.is_proxy(): return grain if 'append_domain' in __opts__: grain['append_domain'] = __opts__['append_domain'] return grain
Return all known FQDNs for the system by enumerating all interfaces and then trying to reverse resolve them (excluding 'lo' interface).
def fqdns(): ''' Return all known FQDNs for the system by enumerating all interfaces and then trying to reverse resolve them (excluding 'lo' interface). ''' # Provides: # fqdns grains = {} fqdns = set() addresses = salt.utils.network.ip_addrs(include_loopback=False, interface_data=...
Return ip address and FQDN grains
def ip_fqdn(): ''' Return ip address and FQDN grains ''' if salt.utils.platform.is_proxy(): return {} ret = {} ret['ipv4'] = salt.utils.network.ip_addrs(include_loopback=True) ret['ipv6'] = salt.utils.network.ip_addrs6(include_loopback=True) _fqdn = hostname()['fqdn'] for s...
Provide a dict of the connected interfaces and their ip addresses The addresses will be passed as a list for each interface
def ip_interfaces(): ''' Provide a dict of the connected interfaces and their ip addresses The addresses will be passed as a list for each interface ''' # Provides: # ip_interfaces if salt.utils.platform.is_proxy(): return {} ret = {} ifaces = _get_interfaces() for fa...
Provide a dict of the connected interfaces and their hw addresses (Mac Address)
def hwaddr_interfaces(): ''' Provide a dict of the connected interfaces and their hw addresses (Mac Address) ''' # Provides: # hwaddr_interfaces ret = {} ifaces = _get_interfaces() for face in ifaces: if 'hwaddr' in ifaces[face]: ret[face] = ifaces[face]['hwaddr...
Parse the resolver configuration file .. versionadded:: 2016.3.0
def dns(): ''' Parse the resolver configuration file .. versionadded:: 2016.3.0 ''' # Provides: # dns if salt.utils.platform.is_windows() or 'proxyminion' in __opts__: return {} resolv = salt.utils.dns.parse_resolv() for key in ('nameservers', 'ip4_nameservers', 'ip6_nam...
Provide the machine-id for machine/virtualization combination
def get_machine_id(): ''' Provide the machine-id for machine/virtualization combination ''' # Provides: # machine-id if platform.system() == 'AIX': return _aix_get_machine_id() locations = ['/etc/machine-id', '/var/lib/dbus/machine-id'] existing_locations = [loc for loc in loc...
Return the path of the salt module
def saltpath(): ''' Return the path of the salt module ''' # Provides: # saltpath salt_path = os.path.abspath(os.path.join(__file__, os.path.pardir)) return {'saltpath': os.path.dirname(salt_path)}
Get system specific hardware data from dmidecode Provides biosversion productname manufacturer serialnumber biosreleasedate uuid .. versionadded:: 0.9.5
def _hw_data(osdata): ''' Get system specific hardware data from dmidecode Provides biosversion productname manufacturer serialnumber biosreleasedate uuid .. versionadded:: 0.9.5 ''' if salt.utils.platform.is_proxy(): return {} grai...
Shell-out Python 3 for compute reliable hash :return:
def _get_hash_by_shell(): ''' Shell-out Python 3 for compute reliable hash :return: ''' id_ = __opts__.get('id', '') id_hash = None py_ver = sys.version_info[:2] if py_ver >= (3, 3): # Python 3.3 enabled hash randomization, so we need to shell out to get # a reliable hash...
Provides an integer based on the FQDN of a machine. Useful as server-id in MySQL replication or anywhere else you'll need an ID like this.
def get_server_id(): ''' Provides an integer based on the FQDN of a machine. Useful as server-id in MySQL replication or anywhere else you'll need an ID like this. ''' # Provides: # server_id if salt.utils.platform.is_proxy(): server_id = {} else: use_crc = __opts_...
Populates grains which describe whether a server has a default gateway configured or not. Uses `ip -4 route show` and `ip -6 route show` and greps for a `default` at the beginning of any line. Assuming the standard `default via <ip>` format for default gateways, it will also parse out the ip address of ...
def default_gateway(): ''' Populates grains which describe whether a server has a default gateway configured or not. Uses `ip -4 route show` and `ip -6 route show` and greps for a `default` at the beginning of any line. Assuming the standard `default via <ip>` format for default gateways, it will al...
Return the kernel boot parameters
def kernelparams(): ''' Return the kernel boot parameters ''' if salt.utils.platform.is_windows(): # TODO: add grains using `bcdedit /enum {current}` return {} else: try: with salt.utils.files.fopen('/proc/cmdline', 'r') as fhr: cmdline = fhr.read(...
Helper function to find valid table attributes
def _table_attrs(table): ''' Helper function to find valid table attributes ''' cmd = ['osqueryi'] + ['--json'] + ['pragma table_info({0})'.format(table)] res = __salt__['cmd.run_all'](cmd) if res['retcode'] == 0: attrs = [] text = salt.utils.json.loads(res['stdout']) for...
Helper function to run raw osquery queries
def _osquery(sql, format='json'): ''' Helper function to run raw osquery queries ''' ret = { 'result': True, } cmd = ['osqueryi'] + ['--json'] + [sql] res = __salt__['cmd.run_all'](cmd) if res['stderr']: ret['result'] = False ret['error'] = res['stderr'] else...
Helper function to run osquery queries
def _osquery_cmd(table, attrs=None, where=None, format='json'): ''' Helper function to run osquery queries ''' ret = { 'result': True, } if attrs: if isinstance(attrs, list): valid_attrs = _table_attrs(table) if valid_attrs: for a in attrs...
Return version of osquery CLI Example: .. code-block:: bash salt '*' osquery.version
def version(): ''' Return version of osquery CLI Example: .. code-block:: bash salt '*' osquery.version ''' _false_return = {'result': False, 'comment': 'OSQuery version unavailable.'} res = _osquery_cmd(table='osquery_info', attrs=['version']) if 'result'...
Return cpuid information from osquery CLI Example: .. code-block:: bash salt '*' osquery.rpm_packages
def rpm_packages(attrs=None, where=None): ''' Return cpuid information from osquery CLI Example: .. code-block:: bash salt '*' osquery.rpm_packages ''' if __grains__['os_family'] == 'RedHat': return _osquery_cmd(table='rpm_packages', attrs=attrs, where=where) return {'resu...
Return kernel_integrity information from osquery CLI Example: .. code-block:: bash salt '*' osquery.kernel_integrity
def kernel_integrity(attrs=None, where=None): ''' Return kernel_integrity information from osquery CLI Example: .. code-block:: bash salt '*' osquery.kernel_integrity ''' if __grains__['os_family'] in ['RedHat', 'Debian']: return _osquery_cmd(table='kernel_integrity', attrs=at...
Return kernel_modules information from osquery CLI Example: .. code-block:: bash salt '*' osquery.kernel_modules
def kernel_modules(attrs=None, where=None): ''' Return kernel_modules information from osquery CLI Example: .. code-block:: bash salt '*' osquery.kernel_modules ''' if __grains__['os_family'] in ['RedHat', 'Debian']: return _osquery_cmd(table='kernel_modules', attrs=attrs, whe...
Return memory_map information from osquery CLI Example: .. code-block:: bash salt '*' osquery.memory_map
def memory_map(attrs=None, where=None): ''' Return memory_map information from osquery CLI Example: .. code-block:: bash salt '*' osquery.memory_map ''' if __grains__['os_family'] in ['RedHat', 'Debian']: return _osquery_cmd(table='memory_map', attrs=attrs, where=where) re...
Return process_memory_map information from osquery CLI Example: .. code-block:: bash salt '*' osquery.process_memory_map
def process_memory_map(attrs=None, where=None): ''' Return process_memory_map information from osquery CLI Example: .. code-block:: bash salt '*' osquery.process_memory_map ''' if __grains__['os_family'] in ['RedHat', 'Debian']: return _osquery_cmd(table='process_memory_map', ...
Return shared_memory information from osquery CLI Example: .. code-block:: bash salt '*' osquery.shared_memory
def shared_memory(attrs=None, where=None): ''' Return shared_memory information from osquery CLI Example: .. code-block:: bash salt '*' osquery.shared_memory ''' if __grains__['os_family'] in ['RedHat', 'Debian']: return _osquery_cmd(table='shared_memory', attrs=attrs, where=w...
Return apt_sources information from osquery CLI Example: .. code-block:: bash salt '*' osquery.apt_sources
def apt_sources(attrs=None, where=None): ''' Return apt_sources information from osquery CLI Example: .. code-block:: bash salt '*' osquery.apt_sources ''' if __grains__['os_family'] == 'Debian': return _osquery_cmd(table='apt_sources', attrs=attrs, where=where) return {'r...
Return deb_packages information from osquery CLI Example: .. code-block:: bash salt '*' osquery.deb_packages
def deb_packages(attrs=None, where=None): ''' Return deb_packages information from osquery CLI Example: .. code-block:: bash salt '*' osquery.deb_packages ''' if __grains__['os_family'] == 'Debian': return _osquery_cmd(table='deb_packages', attrs=attrs, where=where) return...
Return alf information from osquery CLI Example: .. code-block:: bash salt '*' osquery.alf
def alf(attrs=None, where=None): ''' Return alf information from osquery CLI Example: .. code-block:: bash salt '*' osquery.alf ''' if salt.utils.platform.is_darwin(): return _osquery_cmd(table='alf', attrs=attrs, where=where) return {'result': False, 'comment': 'Only avai...
Check that the function passed really exists
def verify_fun(lazy_obj, fun): ''' Check that the function passed really exists ''' if not fun: raise salt.exceptions.SaltInvocationError( 'Must specify a function to run!\n' 'ex: manage.up' ) if fun not in lazy_obj: # If the requested function isn't a...
Clear the dict
def clear(self): ''' Clear the dict ''' # create a dict to store loaded values in self._dict = getattr(self, 'mod_dict_class', dict)() # have we already loded everything? self.loaded = False
Check to see if an instance profile exists. CLI Example: .. code-block:: bash salt myminion boto_iam.instance_profile_exists myiprofile
def instance_profile_exists(name, region=None, key=None, keyid=None, profile=None): ''' Check to see if an instance profile exists. CLI Example: .. code-block:: bash salt myminion boto_iam.instance_profile_exists myiprofile ''' conn = _get_conn(region=regio...
Check to see if an IAM role exists. CLI Example: .. code-block:: bash salt myminion boto_iam.role_exists myirole
def role_exists(name, region=None, key=None, keyid=None, profile=None): ''' Check to see if an IAM role exists. CLI Example: .. code-block:: bash salt myminion boto_iam.role_exists myirole ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: conn...
Get information for a role. CLI Example: .. code-block:: bash salt myminion boto_iam.describe_role myirole
def describe_role(name, region=None, key=None, keyid=None, profile=None): ''' Get information for a role. CLI Example: .. code-block:: bash salt myminion boto_iam.describe_role myirole ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: info = c...
Create a user. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.create_user myuser
def create_user(user_name, path=None, region=None, key=None, keyid=None, profile=None): ''' Create a user. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.create_user myuser ''' if not path: path = '/' if get_user(us...
Get all access keys from a user. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_all_access_keys myuser
def get_all_access_keys(user_name, marker=None, max_items=None, region=None, key=None, keyid=None, profile=None): ''' Get all access keys from a user. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_all_access_keys myuser ...
Delete a user. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.delete_user myuser
def delete_user(user_name, region=None, key=None, keyid=None, profile=None): ''' Delete a user. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.delete_user myuser ''' if not get_user(user_name, region, key, keyid, profile): ...
Get user information. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_user myuser
def get_user(user_name=None, region=None, key=None, keyid=None, profile=None): ''' Get user information. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_user myuser ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) ...
Get group information. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_group mygroup
def get_group(group_name, region=None, key=None, keyid=None, profile=None): ''' Get group information. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_group mygroup ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) ...
Get group information. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_group mygroup
def get_group_members(group_name, region=None, key=None, keyid=None, profile=None): ''' Get group information. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_group mygroup ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=p...
Add user to group. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.add_user_to_group myuser mygroup
def add_user_to_group(user_name, group_name, region=None, key=None, keyid=None, profile=None): ''' Add user to group. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.add_user_to_group myuser mygroup ''' user = get_user(use...
Check if user exists in group. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.user_exists_in_group myuser mygroup
def user_exists_in_group(user_name, group_name, region=None, key=None, keyid=None, profile=None): ''' Check if user exists in group. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.user_exists_in_group myuser mygroup ''' ...
Adds or updates the specified policy document for the specified group. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.put_group_policy mygroup policyname policyrules
def put_group_policy(group_name, policy_name, policy_json, region=None, key=None, keyid=None, profile=None): ''' Adds or updates the specified policy document for the specified group. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam...
Delete a group policy. CLI Example:: .. code-block:: bash salt myminion boto_iam.delete_group_policy mygroup mypolicy
def delete_group_policy(group_name, policy_name, region=None, key=None, keyid=None, profile=None): ''' Delete a group policy. CLI Example:: .. code-block:: bash salt myminion boto_iam.delete_group_policy mygroup mypolicy ''' conn = _get_conn(region=region, key=...
Retrieves the specified policy document for the specified group. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_group_policy mygroup policyname
def get_group_policy(group_name, policy_name, region=None, key=None, keyid=None, profile=None): ''' Retrieves the specified policy document for the specified group. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_group_policy m...
Get and return all IAM group details, starting at the optional path. .. versionadded:: 2016.3.0 CLI Example: salt-call boto_iam.get_all_groups
def get_all_groups(path_prefix='/', region=None, key=None, keyid=None, profile=None): ''' Get and return all IAM group details, starting at the optional path. .. versionadded:: 2016.3.0 CLI Example: salt-call boto_iam.get_all_groups ''' conn = _get_conn(region=region,...
Get and return all IAM instance profiles, starting at the optional path. .. versionadded:: 2016.11.0 CLI Example: salt-call boto_iam.get_all_instance_profiles
def get_all_instance_profiles(path_prefix='/', region=None, key=None, keyid=None, profile=None): ''' Get and return all IAM instance profiles, starting at the optional path. .. versionadded:: 2016.11.0 CLI Example: salt-call boto_iam.get_all_instance_profiles ...
List all IAM instance profiles, starting at the optional path. .. versionadded:: 2016.11.0 CLI Example: salt-call boto_iam.list_instance_profiles
def list_instance_profiles(path_prefix='/', region=None, key=None, keyid=None, profile=None): ''' List all IAM instance profiles, starting at the optional path. .. versionadded:: 2016.11.0 CLI Example: salt-call boto_iam.list_instance_profiles ''' p = get_al...
Get a list of policy names from a group. CLI Example: .. code-block:: bash salt myminion boto_iam.get_all_group_policies mygroup
def get_all_group_policies(group_name, region=None, key=None, keyid=None, profile=None): ''' Get a list of policy names from a group. CLI Example: .. code-block:: bash salt myminion boto_iam.get_all_group_policies mygroup ''' conn = _get_conn(region=region, ...
Delete a group policy. CLI Example:: .. code-block:: bash salt myminion boto_iam.delete_group mygroup
def delete_group(group_name, region=None, key=None, keyid=None, profile=None): ''' Delete a group policy. CLI Example:: .. code-block:: bash salt myminion boto_iam.delete_group mygroup ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) ...
Creates a login profile for the specified user, give the user the ability to access AWS services and the AWS Management Console. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.create_login_profile user_name password
def create_login_profile(user_name, password, region=None, key=None, keyid=None, profile=None): ''' Creates a login profile for the specified user, give the user the ability to access AWS services and the AWS Management Console. .. versionadded:: 2015.8.0 CLI Example: ...
Get all MFA devices associated with an IAM user. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_all_mfa_devices user_name
def get_all_mfa_devices(user_name, region=None, key=None, keyid=None, profile=None): ''' Get all MFA devices associated with an IAM user. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_all_mfa_devices user_name ''' ...
Deletes the specified virtual MFA device. CLI Example: .. code-block:: bash salt myminion boto_iam.delete_virtual_mfa_device serial_num
def delete_virtual_mfa_device(serial, region=None, key=None, keyid=None, profile=None): ''' Deletes the specified virtual MFA device. CLI Example: .. code-block:: bash salt myminion boto_iam.delete_virtual_mfa_device serial_num ''' conn = __utils__['boto3.get_connection_func']('iam')(...
Update the password policy for the AWS account. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.update_account_password_policy True
def update_account_password_policy(allow_users_to_change_password=None, hard_expiry=None, max_password_age=None, minimum_password_length=None, password_reuse_prevention=None, requi...
Get account policy for the AWS account. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_account_policy
def get_account_policy(region=None, key=None, keyid=None, profile=None): ''' Get account policy for the AWS account. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_account_policy ''' conn = _get_conn(region=region, key=key, keyid=keyid, pr...
Create an instance role. CLI Example: .. code-block:: bash salt myminion boto_iam.create_role myrole
def create_role(name, policy_document=None, path=None, region=None, key=None, keyid=None, profile=None): ''' Create an instance role. CLI Example: .. code-block:: bash salt myminion boto_iam.create_role myrole ''' conn = _get_conn(region=region, key=key, keyid=keyid, p...
Delete an IAM role. CLI Example: .. code-block:: bash salt myminion boto_iam.delete_role myirole
def delete_role(name, region=None, key=None, keyid=None, profile=None): ''' Delete an IAM role. CLI Example: .. code-block:: bash salt myminion boto_iam.delete_role myirole ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if not role_exists(name, region,...
Check to see if an instance profile is associated with an IAM role. CLI Example: .. code-block:: bash salt myminion boto_iam.profile_associated myirole myiprofile
def profile_associated(role_name, profile_name, region, key, keyid, profile): ''' Check to see if an instance profile is associated with an IAM role. CLI Example: .. code-block:: bash salt myminion boto_iam.profile_associated myirole myiprofile ''' conn = _get_conn(region=region, key=...
Associate an instance profile with an IAM role. CLI Example: .. code-block:: bash salt myminion boto_iam.associate_profile_to_role myirole myiprofile
def associate_profile_to_role(profile_name, role_name, region=None, key=None, keyid=None, profile=None): ''' Associate an instance profile with an IAM role. CLI Example: .. code-block:: bash salt myminion boto_iam.associate_profile_to_role myirole myiprofile ...
Get a list of policy names from a role. CLI Example: .. code-block:: bash salt myminion boto_iam.list_role_policies myirole
def list_role_policies(role_name, region=None, key=None, keyid=None, profile=None): ''' Get a list of policy names from a role. CLI Example: .. code-block:: bash salt myminion boto_iam.list_role_policies myirole ''' conn = _get_conn(region=region, key=key, keyid...
Get a role policy. CLI Example: .. code-block:: bash salt myminion boto_iam.get_role_policy myirole mypolicy
def get_role_policy(role_name, policy_name, region=None, key=None, keyid=None, profile=None): ''' Get a role policy. CLI Example: .. code-block:: bash salt myminion boto_iam.get_role_policy myirole mypolicy ''' conn = _get_conn(region=region, key=key, keyid=keyid, ...
Create or modify a role policy. CLI Example: .. code-block:: bash salt myminion boto_iam.create_role_policy myirole mypolicy '{"MyPolicy": "Statement": [{"Action": ["sqs:*"], "Effect": "Allow", "Resource": ["arn:aws:sqs:*:*:*"], "Sid": "MyPolicySqs1"}]}'
def create_role_policy(role_name, policy_name, policy, region=None, key=None, keyid=None, profile=None): ''' Create or modify a role policy. CLI Example: .. code-block:: bash salt myminion boto_iam.create_role_policy myirole mypolicy '{"MyPolicy": "Statement": [{"Action...
Delete a role policy. CLI Example: .. code-block:: bash salt myminion boto_iam.delete_role_policy myirole mypolicy
def delete_role_policy(role_name, policy_name, region=None, key=None, keyid=None, profile=None): ''' Delete a role policy. CLI Example: .. code-block:: bash salt myminion boto_iam.delete_role_policy myirole mypolicy ''' conn = _get_conn(region=region, key=key, k...
Update an assume role policy for a role. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.update_assume_role_policy myrole '{"Statement":"..."}'
def update_assume_role_policy(role_name, policy_document, region=None, key=None, keyid=None, profile=None): ''' Update an assume role policy for a role. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.update_assume_role_po...
Build a default assume role policy. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.build_policy
def build_policy(region=None, key=None, keyid=None, profile=None): ''' Build a default assume role policy. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.build_policy ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) ...
Get a the AWS account id associated with the used credentials. CLI Example: .. code-block:: bash salt myminion boto_iam.get_account_id
def get_account_id(region=None, key=None, keyid=None, profile=None): ''' Get a the AWS account id associated with the used credentials. CLI Example: .. code-block:: bash salt myminion boto_iam.get_account_id ''' cache_key = 'boto_iam.account_id' if cache_key not in __context__: ...
Get and return all IAM role details, starting at the optional path. .. versionadded:: 2016.3.0 CLI Example: salt-call boto_iam.get_all_roles
def get_all_roles(path_prefix=None, region=None, key=None, keyid=None, profile=None): ''' Get and return all IAM role details, starting at the optional path. .. versionadded:: 2016.3.0 CLI Example: salt-call boto_iam.get_all_roles ''' conn = _get_conn(region=region, k...
Get and return all IAM user details, starting at the optional path. .. versionadded:: 2016.3.0 CLI Example: salt-call boto_iam.get_all_users
def get_all_users(path_prefix='/', region=None, key=None, keyid=None, profile=None): ''' Get and return all IAM user details, starting at the optional path. .. versionadded:: 2016.3.0 CLI Example: salt-call boto_iam.get_all_users ''' conn = _get_conn(region=region, ke...
Get all user policies. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_all_user_policies myuser
def get_all_user_policies(user_name, marker=None, max_items=None, region=None, key=None, keyid=None, profile=None): ''' Get all user policies. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_all_user_policies myuser ''' conn = _get_conn(reg...
Retrieves the specified policy document for the specified user. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_user_policy myuser mypolicyname
def get_user_policy(user_name, policy_name, region=None, key=None, keyid=None, profile=None): ''' Retrieves the specified policy document for the specified user. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.get_user_policy myuser mypolicyname ''...
Adds or updates the specified policy document for the specified user. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.put_user_policy myuser policyname policyrules
def put_user_policy(user_name, policy_name, policy_json, region=None, key=None, keyid=None, profile=None): ''' Adds or updates the specified policy document for the specified user. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.put_user_policy myuser ...
Delete a user policy. CLI Example: .. code-block:: bash salt myminion boto_iam.delete_user_policy myuser mypolicy
def delete_user_policy(user_name, policy_name, region=None, key=None, keyid=None, profile=None): ''' Delete a user policy. CLI Example: .. code-block:: bash salt myminion boto_iam.delete_user_policy myuser mypolicy ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=prof...
Upload a certificate to Amazon. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.upload_server_cert mycert_name crt priv_key :param cert_name: The name for the server certificate. Do not include the path in this value. :param cert_body: The contents of...
def upload_server_cert(cert_name, cert_body, private_key, cert_chain=None, path=None, region=None, key=None, keyid=None, profile=None): ''' Upload a certificate to Amazon. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.upload_se...
Lists the server certificates stored in IAM that have the specified path prefix. .. versionadded:: ??? :param path_prefix: The path prefix for filtering the results. For example: /company/servercerts would get all server certificates for which the path starts with /company/servercerts . ...
def list_server_certificates(path_prefix='/', region=None, key=None, keyid=None, profile=None): ''' Lists the server certificates stored in IAM that have the specified path prefix. .. versionadded:: ??? :param path_prefix: The path prefix for filtering the results. For example: /company/serv...
Deletes a certificate from Amazon. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.delete_server_cert mycert_name
def delete_server_cert(cert_name, region=None, key=None, keyid=None, profile=None): ''' Deletes a certificate from Amazon. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.delete_server_cert mycert_name ''' conn = _get_conn(region=region, key=ke...
Get all IAM user details. Produces results that can be used to create an sls file. .. versionadded:: 2016.3.0 CLI Example: salt-call boto_iam.export_users --out=txt | sed "s/local: //" > iam_users.sls
def export_users(path_prefix='/', region=None, key=None, keyid=None, profile=None): ''' Get all IAM user details. Produces results that can be used to create an sls file. .. versionadded:: 2016.3.0 CLI Example: salt-call boto_iam.export_users --out=txt | sed "s/local: //"...
Get all IAM role details. Produces results that can be used to create an sls file. CLI Example: salt-call boto_iam.export_roles --out=txt | sed "s/local: //" > iam_roles.sls
def export_roles(path_prefix='/', region=None, key=None, keyid=None, profile=None): ''' Get all IAM role details. Produces results that can be used to create an sls file. CLI Example: salt-call boto_iam.export_roles --out=txt | sed "s/local: //" > iam_roles.sls ''' conn = _get_conn(reg...
Check to see if policy exists. CLI Example: .. code-block:: bash salt myminion boto_iam.instance_profile_exists myiprofile
def policy_exists(policy_name, region=None, key=None, keyid=None, profile=None): ''' Check to see if policy exists. CLI Example: .. code-block:: bash salt myminion boto_iam.instance_profile_exists myiprofile ''' conn = _get_conn(region=region, key=key, keyid=keyid, p...
Check to see if policy exists. CLI Example: .. code-block:: bash salt myminion boto_iam.instance_profile_exists myiprofile
def get_policy(policy_name, region=None, key=None, keyid=None, profile=None): ''' Check to see if policy exists. CLI Example: .. code-block:: bash salt myminion boto_iam.instance_profile_exists myiprofile ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile...
Create a policy. CLI Example: .. code-block:: bash salt myminios boto_iam.create_policy mypolicy '{"Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": ["s3:Get*", "s3:List*"], "Resource": ["arn:aws:s3:::my-bucket/shared/*"]},]}'
def create_policy(policy_name, policy_document, path=None, description=None, region=None, key=None, keyid=None, profile=None): ''' Create a policy. CLI Example: .. code-block:: bash salt myminios boto_iam.create_policy mypolicy '{"Version": "2012-10-17", "Statement": [{ "Effe...
List policies. CLI Example: .. code-block:: bash salt myminion boto_iam.list_policies
def list_policies(region=None, key=None, keyid=None, profile=None): ''' List policies. CLI Example: .. code-block:: bash salt myminion boto_iam.list_policies ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: policies = [] for ret in _...
Check to see if policy exists. CLI Example: .. code-block:: bash salt myminion boto_iam.instance_profile_exists myiprofile
def policy_version_exists(policy_name, version_id, region=None, key=None, keyid=None, profile=None): ''' Check to see if policy exists. CLI Example: .. code-block:: bash salt myminion boto_iam.instance_profile_exists myiprofile ''' conn = _get_conn(region=region, key...
Check to see if policy exists. CLI Example: .. code-block:: bash salt myminion boto_iam.instance_profile_exists myiprofile
def get_policy_version(policy_name, version_id, region=None, key=None, keyid=None, profile=None): ''' Check to see if policy exists. CLI Example: .. code-block:: bash salt myminion boto_iam.instance_profile_exists myiprofile ''' conn = _get_conn(region=region, key=key, ...
Create a policy version. CLI Example: .. code-block:: bash salt myminios boto_iam.create_policy_version mypolicy '{"Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": ["s3:Get*", "s3:List*"], "Resource": ["arn:aws:s3:::my-bucket/shared/*"]},]}'
def create_policy_version(policy_name, policy_document, set_as_default=None, region=None, key=None, keyid=None, profile=None): ''' Create a policy version. CLI Example: .. code-block:: bash salt myminios boto_iam.create_policy_version mypolicy '{"Version": "2012-10-17", "Stat...
Delete a policy version. CLI Example: .. code-block:: bash salt myminion boto_iam.delete_policy_version mypolicy v1
def delete_policy_version(policy_name, version_id, region=None, key=None, keyid=None, profile=None): ''' Delete a policy version. CLI Example: .. code-block:: bash salt myminion boto_iam.delete_policy_version mypolicy v1 ''' conn = _get_conn(region=region, key=key, k...
List versions of a policy. CLI Example: .. code-block:: bash salt myminion boto_iam.list_policy_versions mypolicy
def list_policy_versions(policy_name, region=None, key=None, keyid=None, profile=None): ''' List versions of a policy. CLI Example: .. code-block:: bash salt myminion boto_iam.list_policy_versions mypolicy ''' conn = _get_conn(region=region, key=key, keyid=keyid, pro...
Detach a managed policy to a user. CLI Example: .. code-block:: bash salt myminion boto_iam.detach_user_policy mypolicy myuser
def detach_user_policy(policy_name, user_name, region=None, key=None, keyid=None, profile=None): ''' Detach a managed policy to a user. CLI Example: .. code-block:: bash salt myminion boto_iam.detach_user_policy mypolicy myuser ''' conn = _get_conn(region=region, key...
List entities that a policy is attached to. CLI Example: .. code-block:: bash salt myminion boto_iam.list_entities_for_policy mypolicy
def list_entities_for_policy(policy_name, path_prefix=None, entity_filter=None, region=None, key=None, keyid=None, profile=None): ''' List entities that a policy is attached to. CLI Example: .. code-block:: bash salt myminion boto_iam.list_entities_for_policy mypolicy ''...