• 博客
  • Ansible 社区论坛
  • 文档
Ansible Logo
Ansible 社区文档
Ansible

Ansible 入门

  • Ansible 入门指南
  • 执行环境入门指南

安装、升级和配置

  • 安装指南
  • Ansible 移植指南

使用 Ansible

  • 构建 Ansible 清单
  • 使用 Ansible 命令行工具
  • 使用 Ansible 剧本
  • 使用 Ansible vault 保护敏感数据
  • 使用 Ansible 模块和插件
  • 使用 Ansible 集合
  • 在 Windows 和 BSD 上使用 Ansible
  • Ansible 提示和技巧

为 Ansible 作贡献

  • Ansible 社区指南
  • Ansible 集合贡献者指南
  • ansible-core 贡献者指南
  • 高级贡献者指南
  • Ansible 文档样式指南

扩展 Ansible

  • 开发者指南

常见的 Ansible 场景

  • 旧版公共云指南

网络自动化

  • 网络入门
  • 网络高级主题
  • 网络开发者指南

Ansible Galaxy

  • Galaxy 用户指南
  • Galaxy 开发者指南

参考和附录

  • 集合索引
    • Amazon 命名空间中的集合
    • Ansible 命名空间中的集合
    • Arista 命名空间中的集合
    • Awx 命名空间中的集合
    • Azure 命名空间中的集合
    • Check_point 命名空间中的集合
    • Chocolatey 命名空间中的集合
    • Cisco 命名空间中的集合
    • Cloud 命名空间中的集合
    • Cloudscale_ch 命名空间中的集合
    • 社区命名空间中的集合
      • Community.Aws
        • 描述
        • 通信
        • 变更日志
        • 插件索引
      • Community.Ciscosmb
      • Community.Crypto
      • Community.Digitalocean
      • Community.Dns
      • Community.Docker
      • Community.General
      • Community.Grafana
      • Community.Hashi_Vault
      • Community.Hrobot
      • Community.Library_Inventory_Filtering_V1
      • Community.Libvirt
      • Community.Mongodb
      • Community.Mysql
      • Community.Network
      • Community.Okd
      • Community.Postgresql
      • Community.Proxysql
      • Community.Rabbitmq
      • Community.Routeros
      • Community.Sap_Libs
      • Community.Sops
      • Community.Vmware
      • Community.Windows
      • Community.Zabbix
    • 容器命名空间中的集合
    • Cyberark 命名空间中的集合
    • Dellemc 命名空间中的集合
    • F5networks 命名空间中的集合
    • Fortinet 命名空间中的集合
    • Frr 命名空间中的集合
    • Gluster 命名空间中的集合
    • Google 命名空间中的集合
    • Grafana 命名空间中的集合
    • Hetzner 命名空间中的集合
    • Hpe 命名空间中的集合
    • Ibm 命名空间中的集合
    • Ieisystem 命名空间中的集合
    • Infinidat 命名空间中的集合
    • Infoblox 命名空间中的集合
    • Inspur 命名空间中的集合
    • Junipernetworks 命名空间中的集合
    • Kaytus 命名空间中的集合
    • Kubernetes 命名空间中的集合
    • Kubevirt 命名空间中的集合
    • Lowlydba 命名空间中的集合
    • Mellanox 命名空间中的集合
    • Microsoft 命名空间中的集合
    • Netapp 命名空间中的集合
    • Netapp_eseries 命名空间中的集合
    • Netbox 命名空间中的集合
    • Ngine_io 命名空间中的集合
    • Openstack 命名空间中的集合
    • Openvswitch 命名空间中的集合
    • Ovirt 命名空间中的集合
    • Purestorage 命名空间中的集合
    • Sensu 命名空间中的集合
    • Servicenow 命名空间中的集合
    • Splunk 命名空间中的集合
    • T_systems_mms 命名空间中的集合
    • Telekom_mms 命名空间中的集合
    • Theforeman 命名空间中的集合
    • Vmware 命名空间中的集合
    • Vultr 命名空间中的集合
    • Vyos 命名空间中的集合
    • Wti 命名空间中的集合
  • 所有模块和插件的索引
  • 剧本关键字
  • 返回值
  • Ansible 配置设置
  • 控制 Ansible 的行为:优先级规则
  • YAML 语法
  • Python 3 支持
  • 解释器发现
  • 发行版和维护
  • 测试策略
  • 健全性测试
  • 常见问题
  • 词汇表
  • Ansible 参考:模块实用程序
  • 特殊变量
  • Red Hat Ansible Automation Platform
  • Ansible Automation Hub
  • 记录 Ansible 输出

路线图

  • Ansible 路线图
  • ansible-core 路线图




