def __init__(self): """Define all the parameters required by this module""" self.module_params = utils.get_powerstore_management_host_parameters() self.module_params.update(get_powerstore_volume_group_parameters()) mutually_exclusive = [['vg_name', 'vg_id']] required_one_of = [['vg_name', 'vg_id']] required_together = [['volumes', 'vol_state']] # initialize the Ansible module self.module = AnsibleModule(argument_spec=self.module_params, supports_check_mode=False, mutually_exclusive=mutually_exclusive, required_one_of=required_one_of, required_together=required_together) LOG.info('HAS_PY4PS = {0} , IMPORT_ERROR = {1}'.format( HAS_PY4PS, IMPORT_ERROR)) if not HAS_PY4PS: self.module.fail_json(msg=IMPORT_ERROR) LOG.info('IS_SUPPORTED_PY4PS_VERSION = {0} , ' 'VERSION_ERROR = {1}'.format(IS_SUPPORTED_PY4PS_VERSION, VERSION_ERROR)) if not IS_SUPPORTED_PY4PS_VERSION: self.module.fail_json(msg=VERSION_ERROR) self.conn = utils.get_powerstore_connection( self.module.params, application_type=APPLICATION_TYPE) self.provisioning = self.conn.provisioning LOG.info( 'Got Py4ps instance for provisioning on PowerStore {0}'.format( self.conn)) self.protection = self.conn.protection LOG.info('Got Py4ps instance for protection on PowerStore {0}'.format( self.protection))
def __init__(self): # Define all parameters required by this module self.module_params = utils.get_powerstore_management_host_parameters() self.module_params.update(self.get_powerstore_hostgroup_parameters()) mutually_exclusive = [['hostgroup_name', 'hostgroup_id']] required_one_of = [['hostgroup_name', 'hostgroup_id']] # Initialize the Ansible module self.module = AnsibleModule(argument_spec=self.module_params, supports_check_mode=False, mutually_exclusive=mutually_exclusive, required_one_of=required_one_of) LOG.info('HAS_PY4PS = {0} , IMPORT_ERROR = {1}'.format( HAS_PY4PS, IMPORT_ERROR)) if HAS_PY4PS is False: self.module.fail_json(msg=IMPORT_ERROR) LOG.info( 'IS_SUPPORTED_PY4PS_VERSION = {0} , VERSION_ERROR = {1}'.format( IS_SUPPORTED_PY4PS_VERSION, VERSION_ERROR)) if IS_SUPPORTED_PY4PS_VERSION is False: self.module.fail_json(msg=VERSION_ERROR) # result is a dictionary that contains changed status and host group # details self.result = {"changed": False, "hostgroup_details": {}} self.conn = utils.get_powerstore_connection( self.module.params, application_type=APPLICATION_TYPE) LOG.info( 'Got Python library connection instance for provisioning on PowerStore {0}' .format(self.conn))
def __init__(self): """Define all the parameters required by this module""" self.module_params = utils.get_powerstore_management_host_parameters() self.module_params.update(get_powerstore_snapshotrule_parameters()) # initialize the Ansible module mut_ex_args = [['snap_rule_id', 'name'], ['interval', 'time_of_day']] self.module = AnsibleModule(argument_spec=self.module_params, supports_check_mode=False, mutually_exclusive=mut_ex_args) LOG.info('HAS_PY4PS = {0} , IMPORT_ERROR = {1}'.format( HAS_PY4PS, IMPORT_ERROR)) if HAS_PY4PS is False: self.module.fail_json(msg=IMPORT_ERROR) LOG.info('IS_SUPPORTED_PY4PS_VERSION = {0} , VERSION_ERROR = ' '{1}'.format(IS_SUPPORTED_PY4PS_VERSION, VERSION_ERROR)) if IS_SUPPORTED_PY4PS_VERSION is False: self.module.fail_json(msg=VERSION_ERROR) self.conn = utils.get_powerstore_connection( self.module.params, application_type=APPLICATION_TYPE) self.provisioning = self.conn.provisioning LOG.info( 'Got Py4ps instance for provisioning on PowerStore {0}'.format( self.provisioning)) self.protection = self.conn.protection LOG.info('Got Py4ps instance for protection on PowerStore {0}'.format( self.protection))
def __init__(self): """Define all the parameters required by this module""" self.module_params = utils.get_powerstore_management_host_parameters() self.module_params.update(get_powerstore_nasserver_parameters()) mutually_exclusive = [['nas_server_name', 'nas_server_id']] required_one_of = [['nas_server_name', 'nas_server_id']] # initialize the Ansible module self.module = AnsibleModule(argument_spec=self.module_params, supports_check_mode=False, mutually_exclusive=mutually_exclusive, required_one_of=required_one_of) msg = 'HAS_PY4PS = {0} , IMPORT_ERROR = {1}'.format( HAS_PY4PS, IMPORT_ERROR) LOG.info(msg) if HAS_PY4PS is False: self.module.fail_json(msg=IMPORT_ERROR) msg = 'IS_SUPPORTED_PY4PS_VERSION = {0}, VERSION_ERROR = {1}' \ ''.format(IS_SUPPORTED_PY4PS_VERSION, VERSION_ERROR) LOG.info(msg) if IS_SUPPORTED_PY4PS_VERSION is False: self.module.fail_json(msg=VERSION_ERROR) self.conn = utils.get_powerstore_connection( self.module.params, application_type=APPLICATION_TYPE) self.provisioning = self.conn.provisioning msg = 'Got Py4ps instance for provisioning on' \ ' PowerStore {0}'.format(self.conn) LOG.info(msg)
def __init__(self): """ Define all parameters required by this module""" self.module_params = utils.get_powerstore_management_host_parameters() self.module_params.update(get_powerstore_quota_parameters()) # initialize the ansible module mut_ex_args = [['quota_id', 'quota_type'], ['quota_id', 'nas_server'], ['quota_id', 'filesystem'], ['quota_id', 'path'], [ 'uid', 'windows_name', 'windows_sid', 'unix_name', 'quota_id' ]] required_one_of = [['quota_id', 'quota_type']] self.module = AnsibleModule(argument_spec=self.module_params, supports_check_mode=False, mutually_exclusive=mut_ex_args, required_one_of=required_one_of) msg = 'HAS_PY4PS = {0} , IMPORT_ERROR = {1}'.format( HAS_PY4PS, IMPORT_ERROR) LOG.info(msg) if not HAS_PY4PS: self.module.fail_json(msg=IMPORT_ERROR) msg = 'IS_SUPPORTED_PY4PS_VERSION = {0} , VERSION_ERROR = {1}' \ .format(IS_SUPPORTED_PY4PS_VERSION, VERSION_ERROR) LOG.info(msg) if not IS_SUPPORTED_PY4PS_VERSION: self.module.fail_json(msg=VERSION_ERROR) # result is a dictionary that contains changed status and # Quota details self.result = {"changed": False, "quota_details": {}} self.conn = utils.get_powerstore_connection( self.module.params, application_type=APPLICATION_TYPE) self.provisioning = self.conn.provisioning msg = 'Got Py4Ps instance for provisioning on' \ ' PowerStore {0}'.format(self.conn) LOG.info(msg)
def __init__(self): """Define all the parameters required by this module""" self.module_params = utils.get_powerstore_management_host_parameters() self.module_params.update(get_powerstore_nfs_export_parameters()) mutually_exclusive = [['nfs_export_name', 'nfs_export_id'], ['filesystem', 'snapshot'], ['nfs_export_id', 'nas_server'], ['nfs_export_id', 'filesystem'], ['nfs_export_id', 'snapshot'], ['nfs_export_id', 'path']] required_one_of = [['nfs_export_name', 'nfs_export_id']] # Initialize the Ansible module self.module = AnsibleModule(argument_spec=self.module_params, supports_check_mode=False, mutually_exclusive=mutually_exclusive, required_one_of=required_one_of) if not HAS_IPADDRESS: error_msg = "Please install the ipaddress python library " \ "before using NFS Export Ansible module." LOG.error(error_msg) self.module.fail_json(msg=error_msg) LOG.info('HAS_PY4PS = %s , IMPORT_ERROR = %s', HAS_PY4PS, IMPORT_ERROR) if not HAS_PY4PS: self.module.fail_json(msg=IMPORT_ERROR) LOG.info('IS_SUPPORTED_PY4PS_VERSION = %s , VERSION_ERROR = %s', IS_SUPPORTED_PY4PS_VERSION, VERSION_ERROR) if not IS_SUPPORTED_PY4PS_VERSION: self.module.fail_json(msg=VERSION_ERROR) self.py4ps_conn = utils.get_powerstore_connection( self.module.params, application_type=APPLICATION_TYPE) self.provisioning = self.py4ps_conn.provisioning LOG.info('Got Py4ps instance for PowerStore')
def __init__(self): """ Define all parameters required by this module""" self.module_params = utils.get_powerstore_management_host_parameters() self.module_params.update(self.get_powerstore_volume_parameters()) mutually_exclusive = [['vol_name', 'vol_id']] required_one_of = [['vol_name', 'vol_id']] # initialize the ansible module self.module = AnsibleModule(argument_spec=self.module_params, supports_check_mode=False, mutually_exclusive=mutually_exclusive, required_one_of=required_one_of) LOG.info('HAS_PY4PS = {0} , IMPORT_ERROR = {1}'.format( HAS_PY4PS, IMPORT_ERROR)) if not HAS_PY4PS: self.module.fail_json(msg=IMPORT_ERROR) LOG.info( 'IS_SUPPORTED_PY4PS_VERSION = {0} , VERSION_ERROR = {1}'.format( IS_SUPPORTED_PY4PS_VERSION, VERSION_ERROR)) if not IS_SUPPORTED_PY4PS_VERSION: self.module.fail_json(msg=VERSION_ERROR) # result is a dictionary that contains changed status and # volume details self.result = {"changed": False, "volume_details": {}} self.conn = utils.get_powerstore_connection( self.module.params, application_type=APPLICATION_TYPE) self.provisioning = self.conn.provisioning self.performance_policy_dict = { 'low': 'default_low', 'medium': 'default_medium', 'high': 'default_high' } LOG.info( 'Got Py4Ps instance for provisioning on PowerStore {0}'.format( self.conn))
def __init__(self): self.result = {} """Define all the parameters required by this module""" self.module_params = utils.get_powerstore_management_host_parameters() self.module_params.update(get_powerstore_gatherfacts_parameters()) self.filter_keys = sorted( [k for k in self.module_params['filters']['options'].keys() if 'filter' in k]) # initialize the Ansible module self.module = AnsibleModule( argument_spec=self.module_params, supports_check_mode=False ) LOG.info('HAS_PY4PS = {0}, IMPORT_ERROR = {1}'.format(HAS_PY4PS, IMPORT_ERROR)) if HAS_PY4PS is False: self.module.fail_json(msg=IMPORT_ERROR) LOG.info('IS_SUPPORTED_PY4PS_VERSION = {0} , ' 'VERSION_ERROR = {1}'.format( IS_SUPPORTED_PY4PS_VERSION, VERSION_ERROR)) if IS_SUPPORTED_PY4PS_VERSION is False: self.module.fail_json(msg=VERSION_ERROR) self.conn = utils.get_powerstore_connection( self.module.params, application_type=APPLICATION_TYPE) self.provisioning = self.conn.provisioning self.protection = self.conn.protection self.subset_mapping = { 'vol': { 'func': self.provisioning.get_volumes, 'display_as': 'Volumes' }, 'vg': { 'func': self.provisioning.get_volume_group_list, 'display_as': 'VolumeGroups' }, 'host': { 'func': self.provisioning.get_hosts, 'display_as': 'Hosts' }, 'hg': { 'func': self.provisioning.get_host_group_list, 'display_as': 'HostGroups' }, 'node': { 'func': self.provisioning.get_nodes, 'display_as': 'Nodes' }, 'protection_policy': { 'func': self.protection.get_protection_policies, 'display_as': 'ProtectionPolicies' }, 'snapshot_rule': { 'func': self.protection.get_snapshot_rules, 'display_as': 'SnapshotRules' }, 'nas_server': { 'func': self.provisioning.get_nas_servers, 'display_as': 'NASServers' }, 'nfs_export': { 'func': self.provisioning.get_nfs_exports, 'display_as': 'NFSExports' }, 'smb_share': { 'func': self.provisioning.get_smb_shares, 'display_as': 'SMBShares' }, 'tree_quota': { 'func': self.provisioning.get_file_tree_quotas, 'display_as': 'TreeQuotas' }, 'user_quota': { 'func': self.provisioning.get_file_user_quotas, 'display_as': 'UserQuotas' }, 'file_system': { 'func': self.provisioning.get_file_systems, 'display_as': 'FileSystems' } } LOG.info('Got Py4ps instance for provisioning on PowerStore {0}'. format(self.conn))