community.general.clc_modify_server 模块 – 修改 CenturyLink Cloud 中的服务器
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要进一步的要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:community.general.clc_modify_server
。
概要
一个 Ansible 模块,用于修改 CenturyLink Cloud 中的服务器。
要求
执行此模块的主机需要满足以下要求。
python = 2.7
requests >= 2.5.0
clc-sdk
参数
参数 |
注释 |
---|---|
要与服务器关联的警报策略 ID。这与 “alert_policy_name” 互斥 |
|
要与服务器关联的警报策略名称。这与 “alert_policy_id” 互斥 |
|
为超大规模服务器设置的反亲和性策略 ID。这与 “anti_affinity_policy_name” 互斥 |
|
为超大规模服务器设置的反亲和性策略名称。这与 “anti_affinity_policy_id” 互斥 |
|
要在服务器上更新的 CPU 数量 |
|
要设置到服务器的内存(以 GB 为单位)。 |
|
要修改的服务器 ID 列表。 |
|
确保提供的资源处于的状态。 选择
|
|
是否等待配置任务完成才返回。 选择
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持:完全 |
可以在 |
|
支持:无 |
当处于 diff 模式时,将返回已更改(或可能需要在 |
注意
注意
要使用此模块,需要设置以下环境变量,以便访问 Centurylink Cloud - CLC_V2_API_USERNAME,centurylink cloud 的帐户登录 ID - CLC_V2_API_PASSWORD,centurylink cloud 的帐户密码
或者,该模块接受 API 令牌和帐户别名。可以使用 CLC 帐户登录名和密码通过 HTTP api 调用 @ https://api.ctl.io/v2/authentication/login 生成 API 令牌 - CLC_V2_API_TOKEN,从 https://api.ctl.io/v2/authentication/login 生成的 API 令牌 - CLC_ACCT_ALIAS,与 centurylink cloud 关联的帐户别名
用户可以设置 CLC_V2_API_URL 来指定指向不同 CLC 环境的端点。
示例
# Note - You must set the CLC_V2_API_USERNAME And CLC_V2_API_PASSWD Environment variables before running these examples
- name: Set the cpu count to 4 on a server
community.general.clc_modify_server:
server_ids:
- UC1TESTSVR01
- UC1TESTSVR02
cpu: 4
state: present
- name: Set the memory to 8GB on a server
community.general.clc_modify_server:
server_ids:
- UC1TESTSVR01
- UC1TESTSVR02
memory: 8
state: present
- name: Set the anti affinity policy on a server
community.general.clc_modify_server:
server_ids:
- UC1TESTSVR01
- UC1TESTSVR02
anti_affinity_policy_name: 'aa_policy'
state: present
- name: Remove the anti affinity policy on a server
community.general.clc_modify_server:
server_ids:
- UC1TESTSVR01
- UC1TESTSVR02
anti_affinity_policy_name: 'aa_policy'
state: absent
- name: Add the alert policy on a server
community.general.clc_modify_server:
server_ids:
- UC1TESTSVR01
- UC1TESTSVR02
alert_policy_name: 'alert_policy'
state: present
- name: Remove the alert policy on a server
community.general.clc_modify_server:
server_ids:
- UC1TESTSVR01
- UC1TESTSVR02
alert_policy_name: 'alert_policy'
state: absent
- name: Ret the memory to 16GB and cpu to 8 core on a lust if servers
community.general.clc_modify_server:
server_ids:
- UC1TESTSVR01
- UC1TESTSVR02
cpu: 8
memory: 16
state: present
返回值
常见返回值记录在这里,以下是此模块特有的字段
键 |
描述 |
---|---|
已更改的服务器 ID 列表 返回:成功 示例: |
|
已更改的服务器对象列表 返回:成功 示例: |