ngine_io.cloudstack.cs_vpc 模块 – 管理基于 Apache CloudStack 的云上的 VPC。

注意

此模块是 ngine_io.cloudstack 集合(版本 2.5.0)的一部分。

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

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

要在 playbook 中使用它,请指定:ngine_io.cloudstack.cs_vpc

ngine_io.cloudstack 0.1.0 中的新功能

概要

  • 创建、更新和删除 VPC。

要求

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

  • python >= 2.6

  • cs >= 0.9.0

参数

参数

注释

account

字符串

VPC 所属的帐户。

api_http_method

字符串

用于查询 API 端点的 HTTP 方法。

如果未给出,则考虑 CLOUDSTACK_METHOD 环境变量。

选项

  • "get" ← (默认)

  • "post"

api_key

字符串 / 必需

CloudStack API 的 API 密钥。

如果未给出,则考虑 CLOUDSTACK_KEY 环境变量。

api_secret

字符串 / 必需

CloudStack API 的密钥。

如果未设置,则考虑 CLOUDSTACK_SECRET 环境变量。

api_timeout

整数

HTTP 超时,以秒为单位。

如果未给出,则考虑 CLOUDSTACK_TIMEOUT 环境变量。

默认值: 10

api_url

字符串 / 必需

CloudStack API 的 URL,例如 https://cloud.example.com/client/api

如果未给出,则考虑 CLOUDSTACK_ENDPOINT 环境变量。

api_verify_ssl_cert

字符串

验证 CA 授权证书文件。

如果未给出,则考虑 CLOUDSTACK_VERIFY 环境变量。

cidr

字符串

VPC 的 CIDR,例如 10.1.0.0/16

所有 VPC 访客网络的 CIDR 必须在此 CIDR 内。

state=present 时为必需项。

clean_up

布尔值

state=restarted 时是否重新部署 VPC 路由器

选项

  • false

  • true

display_text

字符串

VPC 的显示文本。

如果未设置,则创建时将使用 name

domain

字符串

VPC 所属的域。

name

字符串 / 必需

VPC 的名称。

network_domain

字符串

VPC 的网络域。

VPC 内的所有网络都将属于此域。

仅在创建 VPC 时考虑,无法更改。

poll_async

布尔值

轮询异步作业,直到作业完成。

选项

  • false

  • true ← (默认)

project

字符串

VPC 所属项目的名称。

state

字符串

VPC 的状态。

状态 present 创建已启动的 VPC。

状态 stopped 仅在创建 VPC 时考虑,在 2.6 版本中添加。

选项

  • "present" ← (默认)

  • "absent"

  • "stopped"

  • "restarted"

tags

别名:tag

列表 / 元素=字典

标记列表。 标记是具有键 keyvalue 的字典列表。

要删除所有标记,请设置一个空列表,例如 tags: []

validate_certs

布尔值

在 ngine_io.cloudstack 2.4.0 中添加

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

如果未给出,则考虑 CLOUDSTACK_DANGEROUS_NO_TLS_VERIFY 环境变量。

这应仅用于使用自签名证书的个人控制站点。

选项

  • false

  • true ← (默认)

vpc_offering

字符串

VPC 产品/服务的名称。

如果未设置,则使用默认 VPC 产品/服务。

zone

字符串 / 必需

区域的名称。

注释

注意

  • 有关 cloudstack 模块的详细指南,请参阅 CloudStack 云指南

  • 此模块支持检查模式。

示例

- name: Ensure a VPC is present but not started after creating
  ngine_io.cloudstack.cs_vpc:
    name: my_vpc
    zone: zone01
    display_text: My example VPC
    cidr: 10.10.0.0/16
    state: stopped

- name: Ensure a VPC is present and started after creating
  ngine_io.cloudstack.cs_vpc:
    name: my_vpc
    zone: zone01
    display_text: My example VPC
    cidr: 10.10.0.0/16

- name: Ensure a VPC is absent
  ngine_io.cloudstack.cs_vpc:
    name: my_vpc
    zone: zone01
    state: absent

- name: Ensure a VPC is restarted with clean up
  ngine_io.cloudstack.cs_vpc:
    name: my_vpc
    zone: zone01
    clean_up: yes
    state: restarted

返回值

此处记录了常见的返回值 此处,以下是此模块特有的字段

描述

account

字符串

VPC 所属的帐户。

返回: 成功

示例: "示例 帐户"

cidr

字符串

VPC 的 CIDR。

返回: 成功

示例: "10.10.0.0/16"

display_text

字符串

VPC 的显示文本。

返回: 成功

示例: "我的 示例 VPC"

distributed_vpc_router

布尔值

VPC 是否使用分布式路由器。

返回: 成功

示例: true

domain

字符串

VPC 所属的域。

返回: 成功

示例: "示例 域"

id

字符串

VPC 的 UUID。

返回: 成功

示例: "04589590-ac63-4ffc-93f5-b698b8ac38b6"

name

字符串

VPC 的名称。

返回: 成功

示例: "my_vpc"

network_domain

字符串

VPC 的网络域。

返回: 成功

示例: "example.com"

project

字符串

VPC 所关联的项目名称。

返回: 成功

示例: "Production"

redundant_vpc_router

布尔值

VPC 是否具有冗余路由器。

返回: 成功

示例: true

region_level_vpc

布尔值

VPC 是否为区域级 VPC。

返回: 成功

示例: true

restart_required

布尔值

是否需要重启 VPC 路由器。

返回: 成功

示例: true

state

字符串

VPC 的状态。

返回: 成功

示例: "Enabled"

tags

列表 / 元素=字符串

与 VPC 关联的资源标签列表。

返回: 成功

示例: ["[ { \"key\": \"foo\"", " \"value\": \"bar\" } ]"]

zone

字符串

VPC 所在的区域名称。

返回: 成功

示例: "ch-gva-2"

作者

  • René Moser (@resmo)