fortinet.fortimanager.fmgr_router_routemap 模块 – 配置路由映射。

注意

此模块是 fortinet.fortimanager 集合(版本 2.8.2)的一部分。

如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install fortinet.fortimanager

要在 playbook 中使用它,请指定:fortinet.fortimanager.fmgr_router_routemap

fortinet.fortimanager 2.1.0 中的新功能

概要

  • 此模块能够配置 FortiManager 设备。

  • 示例包括所有需要在使用前调整到数据源的参数和值。

参数

参数

注释

access_token

字符串

无需使用用户名和密码即可访问 FortiManager 的令牌。

adom

字符串 / 必填

请求的 URL 中的参数(adom)。

bypass_validation

布尔值

仅当模块架构与 FortiManager API 结构不同时才设置为 True,模块将继续执行而不验证参数。

选项

  • false ←(默认)

  • true

enable_log

布尔值

启用/禁用任务的日志记录。

选项

  • false ←(默认)

  • true

forticloud_access_token

字符串

使用 forticloud API 访问令牌验证 Ansible 客户端。

proposed_method

字符串

覆盖底层 Json RPC 请求的方法。

选项

  • "update"

  • "set"

  • "add"

rc_failed

列表 / 元素=整数

将被覆盖为失败条件的 rc 代码列表。

rc_succeeded

列表 / 元素=整数

将被覆盖为成功条件的 rc 代码列表。

router_routemap

字典

设置的顶层参数。

comments

字符串

可选注释。

name

字符串 / 必填

名称。

rule

列表 / 元素=字典

规则。

action

字符串

操作。

选项

  • "permit"

  • "deny"

id

整数

规则 ID。

match_as_path

别名:match-as-path

字符串

匹配 BGP AS 路径列表。

match_community

别名:match-community

字符串

匹配 BGP 社区列表。

match_community_exact

别名:match-community-exact

字符串

启用/禁用社区的精确匹配。

选项

  • "disable"

  • "enable"

match_extcommunity

别名:match-extcommunity

字符串

匹配 BGP 扩展社区列表。

match_extcommunity_exact

别名:match-extcommunity-exact

字符串

启用/禁用扩展社区的精确匹配。

选项

  • "disable"

  • "enable"

match_flags

别名:match-flags

整数

匹配标志。

match_interface

别名:match-interface

字符串

匹配接口配置。

match_ip6_address

别名:match-ip6-address

字符串

匹配 access-list6 或 prefix-list6 允许的 IPv6 地址。

match_ip6_nexthop

别名:match-ip6-nexthop

字符串

匹配 access-list6 或 prefix-list6 传递的下一跳 IPv6 地址。

match_ip_address

别名:match-ip-address

字符串

匹配 access-list 或 prefix-list 允许的 IP 地址。

match_ip_nexthop

别名:match-ip-nexthop

字符串

匹配 access-list 或 prefix-list 传递的下一跳 IP 地址。

match_metric

别名:match-metric

字符串

匹配重分布路由的度量。

match_origin

别名:match-origin

字符串

匹配 BGP 原始代码。

选项

  • "none"

  • "egp"

  • "igp"

  • "incomplete"

match_route_type

别名:match-route-type

字符串

匹配路由类型。

选项

  • "1"

  • "2"

  • "none"

  • "external-type1"

  • "external-type2"

match_tag

别名:match-tag

字符串

匹配标签。

match_vrf

别名:match-vrf

整数

匹配 VRF ID。

set_aggregator_as

别名: set-aggregator-as

整数

BGP 聚合器 AS。

set_aggregator_ip

别名: set-aggregator-ip

字符串

BGP 聚合器 IP。

set_aspath

别名: set-aspath

任意

(列表) 预先添加 BGP AS 路径属性。

set_aspath_action

别名: set-aspath-action

字符串

指定 set-aspath 的首选操作。

选项

  • "prepend"

  • "replace"

set_atomic_aggregate

别名: set-atomic-aggregate

字符串

启用/禁用 BGP 原子聚合属性。

选项

  • "disable"

  • "enable"

set_community

别名: set-community

任意

(列表) BGP community 属性。

set_community_additive

别名: set-community-additive

字符串

启用/禁用将 set-community 添加到现有 community。

选项

  • "disable"

  • "enable"

set_community_delete

别名: set-community-delete

字符串

删除与 community 列表匹配的 community。

set_dampening_max_suppress

别名: set-dampening-max-suppress

整数

抑制路由的最大持续时间

set_dampening_reachability_half_life

别名: set-dampening-reachability-half-life

整数

惩罚的可达性半衰期时间

set_dampening_reuse

别名: set-dampening-reuse

整数

开始重用路由的值

set_dampening_suppress

别名: set-dampening-suppress

整数

开始抑制路由的值

set_dampening_unreachability_half_life

别名: set-dampening-unreachability-half-life

整数

惩罚的不可达性半衰期时间

set_extcommunity_rt

别名: set-extcommunity-rt

任意

(列表) 路由目标扩展 community。

set_extcommunity_soo

别名: set-extcommunity-soo

任意

(列表) 起始站点扩展 community。

set_flags

别名: set-flags

整数

设置标志。

set_ip6_nexthop

别名: set-ip6-nexthop

字符串

下一跳的 IPv6 全局地址。

set_ip6_nexthop_local

别名: set-ip6-nexthop-local

字符串

下一跳的 IPv6 本地地址。

set_ip_nexthop

别名: set-ip-nexthop

字符串

下一跳的 IP 地址。

set_ip_prefsrc

别名: set-ip-prefsrc

字符串

首选源的 IP 地址。

set_local_preference

别名: set-local-preference

字符串

BGP 本地优先级路径属性。

set_metric

别名: set-metric

字符串

指标值。

set_metric_type

