community.general.profitbricks 模块 – 创建、销毁、启动、停止和重启 ProfitBricks 虚拟机
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您正在使用 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要其他要求才能使用此模块,请参阅 需求了解详情。
要在剧本中使用它,请指定:community.general.profitbricks
。
概要
创建、销毁、更新、启动、停止和重启 ProfitBricks 虚拟机。创建虚拟机时,可以选择等待其运行后再返回。此模块依赖于 profitbricks >= 1.0.0
需求
执行此模块的主机需要以下需求。
profitbricks
参数
参数 |
注释 |
---|---|
这会将机器分配到公共 LAN。如果不存在具有公共互联网访问权限的 LAN,则会创建一个。 选项
|
|
是否为创建的虚拟机名称递增一个数字。 选项
|
|
卷的总线类型。 选项
|
|
分配给虚拟机的 CPU 核心数。 默认值: |
|
要创建的虚拟机数量。 默认值: |
|
分配给虚拟机的 CPU 系列类型。 选项
|
|
在此处配置此虚拟机的机房。 |
|
要分配的磁盘类型。 选项
|
|
创建虚拟机的系统映像 ID,例如 a3eae284-a2fe-11e4-b187-5f1f641608c8。 |
|
为管理员用户设置的密码。 |
|
实例 ID 列表,目前仅在 state='absent' 时用于移除实例。 默认值: |
|
要将服务器添加到其中的 LAN 的 ID。 默认值: |
|
机房位置。仅当您要创建机房时才使用,否则忽略此值。 选项
|
|
虚拟机的名称。 |
|
分配给虚拟机的内存量。 默认值: |
|
移除您要销毁的虚拟机的 bootVolume。 选项
|
|
允许访问虚拟机的公共 SSH 密钥。 默认值: |
|
创建或终止实例 可用的选项为: 默认值: |
|
ProfitBricks 密码。覆盖 PB_PASSWORD 环境变量。 |
|
ProfitBricks 用户名。覆盖 PB_SUBSCRIPTION_ID 环境变量。 |
|
引导卷的大小(以 GB 为单位)。 默认值: |
|
等待实例处于“运行”状态后再返回 选项
|
|
wait 超时之前的时间(以秒为单位) 默认值: |
属性
属性 |
支持 |
描述 |
---|---|---|
支持:不支持 |
可以在 |
|
支持:不支持 |
在差异模式下,将返回有关已更改内容(或可能需要在 |
示例
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Provisioning example
- name: Create three servers and enumerate their names
community.general.profitbricks:
datacenter: Tardis One
name: web%02d.stackpointcloud.com
cores: 4
ram: 2048
volume_size: 50
cpu_family: INTEL_XEON
image: a3eae284-a2fe-11e4-b187-5f1f641608c8
location: us/las
count: 3
assign_public_ip: true
- name: Remove virtual machines
community.general.profitbricks:
datacenter: Tardis One
instance_ids:
- 'web001.stackpointcloud.com'
- 'web002.stackpointcloud.com'
- 'web003.stackpointcloud.com'
wait_timeout: 500
state: absent
- name: Start virtual machines
community.general.profitbricks:
datacenter: Tardis One
instance_ids:
- 'web001.stackpointcloud.com'
- 'web002.stackpointcloud.com'
- 'web003.stackpointcloud.com'
wait_timeout: 500
state: running
- name: Stop virtual machines
community.general.profitbricks:
datacenter: Tardis One
instance_ids:
- 'web001.stackpointcloud.com'
- 'web002.stackpointcloud.com'
- 'web003.stackpointcloud.com'
wait_timeout: 500
state: stopped