ngine_io.cloudstack.cs_router 模块 – 管理基于 Apache CloudStack 云的路由器。

注意

此模块是 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_router

ngine_io.cloudstack 0.1.0 中的新增功能

概要

需求

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

  • python >= 2.6

  • cs >= 0.9.0

参数

参数

注释

account

字符串

路由器相关的账户。

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 环境变量。

domain

字符串

路由器相关的域。

name

字符串 / 必填

路由器的名称。

poll_async

布尔值

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

选项

  • false

  • true ← (默认)

project

字符串

路由器相关的项目的名称。

service_offering

字符串

路由器服务提供的名称或 ID。

state

字符串

路由器的状态。

选项

  • "present" ← (默认)

  • "absent"

  • "started"

  • "stopped"

  • "restarted"

validate_certs

布尔值

ngine_io.cloudstack 2.4.0 中新增

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

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

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

选项

  • false

  • true ← (默认)

zone

字符串

路由器部署所在的区域的名称。

如果未设置,则使用所有区域。

备注

注意

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

  • 此模块支持检查模式。

示例

# Ensure the router has the desired service offering, no matter if
# the router is running or not.
- name: Present router
  ngine_io.cloudstack.cs_router:
    name: r-40-VM
    service_offering: System Offering for Software Router

- name: Ensure started
  ngine_io.cloudstack.cs_router:
    name: r-40-VM
    state: started

# Ensure started with desired service offering.
# If the service offerings changes, router will be rebooted.
- name: Ensure started with desired service offering
  ngine_io.cloudstack.cs_router:
    name: r-40-VM
    service_offering: System Offering for Software Router
    state: started

- name: Ensure stopped
  ngine_io.cloudstack.cs_router:
    name: r-40-VM
    state: stopped

- name: Remove a router
  ngine_io.cloudstack.cs_router:
    name: r-40-VM
    state: absent

返回值

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

描述

account

字符串

路由器相关的账户。

返回: success

示例: "admin"

created

字符串

路由器创建的日期。

返回: success

示例: "2014-12-01T14:57:57+0100"

domain

字符串

路由器相关的域。

返回: success

示例: "ROOT"

id

字符串

路由器的 UUID。

返回: success

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

name

字符串

路由器的名称。

返回: success

示例: "r-40-VM"

redundant_state

字符串

路由器的冗余状态。

返回: success

示例: "UNKNOWN"

requires_upgrade

布尔值

路由器是否需要升级到新的模板。

返回: success

示例: false

role

字符串

路由器的角色。

返回: success

示例: "VIRTUAL_ROUTER"

service_offering

字符串

路由器所拥有的服务提供的名称。

返回: success

示例: "System Offering For Software Router"

state

字符串

路由器的状态。

返回: success

示例: "Active"

template_version

字符串

系统VM模板的版本。

返回: success

示例: "4.5.1"

zone

字符串

路由器所在的区域名称。

返回: success

示例: "ch-gva-2"

作者

  • René Moser (@resmo)