cloudscale_ch.cloud.load_balancer_listener (2.3.1) — module

Manages load balancer listeners on the cloudscale.ch IaaS service

| "added in version" 2.3.0 of cloudscale_ch.cloud"

Authors: Gaudenz Steinlin (@gaudenz), Kenneth Joss (@k-304)

Install collection

Install with ansible-galaxy collection install cloudscale_ch.cloud:==2.3.1


Add to requirements.yml

  collections:
    - name: cloudscale_ch.cloud
      version: 2.3.1

Description

Get, create, update, delete listeners on the cloudscale.ch IaaS service.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a load balancer listener for a pool using registered variables
- name: Create a load balancer pool
  cloudscale_ch.cloud.load_balancer_pool:
    name: 'swimming-pool'
    load_balancer: '3d41b118-f95c-4897-ad74-2260fea783fc'
    algorithm: 'round_robin'
    protocol: 'tcp'
    api_token: xxxxxx
  register: load_balancer_pool
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a load balancer listener
  cloudscale_ch.cloud.load_balancer_listener:
    name: 'swimming-pool-listener'
    pool: '{{ load_balancer_pool.uuid }}'
    protocol: 'tcp'
    protocol_port: 8080
    tags:
      project: ansible-test
      stage: production
      sla: 24-7
    api_token: xxxxxx
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a load balancer listener for a pool with restriction
- name: Create a load balancer listener with ip restriction
  cloudscale_ch.cloud.load_balancer_listener:
    name: 'new-listener2'
    pool: '618a6cc8-d757-4fab-aa10-d49dc47e667b'
    protocol: 'tcp'
    protocol_port: 8080
    allowed_cidrs:
      - '192.168.3.0/24'
      - '2001:db8:85a3:8d3::/64'
    tags:
      project: ansible-test
      stage: production
      sla: 24-7
    api_token: xxxxxx
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Get load balancer listener facts by name
- name: Get facts of a load balancer listener by name
  cloudscale_ch.cloud.load_balancer_listener:
    name: '{{ cloudscale_resource_prefix }}-test'
    api_token: xxxxxx

Inputs

    
name:
    description:
    - Name of the load balancer listener.
    - Either I(name) or I(uuid) are required.
    type: str

pool:
    description:
    - The pool of the listener.
    type: str

tags:
    description:
    - Tags assosiated with the load balancer. Set this to C({}) to clear any tags.
    type: dict

uuid:
    description:
    - UUID of the load balancer listener.
    - Either I(name) or I(uuid) are required.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the load balancer listener.
    type: str

api_url:
    default: https://api.cloudscale.ch/v1
    description:
    - cloudscale.ch API URL.
    - This can also be passed in the C(CLOUDSCALE_API_URL) environment variable.
    type: str
    version_added: 1.3.0
    version_added_collection: cloudscale_ch.cloud

protocol:
    description:
    - The protocol used for receiving traffic.
    type: str

api_token:
    description:
    - cloudscale.ch API token.
    - This can also be passed in the C(CLOUDSCALE_API_TOKEN) environment variable.
    required: true
    type: str

api_timeout:
    default: 45
    description:
    - Timeout in seconds for calls to the cloudscale.ch API.
    - This can also be passed in the C(CLOUDSCALE_API_TIMEOUT) environment variable.
    type: int

allowed_cidrs:
    description:
    - Restrict the allowed source IPs for this listener.
    - Empty means that any source IP is allowed. If the list is non-empty, traffic from
      source IPs not included is denied.
    elements: str
    type: list

protocol_port:
    description:
    - The port on which traffic is received.
    type: int

timeout_client_data_ms:
    description:
    - Client inactivity timeout in milliseconds.
    type: int

timeout_member_data_ms:
    description:
    - Pool member inactivity timeout in milliseconds.
    type: int

timeout_member_connect_ms:
    description:
    - Pool member connection timeout in milliseconds.
    type: int

Outputs

allowed_cidrs:
  description: Restrict the allowed source IPs for this listener
  returned: success when not state == absent
  sample:
  - 192.168.3.0/24
  - 2001:db8:85a3:8d3::/64
  type: list
created_at:
  description: The creation date and time of the load balancer listener
  returned: success when not state == absent
  sample: '2023-02-07T15:32:02.308041Z'
  type: str
href:
  description: API URL to get details about this load balancer lintener
  returned: success when not state == absent
  sample: https://api.cloudscale.ch/v1/load-balancers/listeners/9fa91f17-fdb4-431f-8a59-78473f64e661
  type: str
name:
  description: The display name of the load balancer listener
  returned: success
  sample: new-listener
  type: str
pool:
  contains:
    href:
      description: API URL to get details about the pool.
      returned: success
      sample: https://api.cloudscale.ch/v1/load-balancers/pools/618a6cc8-d757-4fab-aa10-d49dc47e667b
      type: str
    name:
      description: The name of the pool.
      returned: success
      sample: new-listener
      type: str
    uuid:
      description: The unique identifier for the pool.
      returned: success
      sample: 618a6cc8-d757-4fab-aa10-d49dc47e667b
      type: str
  description: The pool of the load balancer listener
  returned: success when not state == absent
  type: complex
protocol:
  description: The protocol used for receiving traffic
  returned: success when not state == absent
  sample: tcp
  type: str
protocol_port:
  description: The port on which traffic is received
  returned: success when not state == absent
  sample: 8080
  type: int
tags:
  description: Tags assosiated with the load balancer listener
  returned: success
  sample:
    project: my project
  type: dict
timeout_client_data_ms:
  description: Client inactivity timeout in milliseconds
  returned: success when not state == absent
  sample: 50000
  type: int
timeout_member_connect_ms:
  description: Pool member connection timeout in milliseconds
  returned: success when not state == absent
  sample: 50000
  type: int
timeout_member_data_ms:
  description: Pool member inactivity timeout in milliseconds
  returned: success when not state == absent
  sample: 50000
  type: int
uuid:
  description: The unique identifier for this load balancer listener
  returned: success
  sample: 9fa91f17-fdb4-431f-8a59-78473f64e661
  type: str