def main(): argspec = dict(id=dict(required=True, type="str"), ) module = AnsibleModule(argument_spec=argspec, supports_check_mode=True) sclient = Sepclient(module) sepm_data = sclient.get_command_status(commandid=module.params['id']) module.exit_json(sepm_data=sepm_data, changed=False)
def main(): argspec = dict(domain=dict(required=False, type="str"), ) module = AnsibleModule(argument_spec=argspec, supports_check_mode=True) sclient = Sepclient(module) client_response = sclient.get_domains() list_of_domains = client_response id_list = "" try: id_list += ",".join([domain["id"] for domain in list_of_domains]) except KeyError: module.warn("Unable to compile id_list") module.exit_json(domains=list_of_domains, id_list=id_list, changed=False)
def main(): argspec = dict(domain=dict(required=False, type="str"), ) module = AnsibleModule(argument_spec=argspec, supports_check_mode=True) sclient = Sepclient(module) client_response = sclient.get_groups(domain=module.params["domain"], ) if "content" in client_response: list_of_groups = client_response["content"] id_list = "" try: id_list += ",".join([group["id"] for group in list_of_groups]) except KeyError: module.warn("Unable to compile id_list") module.exit_json(groups=list_of_groups, id_list=id_list, changed=False) else: module.fail_json(msg="Unable to query groups data")
def main(): argspec = dict( computers=dict(required=False, type="str"), groups=dict(required=False, type="str"), type=dict( required=False, type="str", choices=["FULL_SCAN", "QUICK_SCAN"], default="QUICK_SCAN", ), ) module = AnsibleModule( argument_spec=argspec, required_one_of=[["computers", "groups"]], supports_check_mode=False, ) sclient = Sepclient(module) sepm_data = sclient.scan_endpoints( computer_ids=module.params["computers"], group_ids=module.params["groups"], scan_type=module.params["type"], description="Ansible symantec.epm Collection Scan: {0}".format( datetime.datetime.now()), ) if "errorCode" in sepm_data: module.fail_json(msg="Failed to schedule Scan", sepm_data=sepm_data) command_ids = [] if 'commandID_computer' in sepm_data: command_ids.append(sepm_data['commandID_computer']) if 'commandID_group' in sepm_data: command_ids.append(sepm_data['commandID_group']) module.exit_json(sepm_data=sepm_data, command_ids=command_ids, changed=True)
def main(): argspec = dict( computers=dict(required=False, type="str"), groups=dict(required=False, type="str"), quarantine=dict(required=False, type="bool", default=True), ) module = AnsibleModule( argument_spec=argspec, required_one_of=[["computers", "groups"]], supports_check_mode=False, ) sclient = Sepclient(module) # Need a little book keeping for the IBM SEP Client API expectations if module.params["quarantine"] is False: undo = True else: undo = None sepm_data = sclient.quarantine_endpoints( computer_ids=module.params["computers"], group_ids=module.params["groups"], undo=undo, ) if "errorCode" in sepm_data: module.fail_json(msg="Failed to qaurantine.", sepm_data=sepm_data) command_ids = [] if 'commandID_computer' in sepm_data: command_ids.append(sepm_data['commandID_computer']) if 'commandID_group' in sepm_data: command_ids.append(sepm_data['commandID_group']) module.exit_json(sepm_data=sepm_data, command_ids=command_ids, changed=True)
def main(): argspec = dict( name=dict(required=False, type="str"), domain=dict(required=False, type="str"), mac=dict(required=False, type="str"), os=dict( required=False, type="list", choices=[ "CentOs", "Debian", "Fedora", "MacOSX", "Oracle", "OSX", "RedHat", "SUSE", "Ubuntu", "Win10", "Win2K", "Win7", "Win8", "Win81", "WinEmb7", "WinEmb8", "WinEmb81", "WinFundamental", "WinNT", "Win2K3", "Win2K8", "Win2K8R2", "Win2K12", "Win2K12R2", "Win2K16", "WinVista", "WinXP", "WinXPEmb", "WinXPProf64", ], ), ) module = AnsibleModule(argument_spec=argspec, supports_check_mode=True) sclient = Sepclient(module) client_response = sclient.get_computers( computername=module.params["name"], domain=module.params["domain"], os=",".join(module.params["os"]) if module.params["os"] else module.params["os"], ) if "content" in client_response: list_of_computers = client_response["content"] id_list = "" try: id_list += ",".join( [comp["uniqueId"] for comp in list_of_computers]) except KeyError: module.warn("Unable to compile id_list") module.exit_json(computers=list_of_computers, id_list=id_list, changed=False) else: module.fail_json(msg="Unable to query Computers data", sepm_data=client_response)