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( log_forwarding_profile=dict(required=True), log_forwarding_profile_match_list=dict(required=True), name=dict(required=True), action_type=dict(default='tagging', choices=['tagging', 'integration']), action=dict(choices=['add-tag', 'remove-tag', 'Azure-Security-Center-Integration']), target=dict(choices=['source-address', 'destination-address']), registration=dict(choices=['localhost', 'panorama', 'remote']), http_profile=dict(), tags=dict(type='list'), timeout=dict(type='int'), ), ) 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) lfp = LogForwardingProfile(module.params['log_forwarding_profile']) parent.add(lfp) try: lfp.refresh() except PanDeviceError as e: module.fail_json(msg='Failed refresh: {0}'.format(e)) ml = lfp.find(module.params['log_forwarding_profile_match_list'], LogForwardingProfileMatchList) if ml is None: module.fail_json(msg='Log forwarding profile match list "{0}" does not exist'.format( module.params['log_forwarding_profile_match_list'])) listing = ml.findall(LogForwardingProfileMatchListAction) spec = { 'name': module.params['name'], 'action_type': module.params['action_type'], 'action': module.params['action'], 'target': module.params['target'], 'registration': module.params['registration'], 'http_profile': module.params['http_profile'], 'tags': module.params['tags'], 'timeout': module.params['timeout'], } obj = LogForwardingProfileMatchListAction(**spec) ml.add(obj) changed = helper.apply_state(obj, listing, module) module.exit_json(changed=changed, 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( log_forwarding_profile=dict(required=True), name=dict(required=True), description=dict(), log_type=dict(default='traffic', choices=[ 'traffic', 'threat', 'wildfire', 'url', 'data', 'gtp', 'tunnel', 'auth', 'sctp' ]), filter=dict(), send_to_panorama=dict(type='bool'), snmp_profiles=dict(type='list'), email_profiles=dict(type='list'), syslog_profiles=dict(type='list'), http_profiles=dict(type='list'), ), ) 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) lfp = LogForwardingProfile(module.params['log_forwarding_profile']) parent.add(lfp) try: lfp.refresh() except PanDeviceError as e: module.fail_json(msg='Failed refresh: {0}'.format(e)) listing = lfp.findall(LogForwardingProfileMatchList) spec = { 'name': module.params['name'], 'description': module.params['description'], 'log_type': module.params['log_type'], 'filter': module.params['filter'], 'send_to_panorama': module.params['send_to_panorama'], 'snmp_profiles': module.params['snmp_profiles'], 'email_profiles': module.params['email_profiles'], 'syslog_profiles': module.params['syslog_profiles'], 'http_profiles': module.params['http_profiles'], } obj = LogForwardingProfileMatchList(**spec) lfp.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), description=dict(), enhanced_logging=dict(type='bool'), ), ) 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 = LogForwardingProfile.refreshall(parent) except PanDeviceError as e: module.fail_json(msg='Failed refresh: {0}'.format(e)) spec = { 'name': module.params['name'], 'description': module.params['description'], 'enhanced_logging': module.params['enhanced_logging'], } obj = LogForwardingProfile(**spec) parent.add(obj) changed, diff = helper.apply_state(obj, listing, module) module.exit_json(changed=changed, diff=diff, msg='Done')