community.general.clc_loadbalancer 模块 – 在 CenturyLink Cloud 中创建、删除共享负载均衡器
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了此集合。 它不包含在 ansible-core
中。 要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要进一步的要求才能使用此模块,请参阅 要求 以获取详细信息。
要在 playbook 中使用它,请指定:community.general.clc_loadbalancer
。
概要
一个 Ansible 模块,用于在 CenturyLink Cloud 中创建、删除共享负载均衡器。
要求
执行此模块的主机需要满足以下要求。
python = 2.7
requests >= 2.5.0
clc-sdk
参数
参数 |
注释 |
---|---|
您的 CLC 帐户的别名 |
|
负载均衡器的描述 |
|
负载均衡器所在的机房位置 |
|
-负载均衡器池的均衡方法 选择
|
|
负载均衡器的名称 |
|
需要添加到负载均衡器池的节点列表 默认值: |
|
负载均衡器的持久性方法 选择
|
|
在负载均衡器池的面向公众的一侧配置的端口 选择
|
|
是否创建或删除负载均衡器池 选择
|
|
负载均衡器的状态 选择
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持:完全 |
可以在 |
|
支持:无 |
在 diff 模式下运行时,将返回有关已更改的内容的详细信息(或可能需要在 |
备注
注意
要使用此模块,需要设置以下环境变量,以便访问 Centurylink Cloud - CLC_V2_API_USERNAME(Centurylink Cloud 的帐户登录 ID)、CLC_V2_API_PASSWORD(Centurylink Cloud 的帐户密码)
或者,该模块接受 API 令牌和帐户别名。 API 令牌可以使用 CLC 帐户登录名和密码通过 HTTP API 调用生成 @ https://api.ctl.io/v2/authentication/login - 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: Create Loadbalancer
hosts: localhost
connection: local
tasks:
- name: Actually Create things
community.general.clc_loadbalancer:
name: test
description: test
alias: TEST
location: WA1
port: 443
nodes:
- ipAddress: 10.11.22.123
privatePort: 80
state: present
- name: Add node to an existing loadbalancer pool
hosts: localhost
connection: local
tasks:
- name: Actually Create things
community.general.clc_loadbalancer:
name: test
description: test
alias: TEST
location: WA1
port: 443
nodes:
- ipAddress: 10.11.22.234
privatePort: 80
state: nodes_present
- name: Remove node from an existing loadbalancer pool
hosts: localhost
connection: local
tasks:
- name: Actually Create things
community.general.clc_loadbalancer:
name: test
description: test
alias: TEST
location: WA1
port: 443
nodes:
- ipAddress: 10.11.22.234
privatePort: 80
state: nodes_absent
- name: Delete LoadbalancerPool
hosts: localhost
connection: local
tasks:
- name: Actually Delete things
community.general.clc_loadbalancer:
name: test
description: test
alias: TEST
location: WA1
port: 443
nodes:
- ipAddress: 10.11.22.123
privatePort: 80
state: port_absent
- name: Delete Loadbalancer
hosts: localhost
connection: local
tasks:
- name: Actually Delete things
community.general.clc_loadbalancer:
name: test
description: test
alias: TEST
location: WA1
port: 443
nodes:
- ipAddress: 10.11.22.123
privatePort: 80
state: absent
返回值
常见的返回值在此处记录,以下是此模块特有的字段
键 |
描述 |
---|---|
来自 CLC 的负载均衡器结果对象 返回:成功 示例: |
作者
CLC Runner (@clc-runner)