def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "system_dhcp6_server": { "required": False, "type": "dict", "default": None, "options": { "dns_search_list": { "required": False, "type": "str", "choices": ["delegated", "specify"] }, "dns_server1": { "required": False, "type": "str" }, "dns_server2": { "required": False, "type": "str" }, "dns_server3": { "required": False, "type": "str" }, "dns_service": { "required": False, "type": "str", "choices": ["delegated", "default", "specify"] }, "domain": { "required": False, "type": "str" }, "id": { "required": True, "type": "int" }, "interface": { "required": False, "type": "str" }, "ip_mode": { "required": False, "type": "str", "choices": ["range", "delegated"] }, "ip_range": { "required": False, "type": "list", "options": { "end_ip": { "required": False, "type": "str" }, "id": { "required": True, "type": "int" }, "start_ip": { "required": False, "type": "str" } } }, "lease_time": { "required": False, "type": "int" }, "option1": { "required": False, "type": "str" }, "option2": { "required": False, "type": "str" }, "option3": { "required": False, "type": "str" }, "prefix_range": { "required": False, "type": "list", "options": { "end_prefix": { "required": False, "type": "str" }, "id": { "required": True, "type": "int" }, "prefix_length": { "required": False, "type": "int" }, "start_prefix": { "required": False, "type": "str" } } }, "rapid_commit": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "status": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "subnet": { "required": False, "type": "str" }, "upstream_interface": { "required": False, "type": "str" } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_system_dhcp6( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_system_dhcp6( module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "firewall_address": { "required": False, "type": "dict", "default": None, "options": { "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "allow_routing": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "associated_interface": {"required": False, "type": "str"}, "cache_ttl": {"required": False, "type": "int"}, "color": {"required": False, "type": "int"}, "comment": {"required": False, "type": "str"}, "country": {"required": False, "type": "str"}, "end_ip": {"required": False, "type": "str"}, "epg_name": {"required": False, "type": "str"}, "filter": {"required": False, "type": "str"}, "fqdn": {"required": False, "type": "str"}, "list": {"required": False, "type": "list", "options": { "ip": {"required": True, "type": "str"} }}, "name": {"required": True, "type": "str"}, "obj_id": {"required": False, "type": "str"}, "organization": {"required": False, "type": "str"}, "policy_group": {"required": False, "type": "str"}, "sdn": {"required": False, "type": "str", "choices": ["aci", "aws", "azure", "gcp", "nsx", "nuage", "oci", "openstack"]}, "sdn_tag": {"required": False, "type": "str"}, "start_ip": {"required": False, "type": "str"}, "subnet": {"required": False, "type": "str"}, "subnet_name": {"required": False, "type": "str"}, "tagging": {"required": False, "type": "list", "options": { "category": {"required": False, "type": "str"}, "name": {"required": True, "type": "str"}, "tags": {"required": False, "type": "list", "options": { "name": {"required": True, "type": "str"} }} }}, "tenant": {"required": False, "type": "str"}, "type": {"required": False, "type": "str", "choices": ["ipmask", "iprange", "fqdn", "geography", "wildcard", "wildcard-fqdn", "dynamic"]}, "uuid": {"required": False, "type": "str"}, "visibility": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "wildcard": {"required": False, "type": "str"}, "wildcard_fqdn": {"required": False, "type": "str"} } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_firewall(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_firewall(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "system_replacemsg_traffic_quota": { "required": False, "type": "dict", "default": None, "options": { "buffer": { "required": False, "type": "str" }, "format": { "required": False, "type": "str", "choices": ["none", "text", "html", "wml"] }, "header": { "required": False, "type": "str", "choices": ["none", "http", "8bit"] }, "msg_type": { "required": False, "type": "str" } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_system_replacemsg( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_system_replacemsg( module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, "log_webtrends_filter": { "required": False, "type": "dict", "default": None, "options": { "anomaly": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "dns": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "filter": {"required": False, "type": "str"}, "filter_type": {"required": False, "type": "str", "choices": ["include", "exclude"]}, "forward_traffic": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "gtp": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "local_traffic": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "multicast_traffic": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "netscan_discovery": {"required": False, "type": "str"}, "netscan_vulnerability": {"required": False, "type": "str"}, "severity": {"required": False, "type": "str", "choices": ["emergency", "alert", "critical", "error", "warning", "notification", "information", "debug"]}, "sniffer_traffic": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "ssh": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "voip": {"required": False, "type": "str", "choices": ["enable", "disable"]} } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_log_webtrends(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_log_webtrends(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "firewall_ssl_server": { "required": False, "type": "dict", "default": None, "options": { "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "add_header_x_forwarded_proto": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "ip": {"required": False, "type": "str"}, "mapped_port": {"required": False, "type": "int"}, "name": {"required": True, "type": "str"}, "port": {"required": False, "type": "int"}, "ssl_algorithm": {"required": False, "type": "str", "choices": ["high", "medium", "low"]}, "ssl_cert": {"required": False, "type": "str"}, "ssl_client_renegotiation": {"required": False, "type": "str", "choices": ["allow", "deny", "secure"]}, "ssl_dh_bits": {"required": False, "type": "str", "choices": ["768", "1024", "1536", "2048"]}, "ssl_max_version": {"required": False, "type": "str", "choices": ["tls-1.0", "tls-1.1", "tls-1.2"]}, "ssl_min_version": {"required": False, "type": "str", "choices": ["tls-1.0", "tls-1.1", "tls-1.2"]}, "ssl_mode": {"required": False, "type": "str", "choices": ["half", "full"]}, "ssl_send_empty_frags": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "url_rewrite": {"required": False, "type": "str", "choices": ["enable", "disable"]} } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_firewall(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_firewall(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "router_rip": { "required": False, "type": "dict", "default": None, "options": { "default_information_originate": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "default_metric": { "required": False, "type": "int" }, "distance": { "required": False, "type": "list", "options": { "access_list": { "required": False, "type": "str" }, "distance": { "required": False, "type": "int" }, "id": { "required": True, "type": "int" }, "prefix": { "required": False, "type": "str" } } }, "distribute_list": { "required": False, "type": "list", "options": { "direction": { "required": False, "type": "str", "choices": ["in", "out"] }, "id": { "required": True, "type": "int" }, "interface": { "required": False, "type": "str" }, "listname": { "required": False, "type": "str" }, "status": { "required": False, "type": "str", "choices": ["enable", "disable"] } } }, "garbage_timer": { "required": False, "type": "int" }, "interface": { "required": False, "type": "list", "options": { "auth_keychain": { "required": False, "type": "str" }, "auth_mode": { "required": False, "type": "str", "choices": ["none", "text", "md5"] }, "auth_string": { "required": False, "type": "str" }, "flags": { "required": False, "type": "int" }, "name": { "required": True, "type": "str" }, "receive_version": { "required": False, "type": "str", "choices": ["1", "2"] }, "send_version": { "required": False, "type": "str", "choices": ["1", "2"] }, "send_version2_broadcast": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "split_horizon": { "required": False, "type": "str", "choices": ["poisoned", "regular"] }, "split_horizon_status": { "required": False, "type": "str", "choices": ["enable", "disable"] } } }, "max_out_metric": { "required": False, "type": "int" }, "neighbor": { "required": False, "type": "list", "options": { "id": { "required": True, "type": "int" }, "ip": { "required": False, "type": "str" } } }, "network": { "required": False, "type": "list", "options": { "id": { "required": True, "type": "int" }, "prefix": { "required": False, "type": "str" } } }, "offset_list": { "required": False, "type": "list", "options": { "access_list": { "required": False, "type": "str" }, "direction": { "required": False, "type": "str", "choices": ["in", "out"] }, "id": { "required": True, "type": "int" }, "interface": { "required": False, "type": "str" }, "offset": { "required": False, "type": "int" }, "status": { "required": False, "type": "str", "choices": ["enable", "disable"] } } }, "passive_interface": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } }, "recv_buffer_size": { "required": False, "type": "int" }, "redistribute": { "required": False, "type": "list", "options": { "metric": { "required": False, "type": "int" }, "name": { "required": True, "type": "str" }, "routemap": { "required": False, "type": "str" }, "status": { "required": False, "type": "str", "choices": ["enable", "disable"] } } }, "timeout_timer": { "required": False, "type": "int" }, "update_timer": { "required": False, "type": "int" }, "version": { "required": False, "type": "str", "choices": ["1", "2"] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_router(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_router(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "switch_controller_mac_sync_settings": { "required": False, "type": "dict", "default": None, "options": { "mac_sync_interval": { "required": False, "type": "int" } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_switch_controller( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_switch_controller( module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "firewall_interface_policy": { "required": False, "type": "dict", "default": None, "options": { "address_type": { "required": False, "type": "str", "choices": ["ipv4", "ipv6"] }, "application_list": { "required": False, "type": "str" }, "application_list_status": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "av_profile": { "required": False, "type": "str" }, "av_profile_status": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "comments": { "required": False, "type": "str" }, "dlp_sensor": { "required": False, "type": "str" }, "dlp_sensor_status": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "dsri": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "dstaddr": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } }, "interface": { "required": False, "type": "str" }, "ips_sensor": { "required": False, "type": "str" }, "ips_sensor_status": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "label": { "required": False, "type": "str" }, "logtraffic": { "required": False, "type": "str", "choices": ["all", "utm", "disable"] }, "policyid": { "required": True, "type": "int" }, "scan_botnet_connections": { "required": False, "type": "str", "choices": ["disable", "block", "monitor"] }, "service": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } }, "spamfilter_profile": { "required": False, "type": "str" }, "spamfilter_profile_status": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "srcaddr": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } }, "status": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "webfilter_profile": { "required": False, "type": "str" }, "webfilter_profile_status": { "required": False, "type": "str", "choices": ["enable", "disable"] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_firewall( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_firewall(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "icap_profile": { "required": False, "type": "dict", "default": None, "options": { "methods": { "required": False, "type": "str", "choices": [ "delete", "get", "head", "options", "post", "put", "trace", "other" ] }, "name": { "required": True, "type": "str" }, "replacemsg_group": { "required": False, "type": "str" }, "request": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "request_failure": { "required": False, "type": "str", "choices": ["error", "bypass"] }, "request_path": { "required": False, "type": "str" }, "request_server": { "required": False, "type": "str" }, "response": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "response_failure": { "required": False, "type": "str", "choices": ["error", "bypass"] }, "response_path": { "required": False, "type": "str" }, "response_server": { "required": False, "type": "str" }, "streaming_content_bypass": { "required": False, "type": "str", "choices": ["disable", "enable"] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_icap(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_icap(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "web_proxy_forward_server_group": { "required": False, "type": "dict", "default": None, "options": { "affinity": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "group_down_option": { "required": False, "type": "str", "choices": ["block", "pass"] }, "ldb_method": { "required": False, "type": "str", "choices": ["weighted", "least-session"] }, "name": { "required": True, "type": "str" }, "server_list": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" }, "weight": { "required": False, "type": "int" } } } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_web_proxy( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_web_proxy(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, "state": {"required": True, "type": "str", "choices": ["present", "absent"]}, "system_vdom_property": { "required": False, "type": "dict", "default": None, "options": { "custom_service": {"required": False, "type": "str"}, "description": {"required": False, "type": "str"}, "dialup_tunnel": {"required": False, "type": "str"}, "firewall_address": {"required": False, "type": "str"}, "firewall_addrgrp": {"required": False, "type": "str"}, "firewall_policy": {"required": False, "type": "str"}, "ipsec_phase1": {"required": False, "type": "str"}, "ipsec_phase1_interface": {"required": False, "type": "str"}, "ipsec_phase2": {"required": False, "type": "str"}, "ipsec_phase2_interface": {"required": False, "type": "str"}, "log_disk_quota": {"required": False, "type": "str"}, "name": {"required": True, "type": "str"}, "onetime_schedule": {"required": False, "type": "str"}, "proxy": {"required": False, "type": "str"}, "recurring_schedule": {"required": False, "type": "str"}, "service_group": {"required": False, "type": "str"}, "session": {"required": False, "type": "str"}, "snmp_index": {"required": False, "type": "int"}, "sslvpn": {"required": False, "type": "str"}, "user": {"required": False, "type": "str"}, "user_group": {"required": False, "type": "str"} } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_system(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_system(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "system_password_policy_guest_admin": { "required": False, "type": "dict", "default": None, "options": { "apply_to": { "required": False, "type": "str", "choices": ["guest-admin-password"] }, "change_4_characters": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "expire_day": { "required": False, "type": "int" }, "expire_status": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "min_lower_case_letter": { "required": False, "type": "int" }, "min_non_alphanumeric": { "required": False, "type": "int" }, "min_number": { "required": False, "type": "int" }, "min_upper_case_letter": { "required": False, "type": "int" }, "minimum_length": { "required": False, "type": "int" }, "reuse_password": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "status": { "required": False, "type": "str", "choices": ["enable", "disable"] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_system(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_system(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": False, "type": "str", "choices": ["present", "absent"] }, "ips_rule": { "required": False, "type": "dict", "default": None, "options": { "state": { "required": False, "type": "str", "choices": ["present", "absent"] }, "action": { "required": False, "type": "str", "choices": ["pass", "block"] }, "application": { "required": False, "type": "str" }, "date": { "required": False, "type": "int" }, "group": { "required": False, "type": "str" }, "location": { "required": False, "type": "str" }, "log": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "log_packet": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "metadata": { "required": False, "type": "list", "options": { "id": { "required": True, "type": "int" }, "metaid": { "required": False, "type": "int" }, "valueid": { "required": False, "type": "int" } } }, "name": { "required": True, "type": "str" }, "os": { "required": False, "type": "str" }, "rev": { "required": False, "type": "int" }, "rule_id": { "required": False, "type": "int" }, "service": { "required": False, "type": "str" }, "severity": { "required": False, "type": "str" }, "status": { "required": False, "type": "str", "choices": ["disable", "enable"] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_ips(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_ips(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, "state": {"required": True, "type": "str", "choices": ["present", "absent"]}, "system_mobile_tunnel": { "required": False, "type": "dict", "default": None, "options": { "hash_algorithm": {"required": False, "type": "str", "choices": ["hmac-md5"]}, "home_address": {"required": False, "type": "str"}, "home_agent": {"required": False, "type": "str"}, "lifetime": {"required": False, "type": "int"}, "n_mhae_key": {"required": False, "type": "str"}, "n_mhae_key_type": {"required": False, "type": "str", "choices": ["ascii", "base64"]}, "n_mhae_spi": {"required": False, "type": "int"}, "name": {"required": True, "type": "str"}, "network": {"required": False, "type": "list", "options": { "id": {"required": True, "type": "int"}, "interface": {"required": False, "type": "str"}, "prefix": {"required": False, "type": "str"} }}, "reg_interval": {"required": False, "type": "int"}, "reg_retry": {"required": False, "type": "int"}, "renew_interval": {"required": False, "type": "int"}, "roaming_interface": {"required": False, "type": "str"}, "status": {"required": False, "type": "str", "choices": ["disable", "enable"]}, "tunnel_mode": {"required": False, "type": "str", "choices": ["gre"]} } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_system(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_system(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, "log_eventfilter": { "required": False, "type": "dict", "default": None, "options": { "compliance_check": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "endpoint": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "event": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "ha": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "router": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "security_rating": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "system": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "user": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "vpn": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "wan_opt": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "wireless_activity": {"required": False, "type": "str", "choices": ["enable", "disable"]} } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_log(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_log(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "switch_controller_security_policy_802_1X": { "required": False, "type": "dict", "default": None, "options": { "auth_fail_vlan": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "auth_fail_vlan_id": { "required": False, "type": "str" }, "auth_fail_vlanid": { "required": False, "type": "int" }, "eap_passthru": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "guest_auth_delay": { "required": False, "type": "int" }, "guest_vlan": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "guest_vlan_id": { "required": False, "type": "str" }, "guest_vlanid": { "required": False, "type": "int" }, "mac_auth_bypass": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "name": { "required": True, "type": "str" }, "open_auth": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "policy_type": { "required": False, "type": "str", "choices": ["802.1X"] }, "radius_timeout_overwrite": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "security_mode": { "required": False, "type": "str", "choices": ["802.1X", "802.1X-mac-based"] }, "user_group": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_switch_controller_security_policy( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_switch_controller_security_policy( module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "system_gre_tunnel": { "required": False, "type": "dict", "default": None, "options": { "checksum_reception": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "checksum_transmission": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "dscp_copying": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "interface": { "required": False, "type": "str" }, "ip_version": { "required": False, "type": "str", "choices": ["4", "6"] }, "keepalive_failtimes": { "required": False, "type": "int" }, "keepalive_interval": { "required": False, "type": "int" }, "key_inbound": { "required": False, "type": "int" }, "key_outbound": { "required": False, "type": "int" }, "local_gw": { "required": False, "type": "str" }, "local_gw6": { "required": False, "type": "str" }, "name": { "required": True, "type": "str" }, "remote_gw": { "required": False, "type": "str" }, "remote_gw6": { "required": False, "type": "str" }, "sequence_number_reception": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "sequence_number_transmission": { "required": False, "type": "str", "choices": ["disable", "enable"] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_system(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_system(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": False, "type": "str", "choices": ["present", "absent"] }, "switch_controller_lldp_profile": { "required": False, "type": "dict", "default": None, "options": { "state": { "required": False, "type": "str", "choices": ["present", "absent"] }, "802.1_tlvs": { "required": False, "type": "str", "choices": ["port-vlan-id"] }, "802.3_tlvs": { "required": False, "type": "str", "choices": ["max-frame-size"] }, "auto_isl": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "auto_isl_hello_timer": { "required": False, "type": "int" }, "auto_isl_port_group": { "required": False, "type": "int" }, "auto_isl_receive_timeout": { "required": False, "type": "int" }, "custom_tlvs": { "required": False, "type": "list", "options": { "information_string": { "required": False, "type": "str" }, "name": { "required": True, "type": "str" }, "oui": { "required": False, "type": "str" }, "subtype": { "required": False, "type": "int" } } }, "med_network_policy": { "required": False, "type": "list", "options": { "dscp": { "required": False, "type": "int" }, "name": { "required": True, "type": "str" }, "priority": { "required": False, "type": "int" }, "status": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "vlan": { "required": False, "type": "int" } } }, "med_tlvs": { "required": False, "type": "str", "choices": ["inventory-management", "network-policy"] }, "name": { "required": True, "type": "str" } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_switch_controller( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_switch_controller( module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": False, "type": "str", "choices": ["present", "absent"] }, "firewall_central_snat_map": { "required": False, "type": "dict", "default": None, "options": { "state": { "required": False, "type": "str", "choices": ["present", "absent"] }, "comments": { "required": False, "type": "str" }, "dst_addr": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } }, "dstintf": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } }, "nat": { "required": False, "type": "str", "choices": ["disable", "enable"] }, "nat_ippool": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } }, "nat_port": { "required": False, "type": "str" }, "orig_addr": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } }, "orig_port": { "required": False, "type": "str" }, "policyid": { "required": True, "type": "int" }, "protocol": { "required": False, "type": "int" }, "srcintf": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } }, "status": { "required": False, "type": "str", "choices": ["enable", "disable"] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_firewall( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_firewall(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "dlp_sensor": { "required": False, "type": "dict", "default": None, "options": { "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "comment": {"required": False, "type": "str"}, "dlp_log": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "extended_log": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "filter": {"required": False, "type": "list", "options": { "action": {"required": False, "type": "str", "choices": ["allow", "log-only", "block", "quarantine-ip"]}, "archive": {"required": False, "type": "str", "choices": ["disable", "enable"]}, "company_identifier": {"required": False, "type": "str"}, "expiry": {"required": False, "type": "str"}, "file_size": {"required": False, "type": "int"}, "file_type": {"required": False, "type": "int"}, "filter_by": {"required": False, "type": "str", "choices": ["credit-card", "ssn", "regexp", "file-type", "file-size", "fingerprint", "watermark", "encrypted"]}, "fp_sensitivity": {"required": False, "type": "list", "options": { "name": {"required": True, "type": "str"} }}, "id": {"required": True, "type": "int"}, "match_percentage": {"required": False, "type": "int"}, "name": {"required": False, "type": "str"}, "proto": {"required": False, "type": "str", "choices": ["smtp", "pop3", "imap", "http-get", "http-post", "ftp", "nntp", "mapi", "mm1", "mm3", "mm4", "mm7"]}, "regexp": {"required": False, "type": "str"}, "severity": {"required": False, "type": "str", "choices": ["info", "low", "medium", "high", "critical"]}, "type": {"required": False, "type": "str", "choices": ["file", "message"]} }}, "flow_based": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "full_archive_proto": {"required": False, "type": "str", "choices": ["smtp", "pop3", "imap", "http-get", "http-post", "ftp", "nntp", "mapi", "mm1", "mm3", "mm4", "mm7"]}, "nac_quar_log": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "name": {"required": True, "type": "str"}, "options": {"required": False, "type": "str"}, "replacemsg_group": {"required": False, "type": "str"}, "summary_proto": {"required": False, "type": "str", "choices": ["smtp", "pop3", "imap", "http-get", "http-post", "ftp", "nntp", "mapi", "mm1", "mm3", "mm4", "mm7"]} } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_dlp(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_dlp(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "wireless_controller_qos_profile": { "required": False, "type": "dict", "default": None, "options": { "bandwidth_admission_control": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "bandwidth_capacity": { "required": False, "type": "int" }, "burst": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "call_admission_control": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "call_capacity": { "required": False, "type": "int" }, "comment": { "required": False, "type": "str" }, "downlink": { "required": False, "type": "int" }, "downlink_sta": { "required": False, "type": "int" }, "dscp_wmm_be": { "required": False, "type": "list", "options": { "id": { "required": True, "type": "int" } } }, "dscp_wmm_bk": { "required": False, "type": "list", "options": { "id": { "required": True, "type": "int" } } }, "dscp_wmm_mapping": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "dscp_wmm_vi": { "required": False, "type": "list", "options": { "id": { "required": True, "type": "int" } } }, "dscp_wmm_vo": { "required": False, "type": "list", "options": { "id": { "required": True, "type": "int" } } }, "name": { "required": True, "type": "str" }, "uplink": { "required": False, "type": "int" }, "uplink_sta": { "required": False, "type": "int" }, "wmm": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "wmm_uapsd": { "required": False, "type": "str", "choices": ["enable", "disable"] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_wireless_controller( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_wireless_controller( module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "wireless_controller_hotspot20_anqp_network_auth_type": { "required": False, "type": "dict", "default": None, "options": { "auth_type": { "required": False, "type": "str", "choices": [ "acceptance-of-terms", "online-enrollment", "http-redirection", "dns-redirection" ] }, "name": { "required": True, "type": "str" }, "url": { "required": False, "type": "str" } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_wireless_controller_hotspot20( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_wireless_controller_hotspot20( module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "system_object_tagging": { "required": False, "type": "dict", "default": None, "options": { "address": { "required": False, "type": "str", "choices": ["disable", "mandatory", "optional"] }, "category": { "required": True, "type": "str" }, "color": { "required": False, "type": "int" }, "device": { "required": False, "type": "str", "choices": ["disable", "mandatory", "optional"] }, "interface": { "required": False, "type": "str", "choices": ["disable", "mandatory", "optional"] }, "multiple": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "tags": { "required": False, "type": "list", "options": { "name": { "required": True, "type": "str" } } } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_system(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_system(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "dlp_fp_doc_source": { "required": False, "type": "dict", "default": None, "options": { "date": { "required": False, "type": "int" }, "file_path": { "required": False, "type": "str" }, "file_pattern": { "required": False, "type": "str" }, "keep_modified": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "name": { "required": True, "type": "str" }, "password": { "required": False, "type": "str" }, "period": { "required": False, "type": "str", "choices": ["none", "daily", "weekly", "monthly"] }, "remove_deleted": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "scan_on_creation": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "scan_subdirectories": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "sensitivity": { "required": False, "type": "str" }, "server": { "required": False, "type": "str" }, "server_type": { "required": False, "type": "str", "choices": ["samba"] }, "tod_hour": { "required": False, "type": "int" }, "tod_min": { "required": False, "type": "int" }, "username": { "required": False, "type": "str" }, "vdom": { "required": False, "type": "str", "choices": ["mgmt", "current"] }, "weekday": { "required": False, "type": "str", "choices": [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_dlp(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_dlp(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": True, "type": "str", "choices": ["present", "absent"] }, "system_automation_trigger": { "required": False, "type": "dict", "default": None, "options": { "event_type": { "required": False, "type": "str", "choices": [ "ioc", "event-log", "reboot", "low-memory", "high-cpu", "license-near-expiry", "ha-failover", "config-change", "security-rating-summary", "virus-ips-db-updated" ] }, "ioc_level": { "required": False, "type": "str", "choices": ["medium", "high"] }, "license_type": { "required": False, "type": "str", "choices": [ "forticare-support", "fortiguard-webfilter", "fortiguard-antispam", "fortiguard-antivirus", "fortiguard-ips", "fortiguard-management", "forticloud" ] }, "logid": { "required": False, "type": "int" }, "name": { "required": True, "type": "str" }, "trigger_day": { "required": False, "type": "int" }, "trigger_frequency": { "required": False, "type": "str", "choices": ["hourly", "daily", "weekly", "monthly"] }, "trigger_hour": { "required": False, "type": "int" }, "trigger_minute": { "required": False, "type": "int" }, "trigger_type": { "required": False, "type": "str", "choices": ["event-based", "scheduled"] }, "trigger_weekday": { "required": False, "type": "str", "choices": [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_system(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_system(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, "system_nat64": { "required": False, "type": "dict", "default": None, "options": { "always_synthesize_aaaa_record": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "generate_ipv6_fragment_header": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "nat46_force_ipv4_packet_forwarding": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "nat64_prefix": {"required": False, "type": "str"}, "secondary_prefix": {"required": False, "type": "list", "options": { "name": {"required": True, "type": "str"}, "nat64_prefix": {"required": False, "type": "str"} }}, "secondary_prefix_status": {"required": False, "type": "str", "choices": ["enable", "disable"]}, "status": {"required": False, "type": "str", "choices": ["enable", "disable"]} } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_system(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_system(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "antivirus_quarantine": { "required": False, "type": "dict", "default": None, "options": { "agelimit": { "required": False, "type": "int" }, "destination": { "required": False, "type": "str", "choices": ["NULL", "disk", "FortiAnalyzer"] }, "drop_blocked": { "required": False, "type": "str", "choices": [ "imap", "smtp", "pop3", "http", "ftp", "nntp", "imaps", "smtps", "pop3s", "ftps", "mapi", "cifs", "mm1", "mm3", "mm4", "mm7" ] }, "drop_heuristic": { "required": False, "type": "str", "choices": [ "imap", "smtp", "pop3", "http", "ftp", "nntp", "imaps", "smtps", "pop3s", "https", "ftps", "mapi", "cifs", "mm1", "mm3", "mm4", "mm7" ] }, "drop_infected": { "required": False, "type": "str", "choices": [ "imap", "smtp", "pop3", "http", "ftp", "nntp", "imaps", "smtps", "pop3s", "https", "ftps", "mapi", "cifs", "mm1", "mm3", "mm4", "mm7" ] }, "lowspace": { "required": False, "type": "str", "choices": ["drop-new", "ovrw-old"] }, "maxfilesize": { "required": False, "type": "int" }, "quarantine_quota": { "required": False, "type": "int" }, "store_blocked": { "required": False, "type": "str", "choices": [ "imap", "smtp", "pop3", "http", "ftp", "nntp", "imaps", "smtps", "pop3s", "ftps", "mapi", "cifs", "mm1", "mm3", "mm4", "mm7" ] }, "store_heuristic": { "required": False, "type": "str", "choices": [ "imap", "smtp", "pop3", "http", "ftp", "nntp", "imaps", "smtps", "pop3s", "https", "ftps", "mapi", "cifs", "mm1", "mm3", "mm4", "mm7" ] }, "store_infected": { "required": False, "type": "str", "choices": [ "imap", "smtp", "pop3", "http", "ftp", "nntp", "imaps", "smtps", "pop3s", "https", "ftps", "mapi", "cifs", "mm1", "mm3", "mm4", "mm7" ] } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_antivirus( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_antivirus(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "log_fortianalyzer_setting": { "required": False, "type": "dict", "default": None, "options": { "__change_ip": { "required": False, "type": "int" }, "certificate": { "required": False, "type": "str" }, "conn_timeout": { "required": False, "type": "int" }, "enc_algorithm": { "required": False, "type": "str", "choices": ["high-medium", "high", "low"] }, "faz_type": { "required": False, "type": "int" }, "hmac_algorithm": { "required": False, "type": "str", "choices": ["sha256", "sha1"] }, "ips_archive": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "mgmt_name": { "required": False, "type": "str" }, "monitor_failure_retry_period": { "required": False, "type": "int" }, "monitor_keepalive_period": { "required": False, "type": "int" }, "reliable": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "server": { "required": False, "type": "str" }, "source_ip": { "required": False, "type": "str" }, "ssl_min_proto_version": { "required": False, "type": "str", "choices": ["default", "SSLv3", "TLSv1", "TLSv1-1", "TLSv1-2"] }, "status": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "upload_day": { "required": False, "type": "str" }, "upload_interval": { "required": False, "type": "str", "choices": ["daily", "weekly", "monthly"] }, "upload_option": { "required": False, "type": "str", "choices": ["store-and-upload", "realtime", "1-minute", "5-minute"] }, "upload_time": { "required": False, "type": "str" } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_log_fortianalyzer( module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_log_fortianalyzer( module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "state": { "required": False, "type": "str", "choices": ["present", "absent"] }, "user_tacacsplus": { "required": False, "type": "dict", "default": None, "options": { "state": { "required": False, "type": "str", "choices": ["present", "absent"] }, "authen_type": { "required": False, "type": "str", "choices": ["mschap", "chap", "pap", "ascii", "auto"] }, "authorization": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "key": { "required": False, "type": "str" }, "name": { "required": True, "type": "str" }, "port": { "required": False, "type": "int" }, "secondary_key": { "required": False, "type": "str" }, "secondary_server": { "required": False, "type": "str" }, "server": { "required": False, "type": "str" }, "source_ip": { "required": False, "type": "str" }, "tertiary_key": { "required": False, "type": "str" }, "tertiary_server": { "required": False, "type": "str" } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_user(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_user(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)
def main(): fields = { "host": { "required": False, "type": "str" }, "username": { "required": False, "type": "str" }, "password": { "required": False, "type": "str", "default": "", "no_log": True }, "vdom": { "required": False, "type": "str", "default": "root" }, "https": { "required": False, "type": "bool", "default": True }, "ssl_verify": { "required": False, "type": "bool", "default": True }, "system_csf": { "required": False, "type": "dict", "default": None, "options": { "configuration_sync": { "required": False, "type": "str", "choices": ["default", "local"] }, "fabric_device": { "required": False, "type": "list", "options": { "device_ip": { "required": False, "type": "str" }, "device_type": { "required": False, "type": "str", "choices": ["fortimail"] }, "login": { "required": False, "type": "str" }, "name": { "required": True, "type": "str" }, "password": { "required": False, "type": "str" } } }, "fixed_key": { "required": False, "type": "str" }, "group_name": { "required": False, "type": "str" }, "group_password": { "required": False, "type": "str" }, "management_ip": { "required": False, "type": "str" }, "management_port": { "required": False, "type": "int" }, "status": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "trusted_list": { "required": False, "type": "list", "options": { "action": { "required": False, "type": "str", "choices": ["accept", "deny"] }, "downstream_authorization": { "required": False, "type": "str", "choices": ["enable", "disable"] }, "ha_members": { "required": False, "type": "str" }, "serial": { "required": True, "type": "str" } } }, "upstream_ip": { "required": False, "type": "str" }, "upstream_port": { "required": False, "type": "int" } } } } module = AnsibleModule(argument_spec=fields, supports_check_mode=False) # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None if not legacy_mode: if module._socket_path: connection = Connection(module._socket_path) fos = FortiOSHandler(connection) is_error, has_changed, result = fortios_system(module.params, fos) else: module.fail_json(**FAIL_SOCKET_MSG) else: try: from fortiosapi import FortiOSAPI except ImportError: module.fail_json(msg="fortiosapi module is required") fos = FortiOSAPI() login(module.params, fos) is_error, has_changed, result = fortios_system(module.params, fos) fos.logout() if not is_error: module.exit_json(changed=has_changed, meta=result) else: module.fail_json(msg="Error in repo", meta=result)