def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict( volname=dict(type='str', required=True), host=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present']), )) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.volname = self.module.params['volname'] self.host = self.module.params['host'] self.state = self.module.params['state'] # Optional self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path)
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict( objectname=dict(type='str'), gather_subset=dict(type='list', elements='str', required=False, default=['all'], choices=[ 'vol', 'pool', 'node', 'iog', 'host', 'hc', 'fc', 'fcport', 'targetportfc', 'iscsiport', 'fcmap', 'rcrelationship', 'fcconsistgrp', 'rcconsistgrp', 'vdiskcopy', 'array', 'system', 'all' ]), )) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] self.log = get_logger(self.__class__.__name__, log_path) self.objectname = self.module.params['objectname'] self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path)
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict(name=dict(type='str', required=True), copytype=dict(type='str', required=False, choices=['snapshot', 'clone']), source=dict(type='str', required=False), target=dict(type='str', required=False), mdiskgrp=dict(type='str', required=False), state=dict(type='str', required=True, choices=['present', 'absent']), consistgrp=dict(type='str', required=False), noconsistgrp=dict(type='bool', required=False), copyrate=dict(type='str', required=False), grainsize=dict(type='str', required=False), force=dict(type='bool', required=False))) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.copytype = self.module.params.get('copytype', False) self.source = self.module.params.get('source', False) self.target = self.module.params.get('target', False) self.mdiskgrp = self.module.params.get('mdiskgrp', False) self.consistgrp = self.module.params.get('consistgrp', False) self.noconsistgrp = self.module.params.get('noconsistgrp', False) self.grainsize = self.module.params.get('grainsize', False) self.copyrate = self.module.params.get('copyrate', False) self.force = self.module.params.get('force', False) # Handline for mandatory parameter name if not self.name: self.module.fail_json(msg="Missing mandatory parameter: name") # Handline for mandatory parameter state if not self.state: self.module.fail_json(msg="Missing mandatory parameter: state") self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path, token=self.module.params['token'])
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict( name=dict(type='str'), state=dict(type='str', required=True, choices=['present', 'absent']), remotecluster=dict(type='str'), copytype=dict(type='str', choices=['metro', 'global', 'GMCV']), master=dict(type='str'), aux=dict(type='str'), force=dict(type='bool', required=False), consistgrp=dict(type='str'), noconsistgrp=dict(type='bool', default=False), sync=dict(type='bool', default=False), cyclingperiod=dict(type='int') ) ) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] self.remotecluster = self.module.params['remotecluster'] # Optional self.consistgrp = self.module.params.get('consistgrp', None) self.aux = self.module.params.get('aux') self.master = self.module.params.get('master') self.sync = self.module.params.get('sync', False) self.noconsistgrp = self.module.params.get('noconsistgrp', False) self.copytype = self.module.params.get('copytype', None) self.force = self.module.params.get('force', False) self.cyclingperiod = self.module.params.get('cyclingperiod') # Handling missing mandatory parameter name if not self.name: self.module.fail_json(msg='Missing mandatory parameter: name') self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path, token=self.module.params['token'] )
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict(name=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present']), datareduction=dict(type='str', default='no', choices=['yes', 'no']), easytier=dict(type='str', default='off', choices=['on', 'off', 'auto']), encrypt=dict(type='str', default='no', choices=['yes', 'no']), ext=dict(type='int'), parentmdiskgrp=dict(type='str'), size=dict(type='int'), unit=dict(type='str'))) mutually_exclusive = [] self.module = AnsibleModule(argument_spec=argument_spec, mutually_exclusive=mutually_exclusive, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.datareduction = self.module.params.get('datareduction', None) self.easytier = self.module.params.get('easytier', None) self.encrypt = self.module.params.get('encrypt', None) self.ext = self.module.params.get('ext', None) self.parentmdiskgrp = self.module.params.get('parentmdiskgrp', None) self.size = self.module.params.get('size', None) self.unit = self.module.params.get('unit', None) # Handling missing mandatory parameters name if not self.name: self.module.fail_json(msg='Missing mandatory parameter: name') self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path, token=self.module.params['token'])
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict(name=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present']), mdiskgrp=dict(type='str', required=False), size=dict(type='str', required=False), unit=dict(type='str', default='mb', choices=['b', 'kb', 'mb', 'gb', 'tb', 'pb']), easytier=dict(type='str', choices=['on', 'off']), rsize=dict(type='str', required=False), autoexpand=dict(type='bool', required=False))) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) self.resizevdisk_flag = False self.expand_flag = False self.shrink_flag = False # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.mdiskgrp = self.module.params['mdiskgrp'] self.size = self.module.params['size'] self.unit = self.module.params['unit'] self.easytier = self.module.params.get('easytier', None) self.rsize = self.module.params['rsize'] self.autoexpand = self.module.params['autoexpand'] # Handling missing mandatory parameter name if not self.name: self.module.fail_json('Missing mandatory parameter: name') self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path, token=self.module.params['token'])
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict( name=dict(type='str'), state=dict(type='str', required=True, choices=['started', 'stopped']), force=dict(type='bool', required=False), primary=dict(type='str', choices=['master', 'aux']), clean=dict(type='bool', default=False), access=dict(type='bool', default=False), isgroup=dict(type='bool', default=False), )) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.primary = self.module.params.get('primary', None) self.clean = self.module.params.get('clean', False) self.access = self.module.params.get('access', False) self.force = self.module.params.get('force', False) self.isgroup = self.module.params.get('isgroup', False) # Handling missing mandatory parameter name if not self.name: self.module.fail_json(msg='Missing mandatory parameter: name') self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path, token=self.module.params['token'])
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict(name=dict(type='str', required=True), state=dict(type='str', required=True, choices=[ 'absent', 'present', 'prestart', 'start', 'stop' ]), restore=dict(type='bool', required=False, default=False), prep=dict(type='bool', required=False, default=False), force=dict(type='bool', required=False, default=False), split=dict(type='bool', required=False, default=False), autodelete=dict(type='str', required=False, choices=['on', 'off'], default='off'))) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.prep = self.module.params.get('prep', False) self.autodelete = self.module.params.get('autodelete', 'off') self.restore = self.module.params.get('restore', False) self.split = self.module.params.get('split', False) self.force = self.module.params.get('force', False) self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path)
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict( name=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present']), fcwwpn=dict(type='str', required=False), iscsiname=dict(type='str', required=False), iogrp=dict(type='str', required=False, default='0:1:2:3'), protocol=dict(type='str', required=False, default='scsi', choices=['scsi', 'nvme']), type=dict(type='str') ) ) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.fcwwpn = self.module.params.get('fcwwpn', '') self.iscsiname = self.module.params.get('iscsiname', '') self.iogrp = self.module.params.get('iogrp', '') self.protocol = self.module.params.get('protocol', '') self.type = self.module.params.get('type', '') self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path )
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict( name=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present']), ownershipgroup=dict(type='str'), removeallhosts=dict(type='bool') ) ) self.changed = "" self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.ownershipgroup = self.module.params.get('ownershipgroup', '') self.removeallhosts = self.module.params.get('removeallhosts', '') # Handling missing mandatory parameter name if not self.name: self.module.fail_json(msg='Missing mandatory parameter: name') self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path, token=self.module.params['token'] )
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict(state=dict(type='str', required=True, choices=['present', 'absent']), rname=dict(type='str', required=True), cvname=dict(type='str', required=True), basevolume=dict(type='str'), ismaster=dict(type='bool', default=True))) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.state = self.module.params['state'] self.rname = self.module.params['rname'] self.cvname = self.module.params['cvname'] # Optional self.basevolume = self.module.params['basevolume'] self.ismaster = self.module.params['ismaster'] # Handling missing mandatory parameter rname if not self.rname: self.module.fail_json(msg='Missing mandatory parameter: rname') # Handling missing mandatory parameter cvname if not self.cvname: self.module.fail_json(msg='Missing mandatory parameter: cvname') self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path, token=self.module.params['token'])
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict( name=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present']), remotecluster=dict(type='str', required=False), force=dict(type='bool', required=False), copytype=dict(type='str', choices=['metro', 'global']), cyclingmode=dict(type='str', required=False, choices=['multi', 'none']), cyclingperiod=dict(type='int', required=False) ) ) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.cluster = self.module.params.get('remotecluster', None) self.force = self.module.params.get('force', False) self.copytype = self.module.params.get('copytype', None) self.cyclingmode = self.module.params.get('cyclingmode', None) self.cyclingperiod = self.module.params.get('cyclingperiod', None) self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path )
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict(name=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present']), mdiskgrp=dict(type='str', required=False), size=dict(type='str', required=False), unit=dict(type='str', default='mb', choices=['b', 'kb', 'mb', 'gb', 'tb', 'pb']), easytier=dict(type='str', default='off', choices=['on', 'off', 'auto']))) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.mdiskgrp = self.module.params['mdiskgrp'] self.size = self.module.params['size'] self.unit = self.module.params['unit'] self.easytier = self.module.params.get('easytier', None) self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path)
def __init__(self): argument_spec = svc_argument_spec() self.module = AnsibleModule(argument_spec=argument_spec) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path, token=None)
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict(name=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present']), level=dict( type='str', choices=['raid0', 'raid1', 'raid5', 'raid6', 'raid10']), drive=dict(type='str', default=None), encrypt=dict(type='str', default='no', choices=['yes', 'no']), mdiskgrp=dict(type='str', required=True))) mutually_exclusive = [] self.module = AnsibleModule(argument_spec=argument_spec, mutually_exclusive=mutually_exclusive, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.level = self.module.params.get('level', None) self.drive = self.module.params.get('drive', None) self.encrypt = self.module.params.get('encrypt', None) self.mdiskgrp = self.module.params.get('mdiskgrp', None) self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path)
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict(volname=dict(type='str', required=True), host=dict(type='str', required=False), state=dict(type='str', required=True, choices=['absent', 'present']), scsi=dict(type='int', required=False), hostcluster=dict(type='str', required=False))) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.volname = self.module.params['volname'] self.state = self.module.params['state'] # Optional self.host = self.module.params['host'] self.hostcluster = self.module.params['hostcluster'] self.scsi = self.module.params['scsi'] # Handline for mandatory parameter volname if not self.volname: self.module.fail_json(msg="Missing mandatory parameter: volname") self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path, token=self.module.params['token'])
def __init__(self, module, clustername, username, password, look_for_keys, key_filename, log_path): """ Initialize module with what we need for initial connection :param clustername: name of the SVC cluster :type clustername: string :param username: SVC username :type username: string :param password: Password for user :type password: string :param look_for_keys: whether to look for keys or not :type look_for_keys: boolean :param key_filename: SSH client private key file :type key_filename: string :param log_path: log file :type log_path: string """ self.module = module self.clustername = clustername self.username = username self.password = password self.look_for_keys = look_for_keys self.key_filename = key_filename self.is_client_connected = False # logging setup log = get_logger(self.__class__.__name__, log_path) self.log = log.info self.client_type = 'paramiko' if paramiko is None: self.module.fail_json(msg='paramiko is not installed') self.client = paramiko.SSHClient() # connect via SSH self.is_client_connected = self._svc_connect() if not self.is_client_connected: self.module.fail_json(msg='Failed to connect')
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict( name=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present', 'prestart', 'start', 'stop']), mdiskgrp=dict(type='str', required=False), volume=dict(type='str', required=True), clone=dict(type='str', required=True), consistgrp=dict(type='str', required=False), grainsize=dict(type='str', required=False, choices=['64', '256']), iogrp=dict(type='str', required=False), copyrate=dict(type='str', required=False, default='50'), cleanrate=dict(type='str', required=False, default='50'), keeptarget=dict(type='bool', required=False), restore=dict(type='bool', required=False), prep=dict(type='bool', required=False), force=dict(type='bool', required=False), split=dict(type='bool', required=False), autodelete=dict(type='str', required=False, choices=['on', 'off'], default='on') ) ) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] self.volume = self.module.params['volume'] self.clone = self.module.params['clone'] # Optional self.mdiskgrp = self.module.params.get('mdiskgrp', None) self.consistgrp = self.module.params.get('consistgrp', None) self.grainsize = self.module.params.get('grainsize', None) self.iogrp = self.module.params.get('iogrp', None) self.copyrate = self.module.params.get('copyrate', '50') self.cleanrate = self.module.params.get('cleanrate', '50') self.keeptarget = self.module.params.get('keeptarget', False) self.restore = self.module.params.get('restore', False) self.prep = self.module.params.get('prep', False) self.force = self.module.params.get('force', False) self.split = self.module.params.get('split', False) self.autodelete = self.module.params.get('autodelete', 'on') # Store source vol info self.source_vol_info = {} self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path )
def __init__(self, timeout=30, cmd_timeout=30.0): """ Constructor for SSH client class. """ argument_spec = svc_ssh_argument_spec() argument_spec.update( dict(command=dict(type='str', required=False), usesshkey=dict(type='str', required=False, default='no', choices=['yes', 'no']), key_filename=dict(type='str', required=False))) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required parameters for module self.command = self.module.params['command'] # local SSH keys will be used in case of password less SSH connection self.usesshkey = self.module.params['usesshkey'] self.key_filename = self.module.params['key_filename'] # Required self.clustername = self.module.params['clustername'] self.username = self.module.params['username'] self.password = self.module.params['password'] self.log_path = log_path # Handling missing mandatory parameter command if not self.command: self.module.fail_json(msg='Missing mandatory parameter: command') if self.password is None: if self.usesshkey == 'yes': self.log( "password is none and use ssh private key. Check for its path" ) if self.key_filename: self.look_for_keys = True else: self.log( "key file_name is not provided, use default one, ~/.ssh/id_rsa.pub" ) self.look_for_keys = True else: self.module.fail_json( msg="You must pass in either password or key for ssh") else: self.look_for_keys = False # Connect to the storage self.ssh_client = IBMSVCssh( module=self.module, clustername=self.module.params['clustername'], username=self.module.params['username'], password=self.module.params['password'], look_for_keys=self.look_for_keys, key_filename=self.key_filename, log_path=log_path)
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict(name=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present']), fcwwpn=dict(type='str', required=False), iscsiname=dict(type='str', required=False), iogrp=dict(type='str', required=False), protocol=dict(type='str', required=False), type=dict(type='str'), site=dict(type='str'), hostcluster=dict(type='str'), nohostcluster=dict(type='bool'))) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # logging setup log_path = self.module.params['log_path'] log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params['name'] self.state = self.module.params['state'] # Optional self.fcwwpn = self.module.params.get('fcwwpn', '') self.iscsiname = self.module.params.get('iscsiname', '') self.iogrp = self.module.params.get('iogrp', '') self.protocol = self.module.params.get('protocol', '') self.type = self.module.params.get('type', '') self.site = self.module.params.get('site', '') self.hostcluster = self.module.params.get('hostcluster', '') self.nohostcluster = self.module.params.get('nohostcluster', '') # Handling duplicate fcwwpn if self.fcwwpn: dup_fcwwpn = self.duplicate_checker(self.fcwwpn.split(':')) if dup_fcwwpn: self.module.fail_json( msg= 'The parameter {0} has been entered multiple times. Enter the parameter only one time.' .format(dup_fcwwpn)) # Handling for missing mandatory parameter name if not self.name: self.module.fail_json(msg='Missing mandatory parameter: name') # Handling for parameter protocol if self.protocol: if self.protocol != 'scsi': self.module.fail_json( msg= "[{0}] is not supported. Only 'scsi' protocol is supported." .format(self.protocol)) self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params['clustername'], domain=self.module.params['domain'], username=self.module.params['username'], password=self.module.params['password'], validate_certs=self.module.params['validate_certs'], log_path=log_path, token=self.module.params['token'])
def __init__(self): argument_spec = svc_argument_spec() argument_spec.update( dict(name=dict(type='str', required=True), state=dict(type='str', required=True, choices=['absent', 'present']), poolA=dict(type='str', required=False), poolB=dict(type='str', required=False), size=dict(type='str', required=False), thin=dict(type='bool', required=False), type=dict(type='str', required=False, choices=['local hyperswap', 'standard']), grainsize=dict(type='str', required=False), rsize=dict(type='str', required=False), compressed=dict(type='bool', required=False), deduplicated=dict(type='bool', required=False))) self.module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) self.vdisk_type = "" self.discovered_poolA = "" self.discovered_poolB = "" self.discovered_standard_vol_pool = "" self.poolA_data = "" self.poolB_data = "" self.isdrp = False self.expand_flag = False self.shrink_flag = False # logging setup log_path = self.module.params.get('log_path') log = get_logger(self.__class__.__name__, log_path) self.log = log.info # Required self.name = self.module.params.get('name') self.state = self.module.params.get('state') if not self.name: self.module.fail_json(msg="Missing mandatory parameter: name") if not self.state: self.module.fail_json(msg="Missing mandatory parameter: state") # Optional self.poolA = self.module.params.get('poolA') self.poolB = self.module.params.get('poolB') self.size = self.module.params.get('size') self.type = self.module.params.get('type') self.compressed = self.module.params.get('compressed') self.thin = self.module.params.get('thin') self.deduplicated = self.module.params.get('deduplicated') self.rsize = self.module.params.get('rsize') self.grainsize = self.module.params.get('grainsize') self.restapi = IBMSVCRestApi( module=self.module, clustername=self.module.params.get('clustername'), domain=self.module.params.get('domain'), username=self.module.params.get('username'), password=self.module.params.get('password'), validate_certs=self.module.params.get('validate_certs'), log_path=log_path, token=self.module.params['token'])