Changed src_intf and dst_intf to list type (#31479)

pull/31516/merge
voipmeister 7 years ago committed by John R Barker
parent 9580a6569e
commit 865a38bb8d

@ -40,11 +40,11 @@ options:
default: present default: present
src_intf: src_intf:
description: description:
- Specifies source interface name. - Specifies source interface name(s).
default: any default: any
dst_intf: dst_intf:
description: description:
- Specifies destination interface name. - Specifies destination interface name(s).
default: any default: any
src_addr: src_addr:
description: description:
@ -153,6 +153,31 @@ EXAMPLES = """
- https - https
state: present state: present
policy_action: accept policy_action: accept
- name: Some Policy
fortios_ipv4_policy:
host: 192.168.0.254
username: admin
password: password
id: 42
comment: "no comment (created by ansible)"
src_intf: vl1000
src_addr:
- some_serverA
- some_serverB
dst_intf:
- vl2000
- vl3000
dst_addr: all
services:
- HTTP
- HTTPS
nat: True
state: present
policy_action: accept
logtraffic: disable
tags:
- policy
""" """
RETURN = """ RETURN = """
@ -179,8 +204,8 @@ def main():
argument_spec = dict( argument_spec = dict(
comment = dict(type='str'), comment = dict(type='str'),
id = dict(type='int', required=True), id = dict(type='int', required=True),
src_intf = dict(default='any'), src_intf = dict(type='list', default='any'),
dst_intf = dict(default='any'), dst_intf = dict(type='list', default='any'),
state = dict(choices=['present', 'absent'], default='present'), state = dict(choices=['present', 'absent'], default='present'),
src_addr = dict(type='list'), src_addr = dict(type='list'),
dst_addr = dict(type='list'), dst_addr = dict(type='list'),
@ -248,9 +273,8 @@ def main():
new_policy = fortigate.get_empty_configuration_block(policy_id, 'edit') new_policy = fortigate.get_empty_configuration_block(policy_id, 'edit')
# src / dest / service / interfaces # src / dest / service / interfaces
new_policy.set_param('srcintf', '"%s"' % (module.params['src_intf'])) new_policy.set_param('srcintf', " ".join('"' + item + '"' for item in module.params['src_intf']))
new_policy.set_param('dstintf', '"%s"' % (module.params['dst_intf'])) new_policy.set_param('dstintf', " ".join('"' + item + '"' for item in module.params['dst_intf']))
new_policy.set_param('srcaddr', " ".join('"' + item + '"' for item in module.params['src_addr'])) new_policy.set_param('srcaddr', " ".join('"' + item + '"' for item in module.params['src_addr']))
new_policy.set_param('dstaddr', " ".join('"' + item + '"' for item in module.params['dst_addr'])) new_policy.set_param('dstaddr', " ".join('"' + item + '"' for item in module.params['dst_addr']))

Loading…
Cancel
Save