community.general.cs_loadbalancer_rule (0.1.1) — module

Manages load balancer rules on Apache CloudStack based clouds.

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

stableinterface | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

Add, update and remove load balancer rules.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a load balancer rule
  cs_loadbalancer_rule:
    name: balance_http
    public_ip: 1.2.3.4
    algorithm: leastconn
    public_port: 80
    private_port: 8080
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update algorithm of an existing load balancer rule
  cs_loadbalancer_rule:
    name: balance_http
    public_ip: 1.2.3.4
    algorithm: roundrobin
    public_port: 80
    private_port: 8080
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete a load balancer rule
  cs_loadbalancer_rule:
    name: balance_http
    public_ip: 1.2.3.4
    state: absent
  delegate_to: localhost

Inputs

    
vpc:
    description:
    - Name of the VPC.
    type: str

cidr:
    description:
    - CIDR (full notation) to be used for firewall rule if required.
    type: str

name:
    description:
    - The name of the load balancer rule.
    required: true
    type: str

tags:
    aliases:
    - tag
    description:
    - List of tags. Tags are a list of dictionaries having keys I(key) and I(value).
    - 'To delete all tags, set a empty list e.g. I(tags: []).'
    type: list

zone:
    description:
    - Name of the zone in which the rule should be created.
    - If not set, default zone is used.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of 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

network:
    description:
    - Name of the network.
    type: str

project:
    description:
    - Name of the project the load balancer IP address is related to.
    type: str

protocol:
    description:
    - The protocol to be used on the load balancer
    type: str

algorithm:
    choices:
    - source
    - roundrobin
    - leastconn
    default: source
    description:
    - Load balancer algorithm
    - Required when using I(state=present).
    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.
    required: true
    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

description:
    description:
    - The description of the load balancer rule.
    type: str

public_port:
    description:
    - The public port from where the network traffic will be load balanced from.
    - Required when using I(state=present).
    - Can not be changed once the rule exists due API limitation.
    required: true
    type: int

private_port:
    description:
    - The private port of the private ip address/virtual machine where the network traffic
      will be load balanced to.
    - Required when using I(state=present).
    - Can not be changed once the rule exists due API limitation.
    type: int

open_firewall:
    default: false
    description:
    - Whether the firewall rule for public port should be created, while creating the
      new rule.
    - Use M(cs_firewall) for managing firewall rules.
    type: bool

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

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
zone:
  description: Name of zone the rule is related to.
  returned: success
  sample: ch-gva-2
  type: str