Ansible
  • 集合索引
  • 社区命名空间中的集合
  • Community.Aws
  • community.aws.directconnect_link_aggregation_group 模块 – 管理 Direct Connect LAG 捆绑
  • 在 GitHub 上编辑

community.aws.directconnect_link_aggregation_group 模块 – 管理 Direct Connect LAG 捆绑

注意

此模块是 community.aws 集合 (版本 9.0.0) 的一部分。

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

要安装它,请使用: ansible-galaxy collection install community.aws。您需要其他要求才能使用此模块,有关详细信息,请参阅 需求。

要在剧本中使用它,请指定: community.aws.directconnect_link_aggregation_group。

community.aws 1.0.0 中的新增功能

  • 概要

  • 需求

  • 参数

  • 注释

  • 示例

  • 返回值

概要

  • 创建、删除或修改 Direct Connect 链路聚合组。

  • 在 5.0.0 版本之前,此模块称为 community.aws.aws_direct_connect_link_aggregation_group。用法没有改变。

别名:aws_direct_connect_link_aggregation_group

需求

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

  • python >= 3.6

  • boto3 >= 1.28.0

  • botocore >= 1.31.0

参数

参数

注释

access_key

别名:aws_access_key_id, aws_access_key, ec2_access_key

字符串

AWS 访问密钥 ID。

有关访问令牌的更多信息,请参阅 AWS 文档 https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys。

还可以按优先级递减的顺序使用 AWS_ACCESS_KEY_ID、AWS_ACCESS_KEY 或 EC2_ACCESS_KEY 环境变量。

aws_access_key 和 profile 选项是互斥的。

为与 AWS botocore SDK 保持一致,在 5.1.0 版本中添加了 aws_access_key_id 别名。

ec2_access_key 别名已弃用,将在 2024-12-01 之后的发行版中移除。

EC2_ACCESS_KEY 环境变量的支持已被弃用,并将 2024-12-01 之后的发行版中移除。

aws_ca_bundle

路径

用于验证 SSL 证书的 CA 捆绑包的位置。

还可以使用 AWS_CA_BUNDLE 环境变量。

aws_config

字典

用于修改 botocore 配置的字典。

参数可在 AWS 文档中找到 https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config。

bandwidth

字符串

链路聚合组的带宽。

connection_id

字符串

创建时要与链路聚合组链接的连接 ID。

debug_botocore_endpoint_logs

布尔值

使用 botocore.endpoint 记录器来解析在任务期间进行的唯一(而不是总计)"resource:action" API 调用,将集合输出到任务结果中的 resource_actions 密钥。使用 aws_resource_action 回调将输出到在剧本期间进行的总列表。

还可以使用 ANSIBLE_DEBUG_BOTOCORE_LOGS 环境变量。

选项

  • false ← (默认)

  • true

delete_with_disassociation

布尔值

与 state=absent 一起使用,在将连接与 LAG 分离后删除连接。

选项

  • false ← (默认)

  • true

endpoint_url

别名:ec2_url, aws_endpoint_url, s3_url

字符串

连接到的 URL,而不是默认的 AWS 端点。虽然这可以用于连接到其他与 AWS 兼容的服务,但 amazon.aws 和 community.aws 集合仅针对 AWS 进行测试。

还可以使用 AWS_URL 或 EC2_URL 环境变量,优先级递减。

ec2_url 和 s3_url 别名已弃用,将在 2024-12-01 之后的发行版中移除。

对环境变量EC2_URL的支持已弃用,并将在2024-12-01之后的发行版中移除。

force_delete

布尔值

这允许将最小链接数设置为0,取消关联任何托管连接,并删除与LAG关联的任何虚拟接口。

选项

  • false ← (默认)

  • true

link_aggregation_group_id

字符串

Direct Connect链路聚合组的ID。

location

字符串

链路聚合组的位置。

min_links

整数

LAG本身必须正常运行的最小物理连接数。

name

字符串

Direct Connect链路聚合组的名称。

num_connections

整数

初始化链路聚合组的连接数。

profile

别名:aws_profile

字符串

用于身份验证的命名AWS配置文件。

有关命名配置文件的更多信息,请参阅AWS文档 https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html。

也可以使用AWS_PROFILE环境变量。

profile选项与aws_access_key、aws_secret_key和security_token选项互斥。

region

别名:aws_region, ec2_region

字符串

要使用的AWS区域。

对于IAM、Route53和CloudFront等全局服务,将忽略region。

也可以使用AWS_REGION或EC2_REGION环境变量。

有关更多信息,请参阅Amazon AWS文档 http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region。

别名ec2_region已弃用,并将在2024-12-01之后的发行版中移除。

对环境变量EC2_REGION的支持已弃用,并将在2024-12-01之后的发行版中移除。

secret_key

