ansible.builtin.cs_loadbalancer_rule_member (v2.9.18) — module

Manages load balancer rule members on Apache CloudStack based clouds.

| "added in version" 2.0 of ansible.builtin"

Authors: Darren Worrall (@dazworrall), René Moser (@resmo)

stableinterface | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.18

Description

Add and remove load balancer rule members.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add VMs to an existing load balancer
  cs_loadbalancer_rule_member:
    name: balance_http
    vms:
      - web01
      - web02
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a VM from an existing load balancer
  cs_loadbalancer_rule_member:
    name: balance_http
    vms:
      - web01
      - web02
    state: absent
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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

Inputs

    
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.
    required: true
    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.
    required: true
    type: str

project:
    description:
    - Name of the project the firewall rule is related to.
    type: str

api_secret:
    description:
    - Secret key of the CloudStack API.
    - If not set, the C(CLOUDSTACK_SECRET) env variable is considered.
    required: true
    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:
    default: 10
    description:
    - HTTP timeout in seconds.
    - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered.
    type: int

api_http_method:
    choices:
    - get
    - post
    default: get
    description:
    - HTTP method used to query the API endpoint.
    - If not given, the C(CLOUDSTACK_METHOD) env variable is considered.
    type: str

api_verify_ssl_cert:
    description:
    - Verify CA authority cert file.
    - If not given, the C(CLOUDSTACK_VERIFY) env variable is considered.
    type: str

Outputs

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