cisco.aci.aci_route_control_context 模块 – 管理路由控制上下文 (rtctrl:CtxP)

注意

此模块是 cisco.aci 集合(版本 2.10.1)的一部分。

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

要安装它,请使用:ansible-galaxy collection install cisco.aci

要在 playbook 中使用它,请指定:cisco.aci.aci_route_control_context

概要

  • 管理 Cisco ACI 交换矩阵上路由控制配置文件的路由控制上下文策略。

参数

参数

注释

action

字符串

满足条件时所需的操作。

选项

  • "deny"(拒绝)

  • "permit"(允许)

action_rule

别名: action_rule_name

字符串

要与此路由控制上下文关联的操作规则配置文件的名称。

设置路由映射的规则。

annotation

字符串

用户定义的用于注释对象的字符串。

如果在任务中未指定该值,则将使用环境变量 ACI_ANNOTATION 的值。

如果在任务和环境变量 ACI_ANNOTATION 中均未指定该值,则将使用默认值。

默认值: "orchestrator:ansible"

certificate_name

别名: cert_name

字符串

附加到用于基于签名的身份验证的 APIC AAA 用户的 X.509 证书名称。

如果提供了 private_key 文件名,则此默认值为 private_key 的基本名称,不带扩展名。

如果为 private_key 提供了 PEM 格式的内容,则此默认值为 username 值。

如果在任务中未指定该值,则将使用环境变量 ACI_CERTIFICATE_NAME 的值。

description

别名: descr

字符串

路由控制上下文的描述。

host

别名: hostname

字符串

可由 Ansible 控制主机解析的 APIC 的 IP 地址或主机名。

如果在任务中未指定该值,则将使用环境变量 ACI_HOST 的值。

l3out

别名: l3out_name

字符串

现有 L3Out 的名称。

仅当路由控制配置文件链接到现有 L3Out 时才使用。

match_rule

别名: match_rule_name

字符串

要与此路由控制上下文关联的匹配规则配置文件的名称。

设置关联的匹配规则。

name_alias

字符串

当前对象的别名。这与 ACI 中的 nameAlias 字段相关。

order

整数

路由控制上下文的顺序。

取值范围为 0 到 9。

output_level

字符串

影响此 ACI 模块的输出。

normal 表示标准输出,包括 current 字典

info 添加信息输出,包括 previousproposedsent 字典

debug 添加调试输出,包括 filter_stringmethodresponsestatusurl 信息

如果在任务中未指定该值,则将使用环境变量 ACI_OUTPUT_LEVEL 的值。

选项

  • "debug"(调试)

  • "info"(信息)

  • "normal" ← (默认)

output_path

字符串

用于转储模块生成的 ACI JSON 配置对象的文件路径。

如果任务中未指定该值,则将使用环境变量 ACI_OUTPUT_PATH 的值。

owner_key

字符串

用户定义的 ACI 对象的 ownerKey 属性的字符串。

此属性表示一个密钥,用于使客户端能够拥有其数据以进行实体关联。

如果任务中未指定该值,则将使用环境变量 ACI_OWNER_KEY 的值。

owner_tag

字符串

用户定义的 ACI 对象的 ownerTag 属性的字符串。

此属性表示一个标签,用于使客户端能够添加自己的数据。

例如,指示谁创建了这个对象。

如果任务中未指定该值,则将使用环境变量 ACI_OWNER_TAG 的值。

password

字符串

用于身份验证的密码。

此选项与 private_key 互斥。如果同时提供了 private_key,则将使用 private_key

如果任务中未指定该值,则将使用环境变量 ACI_PASSWORDANSIBLE_NET_PASSWORD 的值。

port

整数

用于 REST 连接的端口号。

默认值取决于参数 use_ssl

如果任务中未指定该值,则将使用环境变量 ACI_PORT 的值。

private_key

别名: cert_key

字符串

PEM 格式的私钥文件或用于基于签名的身份验证的私钥内容。

