def apply(self): '''Applies action from playbook''' netapp_utils.ems_log_event("na_ontap_cg_snapshot", self.server) changed = self.cgcreate() self.module.exit_json(changed=changed)
def apply(self): '''Apply action to export-policy''' changed = False export_policy_rule_exists = None export_rule_protocol_changed = False export_rule_ro_rule_changed = False export_rule_rw_rule_changed = False export_rule_allow_suid_enabled = False export_rule_clientmatch_changed = False export_rule_superuser_changed = False netapp_utils.ems_log_event("na_ontap_export_policy_rules", self.server) export_policy_details = self.get_export_policy() if not export_policy_details: if self.state == 'present': self.create_export_policy() export_policy_rule_exists = self.get_export_policy_rule() if self.state == 'absent': if export_policy_rule_exists: # delete changed = True rule_index = export_policy_rule_exists['rule-index'] elif self.state == 'present': if export_policy_rule_exists: # modify rule_index = export_policy_rule_exists['rule-index'] if rule_index: if self.protocol is not None and \ export_policy_rule_exists['protocol'] != self.protocol: export_rule_protocol_changed = True changed = True if self.ro_rule is not None and \ export_policy_rule_exists['ro-rule'] != self.ro_rule: export_rule_ro_rule_changed = True changed = True if self.rw_rule is not None and \ export_policy_rule_exists['rw-rule'] != self.rw_rule: export_rule_rw_rule_changed = True changed = True if self.allow_suid is not None and \ export_policy_rule_exists['is-allow-set-uid-enabled'] != self.allow_suid: export_rule_allow_suid_enabled = True changed = True if self.super_user_security is not None and \ export_policy_rule_exists['super-user-security'] != self.super_user_security: export_rule_superuser_changed = True changed = True if self.client_match is not None and \ export_policy_rule_exists['client-match'] != self.client_match: export_rule_clientmatch_changed = True changed = True else: # create changed = True if changed: if self.module.check_mode: pass else: if self.state == 'present': if not export_policy_rule_exists: self.create_export_policy_rule() else: if export_rule_protocol_changed: self.modify_protocol(rule_index) if export_rule_ro_rule_changed: self.modify_ro_rule(rule_index) if export_rule_rw_rule_changed: self.modify_rw_rule(rule_index) if export_rule_allow_suid_enabled: self.modify_allow_suid(rule_index) if export_rule_clientmatch_changed: self.modify_client_match(rule_index) if export_rule_superuser_changed: self.modify_super_user_security(rule_index) elif self.state == 'absent': self.delete_export_policy_rule(rule_index) self.module.exit_json(changed=changed)
def autosupport_log(self): netapp_utils.ems_log_event("na_ontap_igroup", self.server)
def autosupport_log(self): results = netapp_utils.get_cserver(self.server) cserver = netapp_utils.setup_na_ontap_zapi(module=self.module, vserver=results) netapp_utils.ems_log_event("na_ontap_interface", cserver)
def autosupport_log(self): """ Autosupport log for unix_group :return: None """ netapp_utils.ems_log_event("na_ontap_unix_group", self.server)
def apply(self): """Apply action to nfs""" changed = False nfs_exists = False modify_nfs = False enable_nfs = False disable_nfs = False netapp_utils.ems_log_event("na_ontap_nfs", self.server) nfs_enabled = self.get_nfs_status() nfs_service_details = self.get_nfs_service() is_nfsv4_id_domain_changed = False def state_changed(expected, current): if expected == "enabled" and current == "true": return False if expected == "disabled" and current == "false": return False return True def is_modify_needed(): if (((self.nfsv3 is not None) and state_changed( self.nfsv3, nfs_service_details['is_nfsv3_enabled'])) or ((self.nfsv3_fsid_change is not None) and state_changed( self.nfsv3_fsid_change, nfs_service_details['is_nfsv3_fsid_change_enabled'])) or ((self.nfsv4 is not None) and state_changed( self.nfsv4, nfs_service_details['is_nfsv40_enabled'])) or ((self.nfsv41 is not None) and state_changed( self.nfsv41, nfs_service_details['is_nfsv41_enabled'])) or ((self.tcp is not None) and state_changed( self.tcp, nfs_service_details['is_tcp_enabled'])) or ((self.udp is not None) and state_changed( self.udp, nfs_service_details['is_udp_enabled'])) or ((self.nfsv40_acl is not None) and state_changed( self.nfsv40_acl, nfs_service_details['is_nfsv40_acl_enabled'])) or ((self.nfsv40_write_delegation is not None) and state_changed( self.nfsv40_write_delegation, nfs_service_details['is_nfsv40_write_delegation_enabled'])) or ((self.nfsv40_write_delegation is not None) and state_changed( self.nfsv40_write_delegation, nfs_service_details['is_nfsv40_write_delegation_enabled'])) or ((self.showmount is not None) and state_changed( self.showmount, nfs_service_details['is_showmount_enabled'])) or ((self.vstorage_state is not None) and state_changed(self.vstorage_state, nfs_service_details['is_vstorage_enabled'])) or ((self.tcp_max_xfer_size is not None) and int(self.tcp_max_xfer_size) != int( nfs_service_details['tcp_max_xfer_size']))): return True return False def is_domain_changed(): if (self.nfsv4_id_domain is not None) and (self.nfsv4_id_domain != nfs_service_details['nfsv4_id_domain']): return True return False if nfs_service_details: nfs_exists = True if self.state == 'absent': # delete changed = True elif self.state == 'present': # modify if self.service_state == 'started' and nfs_enabled == 'false': enable_nfs = True changed = True elif self.service_state == 'stopped' and nfs_enabled == 'true': disable_nfs = True changed = True if is_modify_needed(): modify_nfs = True changed = True if is_domain_changed(): is_nfsv4_id_domain_changed = True changed = True else: if self.state == 'present': # create changed = True if changed: if self.module.check_mode: pass else: if self.state == 'present': # execute create if not nfs_exists: self.enable_nfs() nfs_service_details = self.get_nfs_service() if self.service_state == 'stopped': self.disable_nfs() if is_modify_needed(): self.modify_nfs() if is_domain_changed(): self.modify_nfsv4_id_domain() else: if enable_nfs: self.enable_nfs() elif disable_nfs: self.disable_nfs() if modify_nfs: self.modify_nfs() if is_nfsv4_id_domain_changed: self.modify_nfsv4_id_domain() elif self.state == 'absent': # execute delete self.delete_nfs() self.module.exit_json(changed=changed)
def autosupport_log(self): results = netapp_utils.get_cserver(self.server) cserver = netapp_utils.setup_na_ontap_zapi(module=self.module, vserver=results) netapp_utils.ems_log_event("na_ontap_service_processor_network", cserver)
def autosupport_log(self): netapp_utils.ems_log_event("na_ontap_export_policy_rules", self.server)