community / community.general / 0.1.1 / module / cs_loadbalancer_rule_member Manages load balancer rule members on Apache CloudStack based clouds. Authors: Darren Worrall (@dazworrall), René Moser (@resmo) stableinterface | supported by communitycommunity.general.cs_loadbalancer_rule_member (0.1.1) — module
Install with ansible-galaxy collection install community.general:==0.1.1
collections: - name: community.general version: 0.1.1
Add and remove load balancer rule members.
- name: Add VMs to an existing load balancer cs_loadbalancer_rule_member: name: balance_http vms: - web01 - web02 delegate_to: localhost
- name: Remove a VM from an existing load balancer cs_loadbalancer_rule_member: name: balance_http vms: - web01 - web02 state: absent delegate_to: localhost
# Rolling upgrade of hosts - hosts: webservers serial: 1 pre_tasks: - name: Remove from load balancer cs_loadbalancer_rule_member: name: balance_http vm: "{{ ansible_hostname }}" state: absent delegate_to: localhost tasks: # Perform update post_tasks: - name: Add to load balancer cs_loadbalancer_rule_member: name: balance_http vm: "{{ ansible_hostname }}" state: present delegate_to: localhost
vms: aliases: - vm description: - List of VMs to assign to or remove from the rule. required: true type: list name: description: - The name of the load balancer rule. required: true type: str zone: description: - Name of the zone in which the rule should be located. - If not set, default zone is used. type: str state: choices: - present - absent default: present description: - Should the VMs be present or absent from the rule. type: str domain: description: - Domain the rule is related to. type: str account: description: - Account the rule is related to. type: str api_key: description: - API key of the CloudStack API. - If not given, the C(CLOUDSTACK_KEY) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. type: str api_url: description: - URL of the CloudStack API e.g. https://cloud.example.com/client/api. - If not given, the C(CLOUDSTACK_ENDPOINT) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. type: str project: description: - Name of the project the firewall rule is related to. type: str api_region: default: cloudstack description: - Name of the ini section in the C(cloustack.ini) file. - If not given, the C(CLOUDSTACK_REGION) env variable is considered. type: str api_secret: description: - Secret key of the CloudStack API. - If not set, the C(CLOUDSTACK_SECRET) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. type: str ip_address: aliases: - public_ip description: - Public IP address from where the network traffic will be load balanced from. - Only needed to find the rule if I(name) is not unique. type: str poll_async: default: true description: - Poll async jobs until job has finished. type: bool api_timeout: description: - HTTP timeout in seconds. - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. - Fallback value is 10 seconds if not specified. type: int api_http_method: choices: - get - post description: - HTTP method used to query the API endpoint. - If not given, the C(CLOUDSTACK_METHOD) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. - Fallback value is C(get) if not specified. type: str
account: description: Account the rule is related to. returned: success sample: example account type: str algorithm: description: Load balancer algorithm used. returned: success sample: source type: str cidr: description: CIDR to forward traffic from. returned: success sample: 0.0.0.0/0 type: str description: description: Description of the rule. returned: success sample: http load balancer rule type: str domain: description: Domain the rule is related to. returned: success sample: example domain type: str id: description: UUID of the rule. returned: success sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f type: str name: description: Name of the rule. returned: success sample: http-lb type: str private_port: description: Private IP address. returned: success sample: 80 type: int project: description: Name of project the rule is related to. returned: success sample: Production type: str protocol: description: Protocol of the rule. returned: success sample: tcp type: str public_ip: description: Public IP address. returned: success sample: 1.2.3.4 type: str public_port: description: Public port. returned: success sample: 80 type: int state: description: State of the rule. returned: success sample: Add type: str tags: description: List of resource tags associated with the rule. returned: success sample: '[ { "key": "foo", "value": "bar" } ]' type: list vms: description: Rule members. returned: success sample: '[ "web01", "web02" ]' type: list zone: description: Name of zone the rule is related to. returned: success sample: ch-gva-2 type: str