cisco.mso.mso_schema_site_anp_epg_staticport 模块 – 管理模式模板中的站点本地 EPG 静态端口

注意

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

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

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

要在 playbook 中使用它,请指定:cisco.mso.mso_schema_site_anp_epg_staticport

概要

  • 管理 Cisco ACI 多站点中模式模板中的站点本地 EPG 静态端口。

要求

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

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

参数

参数

注释

anp

字符串 / 必需

ANP 的名称。

deployment_immediacy

字符串

静态端口的部署立即性。

immediate 表示 立即部署

lazy 表示 按需部署

选择

  • "immediate"

  • "lazy" ←(默认)

epg

字符串 / 必需

EPG 的名称。

fex

字符串

静态端口的 fex id。

force_replace

布尔值

用提供的静态端口替换所有已配置的静态端口。

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

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

选择

  • false

  • true

主机

别名:hostname

字符串

ACI 多站点 Orchestrator 主机的 IP 地址或主机名。

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

字符串

静态端口的叶。

login_domain

字符串

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

默认值为 Local。

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

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

mode

字符串

静态端口的模式。

native 表示 访问 (802.1p)

regular 表示 Trunk

untagged 表示 访问(未标记)

选择

  • "native"

  • "regular"

  • "untagged" ←(默认)

output_level

字符串

影响此 MSO 模块的输出。

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

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

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

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

选择

  • "debug"

  • "info"

  • "normal" ←(默认)

password

字符串

用于身份验证的密码。

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

path

字符串

静态端口的路径。

pod

字符串

静态端口的 pod。

port

整数

用于 REST 连接的端口号。

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

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

primary_micro_segment_vlan

整数

静态端口的主微段 VLAN。

schema

字符串 / 必需

模式的名称。

site

字符串 / 必需

站点的名称。

state

字符串

使用 presentabsent 来添加或删除。

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

选择

  • "absent"

  • "present" ← (默认)

  • "query"

static_ports

list / elements=dictionary

与此 EPG 关联的静态端口列表。

当与 force_replace=true 一起使用时,所有配置的静态端口将被提供的静态端口替换。

当与 force_replace=false 一起使用时,将仅添加、更新或删除提供的静态端口。

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

当未提供 static_ports 属性时,将使用模块属性。

对于列表中提供的每个静态端口,必须解析以下属性

static_ports.type

static_ports.pod

static_ports.leaf

static_ports.path

static_ports.vlan

deployment_immediacy

字符串

静态端口的部署立即性。

immediate 表示 立即部署

lazy 表示按需部署

选择

  • "immediate"

  • "lazy"

fex

字符串

静态端口的 fex id。

字符串

静态端口的叶。

mode

字符串

静态端口的模式。

native 表示 访问 (802.1p)

regular 表示 Trunk

untagged 表示 访问(未标记)

选择

  • "native"

  • "regular"

  • "untagged"

path

字符串

静态端口的路径。

pod

字符串

静态端口的 pod。

primary_micro_segment_vlan

整数

静态端口的主微段 VLAN。

type

字符串

静态端口的路径类型

vpc 用于虚拟端口通道

dpc 用于直接端口通道

port 用于单个接口

选择

  • "port"

  • "vpc"

  • "dpc"

vlan

整数

静态端口的端口封装 VLAN ID。

template

字符串 / 必需

模板的名称。

timeout

整数

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

默认值为 30 秒。

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

type

字符串

静态端口的路径类型

vpc 用于虚拟端口通道

dpc 用于直接端口通道

port 用于单个接口

选择

  • "port" ← (默认)

  • "vpc"

  • "dpc"

use_proxy

布尔值

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

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

默认为 true

选择

  • false

  • true

use_ssl

布尔值

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

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

当使用 HTTPAPI 连接插件时,如果未指定此属性,则将使用库存变量 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

vlan

整数

静态端口的端口封装 VLAN ID。

备注

注意

  • ACI MultiSite PATCH API 存在一个缺陷,需要通过索引引用某些对象。当更改/删除对象时,这可能会导致并发访问时的静默损坏,因为可能引用了错误的对象。此模块受此缺陷的影响。

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

另请参阅

另请参阅

cisco.mso.mso_schema_site_anp_epg

管理模式模板中的站点本地端点组 (EPG)。

cisco.mso.mso_schema_template_anp_epg

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

示例

- name: Add a new static port to a site EPG
  cisco.mso.mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    epg: EPG1
    type: port
    pod: pod-1
    leaf: 101
    path: eth1/1
    vlan: 126
    deployment_immediacy: immediate
    state: present

- name: Add a new static fex port to a site EPG
  mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    epg: EPG1
    type: port
    pod: pod-1
    leaf: 101
    fex: 151
    path: eth1/1
    vlan: 126
    deployment_immediacy: lazy
    state: present

- name: Add a new static VPC to a site EPG
  mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    epg: EPG1
    pod: pod-1
    leaf: 101-102
    path: ansible_polgrp
    vlan: 127
    type: vpc
    mode: untagged
    deployment_immediacy: lazy
    state: present

- name: Add two new static port to a site EPG
  cisco.mso.mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    epg: EPG1
    static_ports:
      - pod: pod-1
        leaf: 101
        path: eth1/1
        vlan: 126
      - pod: pod-2
        leaf: 101
        path: eth2/1
        vlan: 128
    deployment_immediacy: immediate
    state: present

- name: Replace all existing static pors on a site EPG with 2 new static ports
  cisco.mso.mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    epg: EPG1
    force_replace: true
    static_ports:
      - pod: pod-1
        leaf: 101
        path: eth1/1
        vlan: 126
      - pod: pod-2
        leaf: 101
        path: eth2/1
        vlan: 128
    deployment_immediacy: immediate
    state: present

- name: Query a specific site EPG static port
  cisco.mso.mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    epg: EPG1
    type: port
    pod: pod-1
    leaf: 101
    path: eth1/1
    state: query
  register: query_result

- name: Query a list of static ports
  cisco.mso.mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    epg: EPG1
    static_ports:
      - pod: pod-1
        leaf: 101
        path: eth1/1
        vlan: 126
      - pod: pod-2
        leaf: 101
        path: eth2/1
        vlan: 128
    state: query
  register: query_result

- name: Query all site EPG static ports
  cisco.mso.mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    state: query
  register: query_result

- name: Remove a static port from a site EPG
  cisco.mso.mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    epg: EPG1
    type: port
    pod: pod-1
    leaf: 101
    path: eth1/1
    state: absent

- name: Remove two static ports from a site EPG
  cisco.mso.mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    epg: EPG1
    static_ports:
      - pod: pod-1
        leaf: 101
        path: eth1/1
        vlan: 126
      - pod: pod-2
        leaf: 101
        path: eth2/1
        vlan: 128
    deployment_immediacy: immediate
    state: absent

- name: Remove all existing static pors from a site EPG
  cisco.mso.mso_schema_site_anp_epg_staticport:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    schema: Schema1
    site: Site1
    template: Template1
    anp: ANP1
    epg: EPG1
    force_replace: true
    state: absent

作者

  • Dag Wieers (@dagwieers)

  • Akini Ross (@akinross)