别名: set-metric-type

字符串

指标类型。

选项

  • "1"

  • "2"

  • "none"

  • "external-type1"

  • "external-type2"

set_origin

别名: set-origin

字符串

BGP 起源代码。

选项

  • "none"

  • "egp"

  • "igp"

  • "incomplete"

set_originator_id

别名: set-originator-id

字符串

BGP 发起者 ID 属性。

set_priority

别名: set-priority

整数

路由表的优先级。

set_route_tag

别名: set-route-tag

字符串

路由表的路由标记。

set_tag

别名: set-tag

字符串

标记值。

set_vpnv4_nexthop

别名: set-vpnv4-nexthop

字符串

VPNv4 下一跳的 IP 地址。

set_vpnv6_nexthop

别名: set-vpnv6-nexthop

字符串

VPNv6 下一跳的 IPv6 全局地址。

set_vpnv6_nexthop_local

别名: set-vpnv6-nexthop-local

字符串

VPNv6 下一跳的 IPv6 链路本地地址。

set_weight

别名: set-weight

字符串

路由表的 BGP 权重。

状态

字符串 / 必填

创建、更新或删除对象的指令。

选项

  • "present"

  • "absent"

workspace_locking_adom

字符串

在工作区模式下运行的 FortiManager 要锁定的 ADOM,该值可以是 global 和其他包括 root。

workspace_locking_timeout

整数

等待其他用户释放工作区锁的最长时间(以秒为单位)。

默认值: 300

注释

注意

  • 从 2.4.0 版本开始,所有输入参数都使用下划线命名约定(snake_case)命名。请将“var-name”之类的参数更改为“var_name”。旧的参数名称仍然可用,但您会收到弃用警告。您可以通过在 ansible.cfg 中设置 deprecation_warnings=False 来忽略此警告。

  • 此 FortiManager 模块支持在工作区锁定模式下运行,顶层参数 workspace_locking_adom 和 workspace_locking_timeout 可以帮助完成工作。

  • 要创建或更新对象,请使用 state present 指令。

  • 要删除对象,请使用 state absent 指令。

  • 通常,当返回非零 rc 时,运行一个模块可能会失败。您还可以使用参数 rc_failed 和 rc_succeeded 来覆盖失败或成功的条件

示例

- name: Example playbook (generated based on argument schema)
  hosts: fortimanagers
  connection: httpapi
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
  tasks:
    - name: Configure route maps.
      fortinet.fortimanager.fmgr_router_routemap:
        # bypass_validation: false
        workspace_locking_adom: <value in [global, custom adom including root]>
        workspace_locking_timeout: 300
        # rc_succeeded: [0, -2, -3, ...]
        # rc_failed: [-2, -3, ...]
        adom: <your own value>
        state: present # <value in [present, absent]>
        router_routemap:
          comments: <string>
          name: <string>
          rule:
            -
              action: <value in [permit, deny]>
              id: <integer>
              match_as_path: <string>
              match_community: <string>
              match_community_exact: <value in [disable, enable]>
              match_flags: <integer>
              match_interface: <string>
              match_ip_address: <string>
              match_ip_nexthop: <string>
              match_ip6_address: <string>
              match_ip6_nexthop: <string>
              match_metric: <string>
              match_origin: <value in [none, egp, igp, ...]>
              match_route_type: <value in [1, 2, none, ...]>
              match_tag: <string>
              match_vrf: <integer>
              set_aggregator_as: <integer>
              set_aggregator_ip: <string>
              set_aspath: <list or string>
              set_aspath_action: <value in [prepend, replace]>
              set_atomic_aggregate: <value in [disable, enable]>
              set_community: <list or string>
              set_community_additive: <value in [disable, enable]>
              set_community_delete: <string>
              set_dampening_max_suppress: <integer>
              set_dampening_reachability_half_life: <integer>
              set_dampening_reuse: <integer>
              set_dampening_suppress: <integer>
              set_dampening_unreachability_half_life: <integer>
              set_extcommunity_rt: <list or string>
              set_extcommunity_soo: <list or string>
              set_flags: <integer>
              set_ip_nexthop: <string>
              set_ip6_nexthop: <string>
              set_ip6_nexthop_local: <string>
              set_local_preference: <string>
              set_metric: <string>
              set_metric_type: <value in [1, 2, none, ...]>
              set_origin: <value in [none, egp, igp, ...]>
              set_originator_id: <string>
              set_priority: <integer>
              set_route_tag: <string>
              set_tag: <string>
              set_weight: <string>
              match_extcommunity: <string>
              match_extcommunity_exact: <value in [disable, enable]>
              set_ip_prefsrc: <string>
              set_vpnv4_nexthop: <string>
              set_vpnv6_nexthop: <string>
              set_vpnv6_nexthop_local: <string>

返回值

通用返回值已在此处记录 此处,以下是此模块特有的字段

描述

meta

字典

请求的结果。

返回: 始终

request_url

字符串

请求的完整 URL。

返回: 始终

示例: "/sys/login/user"

response_code

整数

API 请求的状态。

返回: 始终

示例: 0

response_data

list / elements=string

API 响应。

返回: 始终

response_message

字符串

API 响应的描述性消息。

返回: 始终

示例: "OK."

system_information

字典

目标系统的信息。

返回: 始终

rc

整数

请求的状态。

返回: 始终

示例: 0

version_check_warning

list / elements=string

如果当前 FortiManager 版本不支持 playbook 中使用的参数,则会发出警告。

返回: 复杂

作者

  • Xinwei Du (@dux-fortinet)

  • Xing Li (@lix-fortinet)

  • Jie Xue (@JieX19)

  • Link Zheng (@chillancezen)

  • Frank Shen (@fshen01)

  • Hongbin Lu (@fgtdev-hblu)