别名:aws_secret_access_key, aws_secret_key, ec2_secret_key

字符串

AWS密钥访问密钥。

有关访问令牌的更多信息,请参阅 AWS 文档 https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys。

也可以按优先级递减的顺序使用AWS_SECRET_ACCESS_KEY、AWS_SECRET_KEY或EC2_SECRET_KEY环境变量。

secret_key和profile选项互斥。

为了与AWS botocore SDK保持一致,在5.1.0版本中添加了aws_secret_access_key别名。

别名ec2_secret_key已弃用,并将在2024-12-01之后的发行版中移除。

对环境变量EC2_SECRET_KEY的支持已弃用,并将在2024-12-01之后的发行版中移除。

session_token

别名:aws_session_token, security_token, aws_security_token, access_token

字符串

与临时凭据一起使用的AWS STS会话令牌。

有关访问令牌的更多信息,请参阅 AWS 文档 https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys。

也可以按优先级递减的顺序使用AWS_SESSION_TOKEN、AWS_SECURITY_TOKEN或EC2_SECURITY_TOKEN环境变量。

security_token和profile选项互斥。

在3.2.0版本中添加了aws_session_token和session_token别名,在6.0.0版本中将参数名称从security_token重命名为session_token。

security_token、aws_security_token和access_token别名已弃用,并将在2024-12-01之后的发行版中移除。

对环境变量EC2_SECRET_KEY和AWS_SECURITY_TOKEN的支持已弃用,并将在2024-12-01之后的发行版中移除。

state

字符串 / 必需

Direct Connect链路聚合组的状态。

选项

  • "present"

  • "absent"

validate_certs

布尔值

设置为false时,将不会验证与AWS API通信的SSL证书。

强烈建议不要设置validate_certs=false,作为替代方案,请考虑设置aws_ca_bundle。

选项

  • false

  • true ← (默认)

wait

布尔值

是否等待操作完成。

在等待删除虚拟接口时可能很有用。

可以通过设置wait_timeout来控制等待时间。

选项

  • false ← (默认)

  • true

wait_timeout

整数

如果wait=true,则等待的持续时间(以秒为单位)。

默认值: 120

备注

注意

  • 注意:对于模块,环境变量和配置文件是从Ansible的“主机”上下文而不是“控制器”上下文读取的。因此,可能需要将文件显式复制到“主机”。对于查找和连接插件,环境变量和配置文件是从Ansible的“控制器”上下文而不是“主机”上下文读取的。

  • Ansible使用的AWS SDK (boto3)也可能从Ansible“主机”上下文中的配置文件(通常为~/.aws/credentials)读取凭据和其他设置(例如区域)的默认值。有关更多信息,请参阅 https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html。

示例

# create a Direct Connect connection
- community.aws.directconnect_link_aggregation_group:
  state: present
  location: EqDC2
  lag_id: dxlag-xxxxxxxx
  bandwidth: 1Gbps

返回值

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

键

描述

aws_device

字符串

托管LAG的AWS Direct Connection端点。

返回:当state=present时

示例: "EqSe2-1bwfvazist2k0"

changed

字符串

LAG是否已更改。

返回:始终

connections

列表 / 元素=字符串

此LAG捆绑的连接列表。

返回:当state=present时

示例: {"connections": [{"aws_device": "EqSe2-1bwfvazist2k0", "bandwidth": "1Gbps", "connection_id": "dxcon-fgzjah5a", "connection_name": "Requested Connection 1 for Lag dxlag-fgtoh97h", "connection_state": "down", "lag_id": "dxlag-fgnsp4rq", "location": "EqSe2", "owner_account": "123456789012", "region": "us-west-2"}]}

connections_bandwidth

字符串

LAG捆绑的物理连接的单个带宽。

返回:当state=present时

示例: "1Gbps"

lag_id

字符串

链路聚合组的唯一标识符。

返回:当state=present时

示例: "dxlag-fgnsp4rq"

lag_name

字符串

用户为链路聚合组提供的名称。

返回:当state=present时

lag_state

字符串

LAG的状态。

返回:当state=present时

示例: "pending"

location

字符串

连接所在的位置。

返回:当state=present时

示例: "EqSe2"

minimum_links

整数

LAG本身必须正常运行的最小物理连接数。

返回:当state=present时

number_of_connections

整数

LAG捆绑的物理连接数。

返回:当state=present时

owner_account

字符串

LAG的所有者帐户ID。

返回:当state=present时

region

字符串

LAG所在的区域。

返回:当state=present时

作者

  • Sloane Hertel (@s-hertel)

资源链接

  • 问题追踪器
  • 代码库(源码)
  • 通信
上一篇 下一篇

© 版权所有 Ansible 项目贡献者。 上次更新于 2024年12月19日。