此值也会影响所使用的默认 certificate_name

此选项与 password 互斥。如果同时提供了 password,则将忽略 password

如果任务中未指定该值,则将使用环境变量 ACI_PRIVATE_KEYANSIBLE_NET_SSH_KEYFILE 的值。

route_control_context

别名: name, route_control_context_name, context

字符串

要创建的路由控制上下文的名称。

route_control_profile

别名: route_control_profile_name

字符串

现有路由控制配置文件的名称。

state

字符串

使用 presentabsent 添加或删除。

使用 query 列出一个或多个对象。

选项

  • "absent"

  • "present" ← (默认)

  • "query"

suppress_previous

别名: no_previous, ignore_previous

boolean

如果为 true,则在向 APIC 发送 POST 更新之前,不会发送 GET 来检查之前的状态。

如果任务中未指定该值,则将使用环境变量 ACI_SUPPRESS_PREVIOUS 的值。

默认值为 false

警告 - 这会导致先前的返回值为空。

将不会检查对象的先前状态,并且 POST 更新将包含所有属性。

选项

  • false

  • true

suppress_verification

别名: no_verification, no_verify, suppress_verify, ignore_verify, ignore_verification

boolean

如果为 true,则在向 APIC 发送 POST 更新之后,不会发送验证 GET。

如果任务中未指定该值,则将使用环境变量 ACI_SUPPRESS_VERIFICATION 的值。

默认值为 false

警告 - 这会导致当前的返回值设置为建议的值。

在单个任务中,将无法验证包含默认值的当前对象。

选项

  • false

  • true

tenant

别名: tenant_name

字符串

现有租户的名称。

timeout

整数

套接字级别的超时时间(以秒为单位)。

如果任务中未指定该值,则将使用环境变量 ACI_TIMEOUT 的值。

默认值为 30。

use_proxy

boolean

如果为 false,即使在目标主机上的环境变量中定义了代理,也不会使用代理。

如果任务中未指定该值,则将使用环境变量 ACI_USE_PROXY 的值。

默认值为 true。

选项

  • false

  • true

use_ssl

boolean

如果为 false,将使用 HTTP 连接而不是默认的 HTTPS 连接。

如果任务中未指定该值,则将使用环境变量 ACI_USE_SSL 的值。

当连接为本地连接时,默认值为 true。

选项

  • false

  • true

username

别名: user

字符串

用于身份验证的用户名。

如果任务中未指定该值,则将使用环境变量 ACI_USERNAMEANSIBLE_NET_USERNAME 的值。

默认值为 admin。

validate_certs

boolean

如果为 false,则不会验证 SSL 证书。

只有在使用自签名证书的个人控制站点上时,才应将其设置为 false

如果任务中未指定该值,则将使用环境变量 ACI_VALIDATE_CERTS 的值。

默认值为 true。

选项

  • false

  • true

注释

注意

  • 使用的 tenantroute_control_profile 必须在您的 playbook 中使用此模块之前存在。可以使用 cisco.aci.aci_tenantcisco.aci.aci_route_control_profile 模块实现这一点。

  • 如果使用 l3out,则使用的 l3out 必须在您的 playbook 中使用此模块之前存在。可以使用 cisco.aci.aci_l3out 模块实现这一点。

  • 如果使用 action_rule,则使用的 action_rule 必须在您的 playbook 中使用此模块之前存在。可以使用模块 cisco.aci.aci_tenant_action_rule_profile 实现这一点。

  • 如果使用 match_rule,则使用的 match_rule 必须在您的 playbook 中使用此模块之前存在。可以使用模块 cisco.aci.aci_match_rule 实现这一点。

另请参阅

另请参阅

cisco.aci.aci_tenant

管理租户 (fv:Tenant)。

cisco.aci.aci_route_control_profile

管理路由控制配置文件 (rtctrl:Profile)。

cisco.aci.aci_l3out

