def main(): helper = get_connection( vsys_shared=True, device_group=True, with_state=True, with_classic_provider_spec=True, min_pandevice_version=(0, 11, 1), min_panos_version=(8, 0, 0), argument_spec=dict( http_profile=dict(required=True), name=dict(required=True), address=dict(required=True), protocol=dict(default='HTTPS', choices=['HTTP', 'HTTPS']), http_port=dict(type='int', default=443), tls_version=dict(choices=['1.0', '1.1', '1.2']), certificate_profile=dict(), http_method=dict(default='POST'), http_username=dict(), http_password=dict(no_log=True), ), ) module = AnsibleModule( argument_spec=helper.argument_spec, supports_check_mode=True, required_one_of=helper.required_one_of, ) # Verify imports, build pandevice object tree. parent = helper.get_pandevice_parent(module) sp = HttpServerProfile(module.params['http_profile']) parent.add(sp) try: sp.refresh() except PanDeviceError as e: module.fail_json(msg='Failed refresh: {0}'.format(e)) listing = sp.findall(HttpServer) spec = { 'name': module.params['name'], 'address': module.params['address'], 'protocol': module.params['protocol'], 'port': module.params['http_port'], 'tls_version': module.params['tls_version'], 'certificate_profile': module.params['certificate_profile'], 'http_method': module.params['http_method'], 'username': module.params['http_username'], 'password': module.params['http_password'], } obj = HttpServer(**spec) sp.add(obj) changed, diff = helper.apply_state(obj, listing, module) module.exit_json(changed=changed, diff=diff, msg='Done')
def main(): helper = get_connection( vsys_shared=True, device_group=True, with_state=True, with_classic_provider_spec=True, min_pandevice_version=(0, 11, 1), min_panos_version=(8, 0, 0), argument_spec=dict( http_profile=dict(required=True), name=dict(required=True), address=dict(required=True), protocol=dict(default="HTTPS", choices=["HTTP", "HTTPS"]), http_port=dict(type="int", default=443), tls_version=dict(choices=["1.0", "1.1", "1.2"]), certificate_profile=dict(), http_method=dict(default="POST"), http_username=dict(), http_password=dict(no_log=True), ), ) module = AnsibleModule( argument_spec=helper.argument_spec, supports_check_mode=True, required_one_of=helper.required_one_of, ) # Verify imports, build pandevice object tree. parent = helper.get_pandevice_parent(module) sp = HttpServerProfile(module.params["http_profile"]) parent.add(sp) try: sp.refresh() except PanDeviceError as e: module.fail_json(msg="Failed refresh: {0}".format(e)) listing = sp.findall(HttpServer) spec = { "name": module.params["name"], "address": module.params["address"], "protocol": module.params["protocol"], "port": module.params["http_port"], "tls_version": module.params["tls_version"], "certificate_profile": module.params["certificate_profile"], "http_method": module.params["http_method"], "username": module.params["http_username"], "password": module.params["http_password"], } obj = HttpServer(**spec) sp.add(obj) changed, diff = helper.apply_state(obj, listing, module) module.exit_json(changed=changed, diff=diff, msg="Done")
def main(): helper = get_connection( vsys_shared=True, device_group=True, with_state=True, with_classic_provider_spec=True, min_pandevice_version=(0, 11, 1), min_panos_version=(8, 0, 0), argument_spec=dict( name=dict(required=True), tag_registration=dict(type="bool"), config_name=dict(), config_uri_format=dict(), config_payload=dict(), system_name=dict(), system_uri_format=dict(), system_payload=dict(), threat_name=dict(), threat_uri_format=dict(), threat_payload=dict(), traffic_name=dict(), traffic_uri_format=dict(), traffic_payload=dict(), hip_match_name=dict(), hip_match_uri_format=dict(), hip_match_payload=dict(), url_name=dict(), url_uri_format=dict(), url_payload=dict(), data_name=dict(), data_uri_format=dict(), data_payload=dict(), wildfire_name=dict(), wildfire_uri_format=dict(), wildfire_payload=dict(), tunnel_name=dict(), tunnel_uri_format=dict(), tunnel_payload=dict(), user_id_name=dict(), user_id_uri_format=dict(), user_id_payload=dict(), gtp_name=dict(), gtp_uri_format=dict(), gtp_payload=dict(), auth_name=dict(), auth_uri_format=dict(), auth_payload=dict(), sctp_name=dict(), sctp_uri_format=dict(), sctp_payload=dict(), iptag_name=dict(), iptag_uri_format=dict(), iptag_payload=dict(), ), ) module = AnsibleModule( argument_spec=helper.argument_spec, supports_check_mode=True, required_one_of=helper.required_one_of, ) # Verify imports, build pandevice object tree. parent = helper.get_pandevice_parent(module) try: listing = HttpServerProfile.refreshall(parent) except PanDeviceError as e: module.fail_json(msg="Failed refresh: {0}".format(e)) spec = { "name": module.params["name"], "tag_registration": module.params["tag_registration"], "config_name": module.params["config_name"], "config_uri_format": module.params["config_uri_format"], "config_payload": module.params["config_payload"], "system_name": module.params["system_name"], "system_uri_format": module.params["system_uri_format"], "system_payload": module.params["system_payload"], "threat_name": module.params["threat_name"], "threat_uri_format": module.params["threat_uri_format"], "threat_payload": module.params["threat_payload"], "traffic_name": module.params["traffic_name"], "traffic_uri_format": module.params["traffic_uri_format"], "traffic_payload": module.params["traffic_payload"], "hip_match_name": module.params["hip_match_name"], "hip_match_uri_format": module.params["hip_match_uri_format"], "hip_match_payload": module.params["hip_match_payload"], "url_name": module.params["url_name"], "url_uri_format": module.params["url_uri_format"], "url_payload": module.params["url_payload"], "data_name": module.params["data_name"], "data_uri_format": module.params["data_uri_format"], "data_payload": module.params["data_payload"], "wildfire_name": module.params["wildfire_name"], "wildfire_uri_format": module.params["wildfire_uri_format"], "wildfire_payload": module.params["wildfire_payload"], "tunnel_name": module.params["tunnel_name"], "tunnel_uri_format": module.params["tunnel_uri_format"], "tunnel_payload": module.params["tunnel_payload"], "user_id_name": module.params["user_id_name"], "user_id_uri_format": module.params["user_id_uri_format"], "user_id_payload": module.params["user_id_payload"], "gtp_name": module.params["gtp_name"], "gtp_uri_format": module.params["gtp_uri_format"], "gtp_payload": module.params["gtp_payload"], "auth_name": module.params["auth_name"], "auth_uri_format": module.params["auth_uri_format"], "auth_payload": module.params["auth_payload"], "sctp_name": module.params["sctp_name"], "sctp_uri_format": module.params["sctp_uri_format"], "sctp_payload": module.params["sctp_payload"], "iptag_name": module.params["iptag_name"], "iptag_uri_format": module.params["iptag_uri_format"], "iptag_payload": module.params["iptag_payload"], } obj = HttpServerProfile(**spec) parent.add(obj) changed, diff = helper.apply_state(obj, listing, module) module.exit_json(changed=changed, diff=diff, msg="Done")
def main(): helper = get_connection( vsys_shared=True, device_group=True, with_state=True, with_classic_provider_spec=True, min_pandevice_version=(0, 11, 1), min_panos_version=(8, 0, 0), argument_spec=dict( http_profile=dict(required=True), log_type=dict(required=True, choices=[ 'config', 'system', 'threat', 'traffic', 'hip match', 'url', 'data', 'wildfire', 'tunnel', 'user id', 'gtp', 'auth', 'sctp', 'iptag'] ), param=dict(required=True), value=dict(), ), ) module = AnsibleModule( argument_spec=helper.argument_spec, supports_check_mode=True, required_one_of=helper.required_one_of, ) # Verify imports, build pandevice object tree. parent = helper.get_pandevice_parent(module) sp = HttpServerProfile(module.params['http_profile']) parent.add(sp) try: sp.refresh() except PanDeviceError as e: module.fail_json(msg='Failed refresh: {0}'.format(e)) cls_map = { 'config': HttpConfigParam, 'system': HttpSystemParam, 'threat': HttpThreatParam, 'traffic': HttpTrafficParam, 'hip match': HttpHipMatchParam, 'url': HttpUrlParam, 'data': HttpDataParam, 'wildfire': HttpWildfireParam, 'tunnel': HttpTunnelParam, 'user id': HttpUserIdParam, 'gtp': HttpGtpParam, 'auth': HttpAuthParam, 'sctp': HttpSctpParam, 'iptag': HttpIpTagParam, } cls = cls_map[module.params['log_type']] listing = sp.findall(cls) spec = { 'name': module.params['param'], 'value': module.params['value'], } obj = cls(**spec) sp.add(obj) changed, diff = helper.apply_state(obj, listing, module) module.exit_json(changed=changed, diff=diff, msg='Done')
def main(): helper = get_connection( vsys_shared=True, device_group=True, with_state=True, with_classic_provider_spec=True, min_pandevice_version=(0, 11, 1), min_panos_version=(8, 0, 0), argument_spec=dict( http_profile=dict(required=True), log_type=dict( required=True, choices=[ "config", "system", "threat", "traffic", "hip match", "url", "data", "wildfire", "tunnel", "user id", "gtp", "auth", "sctp", "iptag", ], ), header=dict(required=True), value=dict(), ), ) module = AnsibleModule( argument_spec=helper.argument_spec, supports_check_mode=True, required_one_of=helper.required_one_of, ) # Verify imports, build pandevice object tree. parent = helper.get_pandevice_parent(module) sp = HttpServerProfile(module.params["http_profile"]) parent.add(sp) try: sp.refresh() except PanDeviceError as e: module.fail_json(msg="Failed refresh: {0}".format(e)) cls_map = { "config": HttpConfigHeader, "system": HttpSystemHeader, "threat": HttpThreatHeader, "traffic": HttpTrafficHeader, "hip match": HttpHipMatchHeader, "url": HttpUrlHeader, "data": HttpDataHeader, "wildfire": HttpWildfireHeader, "tunnel": HttpTunnelHeader, "user id": HttpUserIdHeader, "gtp": HttpGtpHeader, "auth": HttpAuthHeader, "sctp": HttpSctpHeader, "iptag": HttpIpTagHeader, } cls = cls_map[module.params["log_type"]] listing = sp.findall(cls) spec = { "name": module.params["header"], "value": module.params["value"], } obj = cls(**spec) sp.add(obj) changed, diff = helper.apply_state(obj, listing, module) module.exit_json(changed=changed, diff=diff, msg="Done")