cisco.mso.mso_schema_template_anp_epg_contract 模块 – 管理模式模板中的 EPG 合约

注意

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

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

要安装它,请使用:ansible-galaxy collection install cisco.mso。 您需要进一步的要求才能使用此模块,有关详细信息,请参阅 要求

要在剧本中使用它,请指定:cisco.mso.mso_schema_template_anp_epg_contract

概要

  • 在 Cisco ACI Multi-Site 上管理模式模板中的 EPG 合约。

要求

执行此模块的主机上需要以下要求。

  • Multi Site Orchestrator v2.1 或更高版本

参数

参数

注释

anp

字符串 / 必需

ANP 的名称。

contract

字典

与此 EPG 关联的合约。

此选项不能与 contracts 选项结合使用。

name

字符串 / 必需

合约的名称。

schema

字符串

定义所引用合约的模式的名称。

如果未指定此参数,则默认为当前模式。

template

字符串

定义所引用合约的模板的名称。

如果未指定此参数,则默认为当前模式。

type

字符串 / 必需

合约的类型。

选择

  • "consumer"

  • "provider"

contracts

列表 / elements=dictionary

与此 EPG 关联的合约列表。

此选项不能与 contract 选项结合使用。

当与 force_replace=true 一起使用时,所有配置的合约都将被提供的合约替换。

当与 force_replace=false 一起使用时,只会添加、更新或删除提供的合约。

state=query 结合使用时,必须找到所有提供的合约,否则任务将失败。

name

字符串 / 必需

合约的名称。

schema

字符串

定义所引用合约的模式的名称。

如果未指定此参数,则默认为当前模式。

template

字符串

定义所引用合约的模板的名称。

如果未指定此参数,则默认为当前模式。

type

字符串 / 必需

合约的类型。

选择

  • "consumer"

  • "provider"

epg

字符串 / 必需

EPG 的名称。

force_replace

布尔值

将所有配置的合约替换为提供的合约。

此选项只能与 contracts 选项结合使用。

state=absent 结合使用且没有任何合约配置时,将删除所有配置的静态端口。

选择

  • false

  • true

host

别名: hostname

字符串

ACI Multi Site Orchestrator 主机的 IP 地址或主机名。

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

login_domain

字符串

用于身份验证的登录域名。

默认值为 Local。

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

当使用 HTTPAPI 连接插件时,如果未指定此属性,将使用清单变量 ansible_httpapi_login_domain

output_level

字符串

影响此 MSO 模块的输出。

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

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

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

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

选择

  • "debug"(调试)

  • "info"(信息)

  • "normal" ← (默认)

password(密码)

字符串

用于身份验证的密码。

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

port(端口)

integer(整数)

用于 REST 连接的端口号。

默认值取决于参数 `use_ssl`。

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

schema

字符串 / 必需

Schema 的名称。

state(状态)

字符串

使用 presentabsent 用于添加或删除。

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

选择

  • "absent"(不存在)

  • "present" ← (默认)

  • "query"(查询)

template

字符串 / 必需

Template 的名称。

timeout(超时)

integer(整数)

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

默认值为 30 秒。

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

use_proxy(使用代理)

布尔值

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

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

默认值为 true

选择

  • false

  • true

use_ssl(使用 SSL)

布尔值

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

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

当使用 HTTPAPI 连接插件时,如果未指定此属性,则将使用 inventory 变量 ansible_httpapi_use_ssl

当使用 HTTPAPI 连接插件(mso 或 nd)时,默认值为 false,而当使用旧式连接方法(仅用于 mso)时,默认值为 true

选择

  • false

  • true

username(用户名)

字符串

用于身份验证的用户名。

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

validate_certs(验证证书)

布尔值

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

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

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

默认值为 true

选择

  • false

  • true

注释

注意

  • 此模块旨在支持 Multi Site Orchestrator v2.1 或更高版本。某些或全部功能可能无法在早期版本上工作。

另请参阅

另请参阅

cisco.mso.mso_schema_template_anp_epg

管理 schema 模板中的端点组 (EPG)。

cisco.mso.mso_schema_template_contract_filter

管理 schema 模板中的合同过滤器。

示例

- name: Add a contract to an EPG
  cisco.mso.mso_schema_template_anp_epg_contract:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema 1
    template: Template 1
    anp: ANP 1
    epg: EPG 1
    contract:
      name: Contract 1
      type: consumer
    state: present

- name: Add 2 contracts to an EPG
  cisco.mso.mso_schema_template_anp_epg_contract:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema 1
    template: Template 1
    anp: ANP 1
    epg: EPG 1
    contracts:
      - name: Contract 1
        type: provider
      - name: Contract 1
        type: consumer
    state: present

- name: Replace all existing contracts on an EPG with 2 new contracts
  cisco.mso.mso_schema_template_anp_epg_contract:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema 1
    template: Template 1
    anp: ANP 1
    epg: EPG 1
    force_replace: true
    contracts:
      - name: Contract 2
        type: provider
      - name: Contract 2
        type: consumer
    state: present

- name: Query a specific Contract
  cisco.mso.mso_schema_template_anp_epg_contract:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema 1
    template: Template 1
    anp: ANP 1
    epg: EPG 1
    contract:
      name: Contract 1
      type: consumer
    state: query
  register: query_result

- name: Query a list of Contracts
  cisco.mso.mso_schema_template_anp_epg_contract:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema 1
    template: Template 1
    anp: ANP 1
    epg: EPG 1
    contracts:
      - name: Contract 2
        type: provider
      - name: Contract 2
        type: consumer
    state: query
  register: query_result

- name: Query all Contracts
  cisco.mso.mso_schema_template_anp_epg_contract:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema 1
    template: Template 1
    anp: ANP 1
    state: query
  register: query_result

- name: Remove a Contract
  cisco.mso.mso_schema_template_anp_epg_contract:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema 1
    template: Template 1
    anp: ANP 1
    epg: EPG 1
    contract:
      name: Contract 1
    state: absent

- name: Remove 2 contracts to an EPG
  cisco.mso.mso_schema_template_anp_epg_contract:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema 1
    template: Template 1
    anp: ANP 1
    epg: EPG 1
    contracts:
      - name: Contract 1
        type: provider
      - name: Contract 1
        type: consumer
    state: absent

- name: Remove all existing contracts from an EPG
  cisco.mso.mso_schema_template_anp_epg_contract:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema 1
    template: Template 1
    anp: ANP 1
    epg: EPG 1
    force_replace: true
    state: absent

作者

  • Dag Wieers (@dagwieers)

  • Akini Ross (@akinross)