管理第 3 层外部 (L3Out) 对象 (l3ext:Out)。

cisco.aci.aci_tenant_action_rule_profile

管理操作规则配置文件 (rtctrl:AttrP)。

cisco.aci.aci_match_rule

管理匹配规则 (rtctrl:SubjP)。

APIC 管理信息模型参考

有关内部 APIC 类 rtctrl:CtxP 的更多信息。

Cisco ACI 指南

有关如何使用 Ansible 管理 ACI 基础设施的详细信息。

开发 Cisco ACI 模块

有关如何编写自己的 Cisco ACI 模块以做出贡献的详细指南。

示例

- name: Create a route context policy
  cisco.aci.aci_route_control_context:
    host: apic
    username: admin
    password: SomeSecretPassword
    route_control_context: prod_route_control_context
    route_control_profile: prod_route_control_profile
    tenant: production
    l3out: prod_l3out
    action: permit
    order: 0
    action_rule: prod_action_rule_profile
    match_rule: prod_match_rule
    state: present
  delegate_to: localhost

- name: Delete a route context policy
  cisco.aci.aci_route_control_context:
    host: apic
    username: admin
    password: SomeSecretPassword
    route_control_context: prod_route_control_context
    route_control_profile: prod_route_control_profile
    tenant: production
    l3out: prod_l3out
    state: absent
  delegate_to: localhost

- name: Query all route context policy
  cisco.aci.aci_route_control_context:
    host: apic
    username: admin
    password: SomeSecretPassword
    state: query
  delegate_to: localhost
  register: query_result

- name: Query a specific route context policy
  cisco.aci.aci_route_control_profile:
    host: apic
    username: admin
    password: SomeSecretPassword
    route_control_context: prod_route_control_context
    route_control_profile: prod_route_control_profile
    tenant: production
    l3out: prod_l3out
    state: query
  delegate_to: localhost
  register: query_result

返回值

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

Key

描述

current

list / elements=string

模块完成后,来自 APIC 的现有配置

返回: success

示例: [{"fvTenant": {"attributes": {"descr": "生产环境", "dn": "uni/tn-production", "name": "production", "nameAlias": "", "ownerKey": "", "ownerauto_continue": ""}}}]

error

dictionary

从 APIC 返回的错误信息

返回: failure

示例: {"code": "122", "text": "未知受管对象类 foo"}

filter_string

字符串

用于请求的过滤器字符串

返回: failure 或 debug

示例: "?rsp-prop-include=config-only"

method

字符串

用于向 APIC 发出请求的 HTTP 方法

返回: failure 或 debug

示例: "POST"

previous

list / elements=string

模块启动之前,来自 APIC 的原始配置

返回: info

示例: [{"fvTenant": {"attributes": {"descr": "Production", "dn": "uni/tn-production", "name": "production", "nameAlias": "", "ownerKey": "", "ownerauto_continue": ""}}}]

建议的

dictionary

由用户提供的参数组装的配置

返回: info

示例: {"fvTenant": {"attributes": {"descr": "Production environment", "name": "production"}}}

原始

字符串

由 APIC REST API 返回的原始输出(xml 或 json)

返回: 解析错误

示例: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><imdata totalCount=\"1\"><error code=\"122\" text=\"unknown managed object class foo\"/></imdata>"

响应

字符串

来自 APIC 的 HTTP 响应

返回: failure 或 debug

示例: "OK (30 bytes)"

已发送

list / elements=string

推送到 APIC 的实际/最小配置

返回: info

示例: {"fvTenant": {"attributes": {"descr": "Production environment"}}}

状态

整数

来自 APIC 的 HTTP 状态

返回: failure 或 debug

示例: 200

网址

字符串

用于向 APIC 发出请求的 HTTP 网址

返回: failure 或 debug

示例: "https://10.11.12.13/api/mo/uni/tn-production.json"

作者

  • Gaspard Micol (@gmicol)

  • Tim Cragg (@timcragg)